Sha256: 98f558299441d2262c816a46ce0c088fe1cd144f46609093288716f340c5857d

Contents?: true

Size: 1.22 KB

Versions: 6

Compression:

Stored size: 1.22 KB

Contents

require 'test_helper'

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

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

	test 'save an banner' do
		unless EpomRails.config.offline
			banner = banners(:two)	 
			banner.epom_id = nil
			
	  	assert	banner.save
	  	assert_instance_of Fixnum, banner.send(epom_field('id'))
	  end
	end

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

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

	  	assert banner.destroy
	  end
	end

	test 'epom methods' do
		unless EpomRails.config.offline
			banner = banners(:two)	 
			banner.epom_id = nil
	  	assert	banner.save
	  	assert_instance_of Fixnum, banner.send(epom_field('id'))

			response = Banner.get_banner({:bannerId => banner.send(epom_field('id'))}, {})
			assert_equal banner.campaign.epom_id, response['campaignId']
			assert_equal banner.weight, response['weight']
			assert_equal banner.url, response['url']
			assert_equal banner.name, response['name']
			assert_equal banner.image_banner_link, response['imageBannerLink']		
		end
	end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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