Skip to content

Commit

Permalink
add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
vicentemendozam committed Dec 28, 2017
1 parent 0ba0ff9 commit 2c01393
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def list_admin_events
end

def list_user_events
params[:status] = ["requested", "accepted", "done"] unless params[:status].present?
params[:status] = ["accepted", "done", "canceled"] unless params[:status].present?
@events = Event.managed_by(current_user).searches(search_params(params))
.includes(:position, :attachments, position: [:holder])
@events.order(scheduled: :desc).page(params[:page]).per(50)
Expand Down
13 changes: 13 additions & 0 deletions spec/features/admin/events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@
expect(page).to have_link "An amazing attachment title"
expect(page).to have_link "Other title"
end

scenario 'Should show events with status accepted , canceled or done' do
event = create(:event, title: "Event 1", position: @position)
event.status = 'requested'
event.save
event_two = create(:event, title: "Event 2", position: @position)
event_two.status = 'accepted'
event_two.save
visit admin_path
expect(page).not_to have_content('Event 1')
expect(page).to have_content('Event 2')

end
end

describe "new" do
Expand Down

0 comments on commit 2c01393

Please sign in to comment.