Created
February 18, 2013 22:30
-
-
Save leshill/4981365 to your computer and use it in GitHub Desktop.
Want to run your Jasmine suite from your RSpec suite? Easy. Add `jasmine_spec.rb` to your `specs/features` and enjoy. We are using https://github.com/bradphelan/jasminerice to run our CoffeeScript suite. You might need to tweak this if you are running Jasmine some other way in your app. Hat tip to Sandro (https://github.com/sandro) who wrote thi…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe 'Jasmine suite', :js do | |
def run_jasmine_tests | |
visit '/jasmine' | |
Timeout.timeout(10) do | |
while page.has_css?('.runningAlert') | |
sleep 0.25 | |
end | |
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