Skip to content

Commit

Permalink
Created test for controller in order to have 100% test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian-Sommer authored and Blaidd-Drwg committed Nov 29, 2016
1 parent cc71273 commit 18b4205
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions spec/controllers/events_controller_spec.rb
Expand Up @@ -27,6 +27,7 @@

let(:invalid_attributes) { FactoryGirl.build(:event, max_participants: "twelve").attributes }

let(:valid_attributes_for_having_participants) { FactoryGirl.build(:event_with_accepted_applications).attributes }
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
# EventsController. Be sure to keep this updated too.
Expand Down Expand Up @@ -154,4 +155,17 @@
end
end

describe "GET #participants" do

it "assigns the event as @event" do
event = Event.create! valid_attributes_for_having_participants
get :participants, id: event.to_param, session: valid_session
expect(assigns(:event)).to eq(event)
end
it "assigns all participants as @participants" do
event = Event.create! valid_attributes_for_having_participants
get :participants, id: event.to_param, session: valid_session
expect(assigns(:participants)).to eq(event.participants)
end
end
end

0 comments on commit 18b4205

Please sign in to comment.