Skip to content

Instantly share code, notes, and snippets.

@leshill
Created February 18, 2013 22:30
Show Gist options
  • Save leshill/4981365 to your computer and use it in GitHub Desktop.
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…
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