Skip to content

Instantly share code, notes, and snippets.

@joncodo
Created February 14, 2014 18:43
Show Gist options
  • Select an option

  • Save joncodo/9006580 to your computer and use it in GitHub Desktop.

Select an option

Save joncodo/9006580 to your computer and use it in GitHub Desktop.
Test_example.rb
context 'When loading the page for the first time' do
setup do
@account = FactoryGirl.create(:account, id: 1234)
@user = FactoryGirl.create(:confirmed_user, account: @account)
sign_in @user
contact = FactoryGirl.create(:contact, account: @account)
@fortune_company= FactoryGirl.create(:fortune_company, account_name: 'the Company')
FactoryGirl.create(:contact_history, contact: contact, company_name: @fortune_company.account_name)
FactoryGirl.create(:contact_history, contact: contact, company_name: @fortune_company.account_name)
FactoryGirl.create(:contact_history, contact: contact, company_name: @fortune_company.account_name)
FactoryGirl.create(:contact_history, contact: contact, company_name: @fortune_company.account_name)
get(:company_details, { company: 'Salesforce', fortune_company_id: @fortune_company.id })
end
should 'populate the correct instance variables' do
assert_not_nil assigns(:total_pages)
assert_not_nil assigns(:recent_activities)
assert_equal 1, assigns[:total_pages]
assert_equal 4, assigns[:recent_activities].count
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment