Sha256: 5f3cd8012f62617639f7c25ee6eef76178ec8182661f894b1a606efe4107fdce
Contents?: true
Size: 1.39 KB
Versions: 2
Compression:
Stored size: 1.39 KB
Contents
module SimpleCart RSpec.describe CreditCard, type: :model do describe 'class methods' do it { expect(subject.class).to respond_to(:months) } it { expect(subject.class).to respond_to(:years) } end describe 'instance methods' do it { should respond_to(:name) } end subject(:card) { CreditCard.new(:number => '11112222444455556666', :cvv => '123', :expiration_month => '02', :expiration_year => '2015', :firstname => 'Alex', :lastname => 'Smith') } it 'should be a CreditCard class' do expect(CreditCard.is_a?(Class)).to be_truthy expect(CreditCard < ActiveRecord::Base).to be_truthy end it { should have_db_column(:number).of_type(:string) } it { should have_db_column(:cvv).of_type(:string) } it { should have_db_column(:expiration_month).of_type(:string) } it { should have_db_column(:expiration_year).of_type(:string) } it { should have_db_column(:firstname).of_type(:string) } it { should have_db_column(:lastname).of_type(:string) } it { should belong_to(:order) } it { should validate_presence_of(:number) } it { should validate_presence_of(:cvv) } it { should validate_presence_of(:expiration_month) } it { should validate_presence_of(:expiration_year) } it { should validate_presence_of(:firstname) } it { should validate_presence_of(:lastname) } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
simple_cart-0.0.5 | spec/models/simple_cart/credit_card_spec.rb |
simple_cart-0.0.4 | spec/models/simple_cart/credit_card_spec.rb |