public
Created

so.rb

  • Download Gist
so.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
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
 
 

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.