Created
September 14, 2012 23:37
-
-
Save tonatiuh/3725616 to your computer and use it in GitHub Desktop.
Failing test
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
def new_contact_obligations | |
# self.vertical = conversions.first.placement.vertical | |
self.attributes = load_loc_attrs | |
self.save! | |
notify_observers(:find_campaigns) | |
end |
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
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 |
Do you mind on this test?
it "should find an associated campaign" do
campaign = FactoryGirl.create(:campaign)
contact = FactoryGirl.create(:contact)
contact.new_contact_obligations #until after_commit bug gets fixed
contact.campaigns.first.should eql campaign
campaign.purchases.first.contact.should eql contact
end
I don't figure to which line are you referring.
@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
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
yeah i ran into that too. See line 9 of the spec/models/contact_observer_spec.rb file to see how i removed the campaign created by FactoryGirl.create(:contact) from test consideration. Kinda sloppy though. like i said we really should have a factory that creates a contact without the conversion