Sha256: 12f1be6067a805780e2f5f0038466c4664a6a0a51b0d63347608a242d451b664

Contents?: true

Size: 1.57 KB

Versions: 7

Compression:

Stored size: 1.57 KB

Contents

require 'test_helper'

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

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

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

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

	  	# testing save_site
	  	epom_response = Epom::Site.get_sites({}, {})
	  	assert_instance_of Array, epom_response
	  	epom_site = epom_response.find{|a| a['id'] == site.send(epom_field('id'))}
	  	assert_equal site.send(epom_field('name')), epom_site['name']

	  	# # testing update_site
	  	assert site.update name: 'otro string'
	  	epom_response = Epom::Site.get_sites({}, {})
	  	assert_instance_of Array, epom_response
	  	epom_site = epom_response.find{|a| a['id'] == site.send(epom_field('id'))}
	  	assert_equal site.send(epom_field('name')), epom_site['name']
	  end
	end

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

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

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

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

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

			response = Publisher.get_sites_zones({:siteId => site.send(epom_field('id'))}, {})
			assert_instance_of Array, response	
		end
	end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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