fix tests
This commit is contained in:
parent
63044d2499
commit
2414ce8276
@ -28,8 +28,10 @@ class Videolisting < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def fix_videocode
|
||||
self.videocode = "#{self.campaign.listingcode}-#{self.id}"
|
||||
self.save
|
||||
if self.campaign
|
||||
self.videocode = "#{self.campaign.listingcode}-#{self.id}"
|
||||
self.save
|
||||
end
|
||||
end
|
||||
|
||||
def set_defaults
|
||||
|
@ -61,13 +61,16 @@ describe CampaignsController do
|
||||
|
||||
it 'creates a campaign with a nested videolisting' do
|
||||
campaign[:videolistings_attributes] = [videolisting,]
|
||||
post :create, campaign: campaign
|
||||
|
||||
expect do
|
||||
post :create, campaign: campaign
|
||||
end.to change(Campaign, :count).by(1)
|
||||
|
||||
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(Campaign.last.videolistings.last.videocode).to eq videolisting[:videocode]
|
||||
expect(Campaign.last.videolistings.count).to eq 1
|
||||
|
||||
|
||||
end
|
||||
|
||||
it "expects the clientid to be correct" do
|
||||
|
Loading…
Reference in New Issue
Block a user