Skip to content

Commit

Permalink
Made the tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
iasoon committed Mar 24, 2015
1 parent 2c91db5 commit 0584031
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/controllers/event_controller_test.rb
Expand Up @@ -61,16 +61,16 @@ def setup
end

test "validate correct barcode" do
post :check_in, id: events(:codenight).id, code: '1234567891231'
post :scan_barcode, id: events(:codenight).id, code: '1234567891231'
assert_response :success
assert(flash[:success].include? "Person has been scanned")
end

test "dont check in twice" do
post :check_in, id: events(:codenight).id, code: '1234567891231'
post :scan_barcode, id: events(:codenight).id, code: '1234567891231'
assert_response :success
assert(flash[:success].include? "Person has been scanned")
post :check_in, id: events(:codenight).id, code: '1234567891231'
post :scan_barcode, id: events(:codenight).id, code: '1234567891231'
assert_response :success
assert(flash[:warning].include? "Person already checked in")
end
Expand All @@ -81,28 +81,28 @@ def setup
reg.price = 10
reg.save

post :check_in, id: events(:codenight).id, code: '1234567891231'
post :scan_barcode, id: events(:codenight).id, code: '1234567891231'
assert_response :success
assert_nil(@registration)
assert(flash[:warning].include? "Person has not paid yet!")
end

test "dont find registrations from other event" do
post :check_in, id: events(:codenight).id, code: '2222222222222'
post :scan_barcode, id: events(:codenight).id, code: '2222222222222'
assert_response :success
assert_nil(@registration)
end

test "dont check in unpaid tickets" do
sign_out users(:tom)
sign_in users(:maarten)
post :check_in, id: events(:galabal).id, code: '2222222222222'
post :scan_barcode, id: events(:galabal).id, code: '2222222222222'
assert_response :success
assert(flash[:warning].include? "Person has not paid yet!")
end

test "scan page should include check digit" do
post :check_in, id: events(:codenight), code: '1234567891231'
post :scan_barcode, id: events(:codenight), code: '1234567891231'
assert_response :success
# expect at least one <th> with value "Barcode:" and the full code with checkdigit
assert_select "tr" do
Expand Down

0 comments on commit 0584031

Please sign in to comment.