Created
September 19, 2012 05:20
-
-
Save railscard/3747821 to your computer and use it in GitHub Desktop.
so.rb
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
module UserMacros | |
def make_user_and_login(user = nil) | |
user ||= FactoryGirl.create(:user) | |
visit new_user_session_path | |
page.should have_selector('title', :text => 'Login') | |
fill_in('Email', :with => user.email) | |
fill_in('Password', :with => user.password) | |
click_button('Login') | |
page.should have_selector('title', :text => 'Home') | |
end | |
end | |
# And then | |
describe 'Overview Page' do | |
it 'shows spending' do | |
price = FactoryGirl.create(:price) | |
user = FactoryGirl.create(:user, :price => price) | |
make_user_and_login(user) | |
click_link('Overview') | |
page.should have_selector('title', :text => 'Overview') | |
within('p.today', :text => 'Today') do | |
page.should have_content('$1.01') | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment