Commit 4f2de80281719ca5aa48adb2e711a79d40c9ebdb
1 parent
aedbc3e9
Exists in
colab
and in
4 other branches
Fixed MetricConfigurationsController before_filter order
Showing
2 changed files
with
1 additions
and
6 deletions
Show diff stats
app/controllers/metric_configurations_controller.rb
| ... | ... | @@ -3,9 +3,9 @@ include MetricConfigurationsConcern |
| 3 | 3 | |
| 4 | 4 | class MetricConfigurationsController < ApplicationController |
| 5 | 5 | before_action :authenticate_user!, except: [:show, :index] |
| 6 | - before_action :set_metric_configuration, only: [:show, :edit, :update, :destroy] | |
| 7 | 6 | before_action :metric_configuration_owner?, only: [:edit, :update, :destroy] |
| 8 | 7 | before_action :mezuro_configuration_owner?, only: [:new, :create, :choose_metric] |
| 8 | + before_action :set_metric_configuration, only: [:show, :edit, :update, :destroy] | |
| 9 | 9 | |
| 10 | 10 | def choose_metric |
| 11 | 11 | @mezuro_configuration_id = params[:mezuro_configuration_id].to_i | ... | ... |
spec/controllers/metric_configurations_controller_spec.rb
| ... | ... | @@ -121,7 +121,6 @@ describe MetricConfigurationsController do |
| 121 | 121 | |
| 122 | 122 | context 'when the user does not own the metric configuration' do |
| 123 | 123 | before do |
| 124 | - MetricConfiguration.expects(:find).at_least_once.with(metric_configuration.id).returns(metric_configuration) | |
| 125 | 124 | get :edit, id: metric_configuration.id, mezuro_configuration_id: metric_configuration.configuration_id.to_s |
| 126 | 125 | end |
| 127 | 126 | |
| ... | ... | @@ -180,8 +179,6 @@ describe MetricConfigurationsController do |
| 180 | 179 | |
| 181 | 180 | context 'when the user does not own the reading' do |
| 182 | 181 | before :each do |
| 183 | - MetricConfiguration.expects(:find).at_least_once.with(metric_configuration.id).returns(metric_configuration) | |
| 184 | - | |
| 185 | 182 | post :update, mezuro_configuration_id: metric_configuration.configuration_id, id: metric_configuration.id, metric_configuration: metric_configuration_params |
| 186 | 183 | end |
| 187 | 184 | |
| ... | ... | @@ -214,8 +211,6 @@ describe MetricConfigurationsController do |
| 214 | 211 | |
| 215 | 212 | context "when the user doesn't own the configuration" do |
| 216 | 213 | before :each do |
| 217 | - MetricConfiguration.expects(:find).at_least_once.with(metric_configuration.id).returns(metric_configuration) | |
| 218 | - | |
| 219 | 214 | delete :destroy, id: metric_configuration.id, mezuro_configuration_id: metric_configuration.configuration_id.to_s |
| 220 | 215 | end |
| 221 | 216 | ... | ... |