Skip to content

Instantly share code, notes, and snippets.

@xchoi
Created July 9, 2015 22:00
Show Gist options
  • Save xchoi/ed1c207274fe56bb3f8c to your computer and use it in GitHub Desktop.
Save xchoi/ed1c207274fe56bb3f8c to your computer and use it in GitHub Desktop.
jasmine spec from rspec that passes rubocop
require 'spec_helper'
describe 'Jasmine suite', :js do
def run_jasmine_tests
visit '/jasmine'
Timeout.timeout(10) do
sleep 0.25 while page.has_css?('.runningAlert')
end
end
it 'passes' do
run_jasmine_tests
if page.has_css?('.failingAlert')
messages = []
all('.specDetail.failed .description').each_with_index do |spec, index|
messages << "#{index + 1}. #{spec.text}"
end
messages.unshift("Jasmine suite failed with #{messages.size} failures")
fail messages.join("\n")
else
page.should have_css('.passingAlert')
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment