Created
July 24, 2011 01:30
-
-
Save balexand/1102083 to your computer and use it in GitHub Desktop.
Test both Ajax and Javascript-disabled version with the same test using RSpec, Capybara, and Selenium
This file contains hidden or 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
describe "Pages" do | |
# a trivial example that follows a link from "Page A" to "Page B" | |
shared_examples "an example page" do | |
it "should follow link from Page A to Page B" do | |
visit page_a_path | |
click_link "Link to B" | |
page.should have_content("Page B") | |
current_path.should == page_b_path | |
end | |
end | |
# shared examples will be run in Rack::Test driver with no Javascript | |
context "javascript disabled" do | |
it_behaves_like "an example page" | |
end | |
# shared examples will be run in Firefox (via Selenium) with full Javascript support | |
context "javascript enabled", :js => true do | |
it_behaves_like "an example page" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment