Sha256: 8917f5e6913e67279cd02b1dd107c82bd5baf3a332443f3309b09af16c00385b

Contents?: true

Size: 779 Bytes

Versions: 19

Compression:

Stored size: 779 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_validate_presence_of :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_validate_presence_of :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

19 entries across 19 versions & 7 rubygems

Version Path
Flamefork-shoulda-2.10.1 test/unit/product_test.rb
Flamefork-shoulda-2.10.2 test/unit/product_test.rb
francois-shoulda-2.10.1 test/unit/product_test.rb
ratnikov-shoulda-2.9.0.1 test/unit/product_test.rb
ratnikov-shoulda-2.9.0.2 test/unit/product_test.rb
ratnikov-shoulda-2.9.0.3 test/unit/product_test.rb
ratnikov-shoulda-2.9.0 test/unit/product_test.rb
rmm5t-shoulda-2.9.1 test/unit/product_test.rb
technicalpickles-shoulda-2.10.0 test/unit/product_test.rb
thoughtbot-shoulda-2.10.0 test/unit/product_test.rb
thoughtbot-shoulda-2.10.1 test/unit/product_test.rb
thoughtbot-shoulda-2.9.0 test/unit/product_test.rb
thoughtbot-shoulda-2.9.1 test/unit/product_test.rb
thoughtbot-shoulda-2.9.2 test/unit/product_test.rb
shoulda-2.9.0 test/unit/product_test.rb
shoulda-2.9.1 test/unit/product_test.rb
shoulda-2.9.2 test/unit/product_test.rb
shoulda-2.10.0 test/unit/product_test.rb
shoulda-2.10.1 test/unit/product_test.rb