testing publishing in controller

This commit is contained in:
Tyrel Souza 2014-05-06 12:36:00 -04:00
parent 90e7238554
commit 130558e2be

View File

@ -113,5 +113,23 @@ describe CampaignsController do
end end
it "allows sending to better video successfully" do
camp = FactoryGirl.create(:campaign)
c = Campaign.find(camp.id)
patch :update, listingcode: c.listingcode, campaign: c.attributes, send: true
c_published = Campaign.find(camp.id)
expect(response.status).to eq 302
expect(c_published.sent).to eq(true)
end
it "allows sending to better video and shows errors" do
camp = FactoryGirl.create(:campaign)
camp.listingcode = "videolistingmissing"
camp.save
c = Campaign.find(camp.id)
patch :update, listingcode: c.listingcode, campaign: c.attributes, send: true
expect(response.status).to eq 200 # no redirect, show error on page.
end
end end