fix tests
This commit is contained in:
parent
63044d2499
commit
2414ce8276
@ -28,8 +28,10 @@ class Videolisting < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def fix_videocode
|
def fix_videocode
|
||||||
self.videocode = "#{self.campaign.listingcode}-#{self.id}"
|
if self.campaign
|
||||||
self.save
|
self.videocode = "#{self.campaign.listingcode}-#{self.id}"
|
||||||
|
self.save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_defaults
|
def set_defaults
|
||||||
|
@ -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,]
|
||||||
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]
|
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