Sha256: 0d1fda32ca22422797007e9030bf12d2790cd31385946f17eb915c519ff8395c

Contents?: true

Size: 1.67 KB

Versions: 3

Compression:

Stored size: 1.67 KB

Contents

require 'test_helper'

class ActsAsPlacementTest < ActiveSupport::TestCase
	def epom_field(field)
		Placement.epom_fields.key(field)
	end

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

	test 'save an placement' do
		placement = placements(:one)	  	

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

	  	# testing save_placement
	  	epom_response = Epom::Placement.get_placement_summary({}, {:placementIds => placement.send(epom_field('id'))})
	  	assert_instance_of Array, epom_response
	  	epom_placement = epom_response.find{|a| a['id'] == placement.send(epom_field('id'))}
	  	assert_equal placement.send(epom_field('name')), epom_placement['name']

	  	# # testing update_placement
	  	assert placement.update name: 'otro string'
	  	epom_response = Epom::Placement.get_placement_summary({}, {:placementIds => placement.send(epom_field('id'))})
	  	assert_instance_of Array, epom_response
	  	epom_placement = epom_response.find{|a| a['id'] == placement.send(epom_field('id'))}
	  	assert_equal placement.send(epom_field('name')), epom_placement['name']
	end

	test 'delete an placement' do
		placement = placements(:one)	  	

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

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

	test 'epom methods' do
		placement = placements(:one)	  	

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

		epom_response = Epom::Placement.get_placement_summary({}, {:placementIds => placement.send(epom_field('id'))})
	  	assert_instance_of Array, epom_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_placement_test.rb
epom_rails-0.4.2 test/epom_rails/acts_as_placement_test.rb
epom_rails-0.4.1 test/epom_rails/acts_as_placement_test.rb