Skip to content

Commit

Permalink
Verify put action participations controller
Browse files Browse the repository at this point in the history
  • Loading branch information
dovadi committed Jun 16, 2014
1 parent 6099d2e commit c32d3a1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/controllers/participations_controller.rb
Expand Up @@ -16,7 +16,7 @@ def show
# respond_to do |format|
# format.html # show.html.erb
# format.json { render json: @participation }
# end
# end
end

# GET /participations/new
Expand Down Expand Up @@ -76,6 +76,6 @@ def set_participation

# Never trust parameters from the scary internet, only allow the white list through.
def participation_params
params.require(:participation).permit(:firstname, :lastname, :street, :street_number, :zipcode, :city, :email, :phone, :date_of_birth, :gender, :distance, :activity_id)
params.require(:participation).permit(:activity_id, :startnumber)
end
end
24 changes: 21 additions & 3 deletions test/controllers/participations_controller_test.rb
@@ -1,8 +1,26 @@
require 'test_helper'

describe ParticipationsController do

before do
# @participant = participants(:one)
participant_one = participants(:one)
@participation = Participation.create(participant_id: participants(:one).id,
category_id: categories(:two).id,
activity_id: Activity.active.id )

end
end

describe 'Startnumber' do
before do
sign_in_as_user
put :update, id: @participation.id, participation: { startnumber: 12 }
end

it 'should update' do
@participation.reload
@participation.startnumber.must_equal 12
end

end

end

0 comments on commit c32d3a1

Please sign in to comment.