Sha256: e0899b77ba1d8bf17ad6b0a2c164ebb5d1d1b14da96cf0c20821f53930c6f57f

Contents?: true

Size: 1.3 KB

Versions: 6

Compression:

Stored size: 1.3 KB

Contents

require 'test_helper'

class ActsAsCampaignTest < ActiveSupport::TestCase
	def epom_field(field)
		EpomRails.config.campaign[:fields].key(field)
	end

	test 'fancy_method' do
	  	assert_raises NoMethodError do Campaign.fancy_method end
	end

	test 'save an campaign' do
		unless EpomRails.config.offline
			campaign = campaigns(:two)
			campaign.epom_id = nil	  	

	  	assert	campaign.save
	  	assert_instance_of Fixnum, campaign.send(epom_field('id'))
	  end
	end

	test 'delete an campaign' do
		unless EpomRails.config.offline
			campaign = campaigns(:two)	 
			campaign.epom_id = nil 	

	  	assert	campaign.save
	  	assert_instance_of Fixnum, campaign.send(epom_field('id'))

	  	epom_id = campaign.send(epom_field('id'))
	  	assert campaign.destroy
	  end
	end

	test 'epom methods' do
		unless EpomRails.config.offline
			campaign = campaigns(:two)
			campaign.epom_id = nil	  	

	  	assert	campaign.save
	  	assert_instance_of Fixnum, campaign.send(epom_field('id'))

			response = Campaign.get_campaign({:campaignId => campaign.send(epom_field('id'))}, {})
			assert_equal campaign.send(epom_field('id')), response['id']
			assert_equal campaign.send(epom_field('name')), response['name']
		end		
	end

	test 'method_missing' do
		campaign = campaigns(:one)
		assert campaign.advertiser_id, campaign.advertiserId
	end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
epom_rails-1.4.4 test/epom_rails/acts_as_campaign_test.rb
epom_rails-1.4.2 test/epom_rails/acts_as_campaign_test.rb
epom_rails-1.4.1 test/epom_rails/acts_as_campaign_test.rb
epom_rails-1.4.0 test/epom_rails/acts_as_campaign_test.rb
epom_rails-1.3.6 test/epom_rails/acts_as_campaign_test.rb
epom_rails-1.3.5 test/epom_rails/acts_as_campaign_test.rb