Skip to content

Commit

Permalink
remove last_four references in gift_cards specs
Browse files Browse the repository at this point in the history
  • Loading branch information
shua123 committed Aug 28, 2016
1 parent 22400a9 commit 511c517
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion spec/controllers/gift_cards_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
expiration_date: "05/20",
proxy_id:'4321',
batch_id: '4321',
gift_card_number: '12345'
gift_card_number: '99998'
}
}

Expand Down
4 changes: 2 additions & 2 deletions spec/factories/gift_cards.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

FactoryGirl.define do
factory :gift_card do
last_four 1
expiration_date '2016-06-03'
gift_card_number 99999
expiration_date '05/20'
person_id 1
notes 'MyString'
created_by 1
Expand Down
9 changes: 6 additions & 3 deletions spec/views/gift_cards/edit.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
RSpec.describe 'gift_cards/edit', type: :view do
before(:each) do
@gift_card = assign(:gift_card, GiftCard.create!(
gift_card_number: 12345,
gift_card_number: 99996,
person_id: 1,
batch_id: 1,
notes: 'MyString',
created_by: 1,
reason: 'signup',
reason: 1,
expiration_date: "11/22"
))
end
Expand All @@ -16,7 +17,9 @@
render

assert_select 'form[action=?][method=?]', gift_card_path(@gift_card), 'post' do
assert_select 'input#gift_card_last_four[name=?]', 'gift_card[last_four]'
assert_select 'input#gift_card_gift_card_number[name=?]', 'gift_card[gift_card_number]'

assert_select 'input#gift_card_batch_id[name=?]', 'gift_card[batch_id]'

assert_select 'input#gift_card_person_id[name=?]', 'gift_card[person_id]'

Expand Down
12 changes: 8 additions & 4 deletions spec/views/gift_cards/index.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,33 @@
assign(:gift_cards, [
GiftCard.create!(
gift_card_number: 12345,
batch_id: 1,
person_id: 2,
notes: 'Notes',
created_by: 3,
reason: 'signup',
expiration_date: "11/22"
),
GiftCard.create!(
gift_card_number: 12345,
gift_card_number: 12346,
batch_id: 1,
person_id: 2,
notes: 'Notes',
created_by: 3,
reason: 'signup',
reason: 'interview',
expiration_date: "11/22"
)
])
end

it 'renders a list of gift_cards' do
render
assert_select 'tr>td', text: 12345.to_s, count: 2
assert_select 'tr>td', text: 12345.to_s, count: 1
assert_select 'tr>td', text: 12346.to_s, count: 1
assert_select 'tr>td', text: 2.to_s, count: 2
assert_select 'tr>td', text: 'Notes'.to_s, count: 2
assert_select 'tr>td', text: 3.to_s, count: 2
assert_select 'tr>td', text: 'signup', count: 2
assert_select 'tr>td', text: 'signup', count: 1
assert_select 'tr>td', text: 'interview', count: 1
end
end
5 changes: 4 additions & 1 deletion spec/views/gift_cards/new.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
before(:each) do
assign(:gift_card, GiftCard.new(
gift_card_number: 12345,
batch_id: 1,
person_id: 1,
notes: 'MyString',
created_by: 1,
Expand All @@ -15,7 +16,9 @@
render

assert_select 'form[action=?][method=?]', gift_cards_path, 'post' do
assert_select 'input#gift_card_last_four[name=?]', 'gift_card[last_four]'
assert_select 'input#gift_card_gift_card_number[name=?]', 'gift_card[gift_card_number]'

assert_select 'input#gift_card_batch_id[name=?]', 'gift_card[batch_id]'

assert_select 'input#gift_card_person_id[name=?]', 'gift_card[person_id]'

Expand Down

0 comments on commit 511c517

Please sign in to comment.