Skip to content

Instantly share code, notes, and snippets.

@adamdilek
Created February 2, 2014 09:16
Show Gist options
  • Save adamdilek/8765144 to your computer and use it in GitHub Desktop.
Save adamdilek/8765144 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe Product do
let(:product) { FactoryGirl.build :product }
describe 'attributes' do
# Validations
it { expect(product).to validate_presence_of :name }
it { expect(product).to validate_presence_of :description }
# Associations
it { expect(product).to have_one(:profile) }
it { expect(product).to have_one(:gateway) }
it { expect(product).to have_many(:photos) }
it { expect(product).to have_many(:transactions) }
it { expect(product).to have_many(:credits) }
it "save attributes" do
product.save!
expect(product).to be_valid
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment