fix tests
This commit is contained in:
parent
63044d2499
commit
2414ce8276
@ -28,9 +28,11 @@ class Videolisting < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def fix_videocode
|
def fix_videocode
|
||||||
|
if self.campaign
|
||||||
self.videocode = "#{self.campaign.listingcode}-#{self.id}"
|
self.videocode = "#{self.campaign.listingcode}-#{self.id}"
|
||||||
self.save
|
self.save
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def set_defaults
|
def set_defaults
|
||||||
self.producttypeid = 721
|
self.producttypeid = 721
|
||||||
|
@ -61,13 +61,16 @@ describe CampaignsController do
|
|||||||
|
|
||||||
it 'creates a campaign with a nested videolisting' do
|
it 'creates a campaign with a nested videolisting' do
|
||||||
campaign[:videolistings_attributes] = [videolisting,]
|
campaign[:videolistings_attributes] = [videolisting,]
|
||||||
|
|
||||||
|
expect do
|
||||||
post :create, campaign: campaign
|
post :create, campaign: campaign
|
||||||
|
end.to change(Campaign, :count).by(1)
|
||||||
|
|
||||||
flash = response.request.env["action_dispatch.request.flash_hash"][:alert]
|
flash = response.request.env["action_dispatch.request.flash_hash"][:alert]
|
||||||
expect(flash).not_to eq("You need to sign in or sign up before continuing.")
|
expect(flash).not_to eq("You need to sign in or sign up before continuing.")
|
||||||
|
|
||||||
expect(Campaign.last.videolistings.last.videocode).to eq videolisting[:videocode]
|
|
||||||
expect(Campaign.last.videolistings.count).to eq 1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "expects the clientid to be correct" do
|
it "expects the clientid to be correct" do
|
||||||
|
Loading…
Reference in New Issue
Block a user