Skip to content

Instantly share code, notes, and snippets.

@rimian
Created May 17, 2012 04:32
Show Gist options
  • Save rimian/2716379 to your computer and use it in GitHub Desktop.
Save rimian/2716379 to your computer and use it in GitHub Desktop.
best practice request specs
require 'spec_helper'
describe "request spec test" do
before(:each) do
#log into devise (testing sub domains with capybara work around)
create_user()
sign_in
click_link_to_a_page()
end
it "creates a thing", :js => true do
fill_in 'input', :with => 'foo'
click_button()
page.should have_content('foo')
end
it "deletes a thing", :js => true do
fill_in 'input', :with => 'foo'
click_button()
click_button('destroy')
page.should_not have_content('foo')
end
end
require 'spec_helper'
describe "request spec test" do
before(:each) do
#log into devise (testing sub domains with capybara work around)
create_user()
sign_in
click_link_to_a_page()
end
it "creates and deletes a thing", :js => true do
fill_in 'input', :with => 'foo'
click_button()
page.should have_content('foo')
click_button('destroy')
page.should_not have_content('foo')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment