vidpush/spec/controllers/campaigns_controller_spec.rb
Tyrel Souza 7833c04d3d add tests
make tests work
make posts from python work
2014-04-09 14:12:14 -04:00

20 lines
618 B
Ruby

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
expect(Campaign.last.clientid).to eq "clientid1"
end
it 'creates a campaign with a nested videolisting' do
campaign[:videolistings_attributes] = [videolisting,]
post :create, campaign: campaign
expect(Campaign.last.videolistings.last.videocode).to eq "video1"
expect(Campaign.last.videolistings.count).to eq 1
end
end