module Workarea::FeaturedProductsTest
Public Instance Methods
test_adding_a_product()
click to toggle source
# File lib/workarea/core/featured_products_test.rb, line 3 def test_adding_a_product featured_product_model.add_product('foo') assert_includes(featured_product_model.reload.product_ids, 'foo') assert(featured_product_model.featured_product?('foo')) featured_product_model.add_product('bar') assert_equal('bar', featured_product_model.reload.product_ids.first) assert(featured_product_model.featured_product?('bar')) end
test_cleaning_product_ids()
click to toggle source
# File lib/workarea/core/featured_products_test.rb, line 20 def test_cleaning_product_ids ['', nil].each do |blank| featured_product_model.add_product(blank) assert_equal(0, featured_product_model.reload.product_ids.length) end 2.times { featured_product_model.add_product('foo') } assert_equal(['foo'], featured_product_model.reload.product_ids) end
test_removing_a_product()
click to toggle source
# File lib/workarea/core/featured_products_test.rb, line 13 def test_removing_a_product featured_product_model.add_product('foo') featured_product_model.remove_product('foo') assert_empty(featured_product_model.reload.product_ids) refute(featured_product_model.featured_product?('foo')) end