Commit 1f34a5b4d191adf5087d962e160c5126f7bcd583
1 parent
3517cb28
Exists in
master
and in
29 other branches
[Mezuro] Refactoring configuration content and show
Showing
3 changed files
with
13 additions
and
5 deletions
Show diff stats
plugins/mezuro/test/unit/mezuro_plugin/configuration_content_test.rb
... | ... | @@ -27,6 +27,14 @@ class ConfigurationContentTest < ActiveSupport::TestCase |
27 | 27 | assert_not_nil @content.to_html |
28 | 28 | end |
29 | 29 | |
30 | + should 'not save a configuration with an existing cofiguration name in kalibro' do | |
31 | + client = mock | |
32 | + Kalibro::Client::ConfigurationClient.expects(:new).returns(client) | |
33 | + client.expects(:configuration_names).returns([@content.name.upcase]) | |
34 | + @content.send :validate_kalibro_configuration_name | |
35 | + assert_equal "Configuration name already exists in Kalibro", @content.errors.on_base | |
36 | + end | |
37 | + | |
30 | 38 | should 'get configuration from service' do |
31 | 39 | Kalibro::Client::ConfigurationClient.expects(:configuration).with(@content.name).returns(@configuration) |
32 | 40 | assert_equal @configuration, @content.configuration | ... | ... |
plugins/mezuro/views/cms/mezuro_plugin/_configuration_content.html.erb
plugins/mezuro/views/content_viewer/show_configuration.rhtml
... | ... | @@ -15,7 +15,7 @@ |
15 | 15 | <br/> |
16 | 16 | |
17 | 17 | <%= link_to "#{image_tag ('/plugins/mezuro/images/plus.png')}Add Metric", :controller => "mezuro_plugin_myprofile", |
18 | -:action => "choose_base_tool", :params => {:configuration_name => @configuration.name} %><br/> | |
18 | +:action => "choose_base_tool", :params => { :id => @configuration_content.id } %><br/> | |
19 | 19 | |
20 | 20 | <table> |
21 | 21 | <tr class="titles"> |
... | ... | @@ -32,18 +32,18 @@ |
32 | 32 | </td> |
33 | 33 | <td><%= metric_configuration.code %></td> |
34 | 34 | <td><%= link_to "Edit", :controller => "mezuro_plugin_myprofile", :action => "edit_metric_configuration", :params => |
35 | - {:configuration_name => @configuration.name, :metric_name => metric_configuration.metric.name} %></td> | |
35 | + {:metric_name => metric_configuration.metric.name, :id => @configuration_content.id} %></td> | |
36 | 36 | <% else %> |
37 | 37 | <td> |
38 | 38 | Compound Metric |
39 | 39 | </td> |
40 | 40 | <td><%= metric_configuration.code %></td> |
41 | 41 | <td><%= link_to "Edit", :controller => "mezuro_plugin_myprofile", :action => "edit_compound_metric_configuration", :params => |
42 | - {:configuration_name => @configuration.name, :metric_name => metric_configuration.metric.name} %></td> | |
42 | + {:metric_name => metric_configuration.metric.name, :id => @configuration_content.id} %></td> | |
43 | 43 | <% end %> |
44 | 44 | |
45 | 45 | <td><%= link_to "Remove", :controller => "mezuro_plugin_myprofile", :action => "remove_metric_configuration", :params => |
46 | - {:configuration_name => @configuration.name, :metric_name => metric_configuration.metric.name} %></td> | |
46 | + {:metric_name => metric_configuration.metric.name, :id => @configuration_content.id} %></td> | |
47 | 47 | </tr> |
48 | 48 | <% end %> |
49 | 49 | </table> | ... | ... |