Commit be2f423b9139441154f1e285fce1bb28ba93731f
1 parent
4f2de802
Exists in
colab
and in
4 other branches
Fixed ReadingsController before_filter order
Showing
2 changed files
with
1 additions
and
7 deletions
Show diff stats
app/controllers/readings_controller.rb
| ... | ... | @@ -2,9 +2,9 @@ include OwnershipAuthentication |
| 2 | 2 | |
| 3 | 3 | class ReadingsController < ApplicationController |
| 4 | 4 | before_action :authenticate_user!, except: [:index] |
| 5 | - before_action :set_reading, only: [:edit, :update, :destroy] | |
| 6 | 5 | before_action :reading_owner?, except: [:new, :create] |
| 7 | 6 | before_action :reading_group_owner?, only: [:new, :create] |
| 7 | + before_action :set_reading, only: [:edit, :update, :destroy] | |
| 8 | 8 | |
| 9 | 9 | def new |
| 10 | 10 | @reading_group_id = params[:reading_group_id] | ... | ... |
spec/controllers/readings_controller_spec.rb
| ... | ... | @@ -83,8 +83,6 @@ describe ReadingsController do |
| 83 | 83 | |
| 84 | 84 | context 'when the user does not own the reading' do |
| 85 | 85 | before do |
| 86 | - Reading.expects(:find).at_least_once.with(reading.id).returns(reading) | |
| 87 | - | |
| 88 | 86 | get :edit, id: reading.id, reading_group_id: reading_group.id.to_s |
| 89 | 87 | end |
| 90 | 88 | |
| ... | ... | @@ -143,8 +141,6 @@ describe ReadingsController do |
| 143 | 141 | |
| 144 | 142 | context 'when the user does not own the reading' do |
| 145 | 143 | before :each do |
| 146 | - Reading.expects(:find).at_least_once.with(reading.id).returns(reading) | |
| 147 | - | |
| 148 | 144 | post :update, reading_group_id: reading_group.id, id: reading.id, reading: reading_params |
| 149 | 145 | end |
| 150 | 146 | |
| ... | ... | @@ -184,8 +180,6 @@ describe ReadingsController do |
| 184 | 180 | |
| 185 | 181 | context "when the user doesn't own the reading group" do |
| 186 | 182 | before :each do |
| 187 | - Reading.expects(:find).at_least_once.with(reading.id).returns(reading) | |
| 188 | - | |
| 189 | 183 | delete :destroy, id: reading.id, reading_group_id: reading.group_id.to_s |
| 190 | 184 | end |
| 191 | 185 | ... | ... |