Sha256: b93b2a30251cc939629c27166c03e5940d8567ecd060a8710d16ceb5d14ae16f

Contents?: true

Size: 1.35 KB

Versions: 3

Compression:

Stored size: 1.35 KB

Contents

require 'test_helper'

class ActsAsSiteTest < ActiveSupport::TestCase
	def epom_field(field)
		Site.epom_fields.key(field)
	end

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

	test 'save an site' do
		site = sites(:one)	  	

	  	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

	test 'delete an site' do
		site = sites(:one)	  	

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

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

	test 'epom methods' do
		site = sites(:one)	  	

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
epom_rails-0.4.5 test/epom_rails/acts_as_site_test.rb
epom_rails-0.4.2 test/epom_rails/acts_as_site_test.rb
epom_rails-0.4.1 test/epom_rails/acts_as_site_test.rb