Commit 39c96ce1c81bdb98b32b7e01a93fc5424ab1fd8f
Committed by
Heitor
1 parent
c1f1a609
Exists in
colab
and in
4 other branches
Fix CompoundMetricController cache expiration
The search and replace missed this. Now when a new CompoundMetriConfiguration gets created or updated the KalibroConfiguration show page gets a clear cache. Signed off by: Heitor Reis <marcheing@gmail.com>
Showing
3 changed files
with
5 additions
and
4 deletions
Show diff stats
app/controllers/compound_metric_configurations_controller.rb
| @@ -7,7 +7,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle | @@ -7,7 +7,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle | ||
| 7 | respond_to do |format| | 7 | respond_to do |format| |
| 8 | create_and_redir(format) | 8 | create_and_redir(format) |
| 9 | end | 9 | end |
| 10 | - Rails.cache.delete("#{params[:kalibro_configuration_id].to_i}_metric_configurations") | 10 | + Rails.cache.delete("#{params[:kalibro_configuration_id].to_i}_tree_metric_configurations") |
| 11 | end | 11 | end |
| 12 | 12 | ||
| 13 | def show | 13 | def show |
| @@ -30,7 +30,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle | @@ -30,7 +30,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle | ||
| 30 | else | 30 | else |
| 31 | failed_action(format, 'edit') | 31 | failed_action(format, 'edit') |
| 32 | end | 32 | end |
| 33 | - Rails.cache.delete("#{@compound_metric_configuration.kalibro_configuration_id}_metric_configurations") | 33 | + Rails.cache.delete("#{@compound_metric_configuration.kalibro_configuration_id}_tree_metric_configurations") |
| 34 | end | 34 | end |
| 35 | end | 35 | end |
| 36 | 36 |
features/compound_metric_configuration/create.feature
| @@ -3,7 +3,7 @@ Feature: Compound Metric Configuration Creation | @@ -3,7 +3,7 @@ Feature: Compound Metric Configuration Creation | ||
| 3 | As a regular user | 3 | As a regular user |
| 4 | I should be able to create compound metric configurations | 4 | I should be able to create compound metric configurations |
| 5 | 5 | ||
| 6 | - @kalibro_configuration_restart @javascript @wip | 6 | + @kalibro_configuration_restart @javascript |
| 7 | Scenario: compound metric configuration creation | 7 | Scenario: compound metric configuration creation |
| 8 | Given I am a regular user | 8 | Given I am a regular user |
| 9 | And I am signed in | 9 | And I am signed in |
spec/controllers/compound_metric_configurations_controller_spec.rb
| @@ -43,6 +43,7 @@ describe CompoundMetricConfigurationsController, :type => :controller do | @@ -43,6 +43,7 @@ describe CompoundMetricConfigurationsController, :type => :controller do | ||
| 43 | context 'when the current user owns the reading group' do | 43 | context 'when the current user owns the reading group' do |
| 44 | before :each do | 44 | before :each do |
| 45 | subject.expects(:kalibro_configuration_owner?).returns true | 45 | subject.expects(:kalibro_configuration_owner?).returns true |
| 46 | + Rails.cache.expects(:delete).with("#{kalibro_configuration.id}_tree_metric_configurations") | ||
| 46 | end | 47 | end |
| 47 | 48 | ||
| 48 | context 'with valid fields' do | 49 | context 'with valid fields' do |
| @@ -134,6 +135,7 @@ describe CompoundMetricConfigurationsController, :type => :controller do | @@ -134,6 +135,7 @@ describe CompoundMetricConfigurationsController, :type => :controller do | ||
| 134 | context 'when user owns the metric configuration' do | 135 | context 'when user owns the metric configuration' do |
| 135 | before :each do | 136 | before :each do |
| 136 | subject.expects(:metric_configuration_owner?).returns true | 137 | subject.expects(:metric_configuration_owner?).returns true |
| 138 | + Rails.cache.expects(:delete).with("#{kalibro_configuration.id}_tree_metric_configurations") | ||
| 137 | end | 139 | end |
| 138 | 140 | ||
| 139 | context 'with valid fields' do | 141 | context 'with valid fields' do |
| @@ -170,5 +172,4 @@ describe CompoundMetricConfigurationsController, :type => :controller do | @@ -170,5 +172,4 @@ describe CompoundMetricConfigurationsController, :type => :controller do | ||
| 170 | end | 172 | end |
| 171 | end | 173 | end |
| 172 | end | 174 | end |
| 173 | - | ||
| 174 | end | 175 | end |