Skip to content

Instantly share code, notes, and snippets.

@tonatiuh
Created September 14, 2012 23:37
Show Gist options
  • Save tonatiuh/3725616 to your computer and use it in GitHub Desktop.
Save tonatiuh/3725616 to your computer and use it in GitHub Desktop.
Failing test
def new_contact_obligations
# self.vertical = conversions.first.placement.vertical
self.attributes = load_loc_attrs
self.save!
notify_observers(:find_campaigns)
end
before :each do
@vertical = FactoryGirl.create(:vertical)
@geo = FactoryGirl.create(:geo)
end
context "when find_campaigns callback is called" do
it 'should automatically purchase a contact when a matching campaign', run: true do
campaign = FactoryGirl.create(:campaign, :geos => [@geo], :vertical => @vertical)
contact = FactoryGirl.create(:contact , :geo => @geo, :vertical => @vertical)
contact.new_contact_obligations
contact.campaigns.first.should eql campaign
campaign.purchases.first.contact.should eql contact
end
end
@madhermit
Copy link

@tonatiuh, you need to merge/rebase my changes from staging, its also got some good new tests there relevant to what you're working on i think. Here is the version i'm referring to:
https://github.com/stonegiantlabs/ContactLogic/blob/staging/spec/models/contact_observer_spec.rb

@tonatiuh
Copy link
Author

Ok man, I'll check that then because looks like that line is the only issue that i have to finish this feature, thanks ( :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment