Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save joncodo/9005830 to your computer and use it in GitHub Desktop.
file.rb
context 'When loading the page for the first time' do
setup do
contact = FactoryGirl.create(:contact)
@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)
@account2 = FactoryGirl.create(:account, id: 1234)
@user2 = FactoryGirl.create(:confirmed_user, account: @account2)
sign_in @user2
url = get(:company_details, { company: 'Salesforce'}, {fortune_company_id: @fortune_company.id })
puts url
end
should assign_to(:total_pages).with(222)
should 'populate the correct instance variables' do
#puts @foo
puts assigns[:total_pages]
puts assigns(@total_pages)
puts assigns(:total_pages)
assigns[:total_pages].should == 1
#assert_not_nil assigns(@total_pages)
#assert_not_nil assigns(@recent_activities)
#
#total_pages = @controller.instance_variable_get("@total_pages")
#assert_equal 12, total_pages
#assert_equal 4, assigns(@recent_activities).count
end
end
#in the controller...
skip_before_filter :authenticate_user!, :only => [:sync, :search, :fullcontact_callback, :organize, :invite, :edit, :update, :destroy, :calendar_sync, :salesforce_trigger, :search_with_contact_id]
skip_before_filter :check_account_exists, :only => [:sync, :calendar_sync, :export]
before_filter :basic_authentication, :only => [:sync, :calendar_sync, :export, :search, :organize, :invite, :search_with_contact_id]
prepend_before_filter :disable_warden_for_request, :only => [:sync, :calendar_sync, :export, :search, :organize, :invite, :search_with_contact_id]
def company_details
@total_pages = 6
render nothing: true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment