Sha256: a27dfdcceb4c88bdbf41b26504302c871488d7628ddc722c7c4db56f04ee2cd3

Contents?: true

Size: 895 Bytes

Versions: 3

Compression:

Stored size: 895 Bytes

Contents

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

module ProductPropertySpecHelper
  def valid_product_property_attributes
    {
      :value => "x"
    }
  end
end


describe ProductProperty do
  include ProductPropertySpecHelper

  before(:each) do
    @product_property = ProductProperty.new
  end

  it "should not be valid when empty" do
    @product_property.should_not be_valid
  end

  ['value'].each do |field|
    it "should require #{field}" do
      @product_property.should_not be_valid
      @product_property.errors.full_messages.should include("#{field.humanize} #{I18n.translate("activerecord.errors.messages.blank")}")
    end
  end

  it "should be valid when having correct information" do
    pending "Shouldn't it require a product and a property too?"
    @product_property.attributes = valid_product_property_attributes
    @product_property.should be_valid
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree-0.6.0 spec/models/product_property_spec.rb
spree-0.7.1 spec/models/product_property_spec.rb
spree-0.7.0 spec/models/product_property_spec.rb