Sha256: 84e605bd2b6959e164ee90b2e5cae3e7fd74efd29d71d8a3f681eeae7cba049b

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe Adminpanel::Product do
	before do
		@category = Adminpanel::Category.new(
			:name => "test category",
			:id => 1
		)
		@product = Adminpanel::Product.new(
			:description => "Test description for product",
			:name => "product name",
			:category_id => "1",
			:brief => "short description"
		)
	end

	subject { @product }

	it { should respond_to(:name) }
	it { should respond_to(:description) }
	it { should respond_to(:category_id) }
	it { should respond_to(:brief) }	

	describe "when product belongs to a category" do
		before {@category.save}
		after {@category.delete}
		it {@product.category.should eql(@category)}
	end	

	describe "when no name present" do
		before {@product.name = " "}
		it {should_not be_valid}
	end

	describe "when no description present" do
		before {@product.description = " "}
		it {should_not be_valid}
	end

	describe "when no category is present" do
		before {@product.category_id = " "}
		it {should_not be_valid}
	end

	describe "when no brief is present" do
		before {@product.brief = " "}
		it {should_not be_valid}
	end


end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
adminpanel-0.1.1 spec/models/product_spec.rb
adminpanel-0.1.0cl.2 spec/models/product_spec.rb
adminpanel-0.1.0cl spec/models/product_spec.rb
adminpanel-0.1.0 spec/models/product_spec.rb
adminpanel-0.0.7 spec/models/product_spec.rb
adminpanel-0.0.6.1 spec/models/product_spec.rb
adminpanel-0.0.6 spec/models/product_spec.rb