Sha256: a8934827b5f2a1c4ba56a6065e895c01bd2ee1e8100ecf99f942922595256aae

Contents?: true

Size: 963 Bytes

Versions: 1

Compression:

Stored size: 963 Bytes

Contents

require 'test_helper'

class Ccls::GiftCardTest < ActiveSupport::TestCase

	assert_should_create_default_object
	assert_should_belong_to(:study_subject, :project)
	assert_should_protect( :study_subject_id, :study_subject )
	assert_should_require_attributes(:number)
	assert_should_require_unique_attributes(:number)
	assert_should_not_require_attributes( :study_subject_id,
		:project_id,
		:issued_on,
		:expiration,
		:vendor )
	assert_should_require_attribute_length( :expiration,
		:vendor,
		:number, 
			:maximum => 250 )

	test "explicit Factory gift_card test" do
		assert_difference('GiftCard.count',1) {
			gift_card = Factory(:gift_card)
			assert_match /\d*/, gift_card.number
		}
	end

	test "should return number as to_s" do
		gift_card = create_gift_card
		assert_equal gift_card.number, "#{gift_card}"
	end

#protected
#
#	def create_gift_card(options={})
#		gift_card = Factory.build(:gift_card,options)
#		gift_card.save
#		gift_card
#	end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ccls-ccls_engine-3.11.0 test/unit/ccls/gift_card_test.rb