Sha256: 898f6597fd814672664a9c84cf590b34dd35b50c0d67f040b7c8be4d2e45c733

Contents?: true

Size: 775 Bytes

Versions: 51

Compression:

Stored size: 775 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'

class ProductTest < ActiveSupport::TestCase
  context "An intangible product" do
    setup do
      @product = Product.new(:tangible => false)
    end

    should_require_attributes :title
    should_not_allow_values_for :size, "22"
    should_allow_values_for :size, "22kb"
    should_ensure_value_in_range :price, 0..99
  end

  context "A tangible product" do
    setup do
      @product = Product.new(:tangible => true)
    end

    should_require_attributes :price
    should_ensure_value_in_range :price, 1..9999
    should_ensure_value_in_range :weight, 1..100
    should_not_allow_values_for :size, "22", "10x15"
    should_allow_values_for :size, "12x12x1"
    should_ensure_length_in_range :size, 5..20
  end
end

Version data entries

51 entries across 51 versions & 12 rubygems

Version Path
thoughtbot-shoulda-2.0.3 test/unit/product_test.rb
thoughtbot-shoulda-2.0.4 test/unit/product_test.rb
thoughtbot-shoulda-2.0.5 test/unit/product_test.rb
thoughtbot-shoulda-2.0.6 test/unit/product_test.rb
shoulda-2.0.0 test/unit/product_test.rb
shoulda-2.0.1 test/unit/product_test.rb
shoulda-2.0.2 test/unit/product_test.rb
shoulda-2.0.3 test/unit/product_test.rb
shoulda-2.0.4 test/unit/product_test.rb
shoulda-2.0.5 test/unit/product_test.rb
shoulda-2.0.6 test/unit/product_test.rb