use full_name instead of first and last name, test changes, schema improvements

This commit is contained in:
Rishabh Saxena 2016-07-21 22:43:43 +05:30
parent f00e051eff
commit 6d8605073f
10 changed files with 25 additions and 81 deletions

View file

@ -2,8 +2,7 @@ FactoryGirl.define do
factory :payment do
user
conference
first_name { "#{Faker::Hipster.word} abc" }
last_name { "#{Faker::Hipster.word} xyz" }
full_name { Faker::Hipster.word.to_s }
credit_card_number '4242424242424111'
card_verification_value '123'
expiration_month 6

View file

@ -33,8 +33,7 @@ feature Registration do
purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first
expect(purchase.quantity).to eq(2)
fill_in 'first_name', with: 'foo'
fill_in 'last_name', with: 'bar'
fill_in 'full_name', with: 'foo'
select Date.current.year + 2, from: 'expiration_year'
fill_in 'card_verification_value', with: '123'
fill_in 'credit_card_number', with: '4242424242423333'
@ -61,8 +60,7 @@ feature Registration do
purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first
expect(purchase.quantity).to eq(2)
fill_in 'first_name', with: 'foo'
fill_in 'last_name', with: 'bar'
fill_in 'full_name', with: 'foo'
select Date.current.year + 2, from: 'expiration_year'
fill_in 'card_verification_value', with: '123'
fill_in 'credit_card_number', with: '4242424242422222'
@ -89,8 +87,7 @@ feature Registration do
purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first
expect(purchase.quantity).to eq(2)
fill_in 'first_name', with: 'foo'
fill_in 'last_name', with: 'bar'
fill_in 'full_name', with: 'foo'
select Date.current.year + 2, from: 'expiration_year'
fill_in 'card_verification_value', with: '123'
fill_in 'credit_card_number', with: '4242424242421111'

View file

@ -14,9 +14,7 @@ describe Payment do
expect(build(:payment)).to be_valid
end
it { is_expected.to validate_presence_of(:first_name) }
it { is_expected.to validate_presence_of(:last_name) }
it { is_expected.to validate_presence_of(:full_name) }
it { is_expected.to validate_presence_of(:credit_card_number) }