Skip to content

Commit

Permalink
Revert "Add a pair of spec helpers"
Browse files Browse the repository at this point in the history
This reverts commit f1c4ec5.
  • Loading branch information
simonewebdesign committed Jan 1, 2013
1 parent f1c4ec5 commit 4033046
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 22 deletions.
6 changes: 3 additions & 3 deletions spec/requests/authentication_pages_spec.rb
Expand Up @@ -8,7 +8,7 @@
before { visit signin_path } before { visit signin_path }


it { should have_selector('h1', text: 'Sign in') } it { should have_selector('h1', text: 'Sign in') }
it { should have_title('Sign in') } it { should have_selector('title', text: 'Sign in') }


describe "with valid information" do describe "with valid information" do
let(:user) { FactoryGirl.create(:user) } let(:user) { FactoryGirl.create(:user) }
Expand All @@ -19,7 +19,7 @@
# end # end
before { valid_signin(user) } before { valid_signin(user) }


it { should have_title(user.name) } it { should have_selector('title', text: user.name) }
it { should have_link('Profile', href: user_path(user)) } it { should have_link('Profile', href: user_path(user)) }
it { should have_link('Sign out', href: signout_path) } it { should have_link('Sign out', href: signout_path) }
it { should_not have_link('Sign in', href: signin_path) } it { should_not have_link('Sign in', href: signin_path) }
Expand All @@ -28,7 +28,7 @@
describe "with invalid information" do describe "with invalid information" do
before { click_button "Sign in" } before { click_button "Sign in" }


it { should have_title('Sign in') } it { should have_selector('title', text: 'Sign in') }
it { should have_error_message('Invalid') } it { should have_error_message('Invalid') }


describe "after visiting another page" do describe "after visiting another page" do
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/static_pages_spec.rb
Expand Up @@ -6,7 +6,7 @@


shared_examples_for "all static pages" do shared_examples_for "all static pages" do
it { should have_selector('h1', text: heading) } it { should have_selector('h1', text: heading) }
it { should have_title(full_title(page_title)) } it { should have_selector('title', text: full_title(page_title)) }
end end


describe "Home page" do describe "Home page" do
Expand Down
11 changes: 5 additions & 6 deletions spec/requests/user_pages_spec.rb
Expand Up @@ -8,7 +8,7 @@
before { visit signup_path } before { visit signup_path }


it { should have_selector('h1', text: 'Sign up') } it { should have_selector('h1', text: 'Sign up') }
it { should have_title('Sign up') } it { should have_selector('title', text: 'Sign up') }


end end


Expand All @@ -20,7 +20,7 @@
it { should have_selector('h1', text: user.name) } it { should have_selector('h1', text: user.name) }
end end
define "username should be in title" do define "username should be in title" do
it { should have_title(user.name) } it { should have_selector('title', text: user.name) }
end end
end end


Expand All @@ -39,7 +39,7 @@
describe "after submission" do describe "after submission" do
before { click_button submit } before { click_button submit }


it { should have_title('Sign up') } it { should have_selector('title', text: 'Sign up') }
it { should have_content('error') } it { should have_content('error') }
end end


Expand All @@ -61,11 +61,10 @@
before { click_button submit } before { click_button submit }
let(:user) { User.find_by_email('user@example.com') } let(:user) { User.find_by_email('user@example.com') }


it { should have_title(user.name) } it { should have_selector('title', text: user.name) }
it { should have_success_message('Welcome') } it { should have_selector('div.alert.alert-success', text: 'Welcome') }
it { should have_link('Sign out') } it { should have_link('Sign out') }



describe "followed by signout" do describe "followed by signout" do
before { click_link "Sign out" } before { click_link "Sign out" }
it { should have_link('Sign in') } it { should have_link('Sign in') }
Expand Down
12 changes: 0 additions & 12 deletions spec/support/utilities.rb
Expand Up @@ -23,15 +23,3 @@ def valid_signin(user)
page.should have_selector('div.alert.alert-error', text: message) page.should have_selector('div.alert.alert-error', text: message)
end end
end end

RSpec::Matchers.define :have_success_message do |message|
match do |page|
page.should have_selector('div.alert.alert-success', text: message)
end
end

RSpec::Matchers.define :have_title do |title|
match do |page|
page.should have_title(title)
end
end

0 comments on commit 4033046

Please sign in to comment.