vidpush/spec/controllers/campaigns_controller_spec.rb

20 lines
642 B
Ruby
Raw Normal View History

require 'spec_helper'
describe CampaignsController do
let(:campaign){ attributes_for :campaign }
let(:videolisting){ attributes_for :videolisting }
it 'creates a campaign from json post' do
post :create, campaign: campaign
expect(response.status).to be 302
2014-04-09 18:37:46 +00:00
expect(Campaign.last.clientid).to eq campaign[:clientid]
end
it 'creates a campaign with a nested videolisting' do
campaign[:videolistings_attributes] = [videolisting,]
post :create, campaign: campaign
2014-04-09 18:37:46 +00:00
expect(Campaign.last.videolistings.last.videocode).to eq videolisting[:videocode]
expect(Campaign.last.videolistings.count).to eq 1
end
end