Commit 7ac9c4e7142d820bdc909cfa2ca87c86da6eb5ae
Committed by
Diego Camarinha
1 parent
1cf9ed64
Exists in
colab
and in
4 other branches
updated kalibro_gatekeeper_client
Showing
10 changed files
with
19 additions
and
19 deletions
Show diff stats
Gemfile
... | ... | @@ -31,7 +31,7 @@ gem 'jbuilder', '~> 2.1.2' |
31 | 31 | gem 'devise', '~> 3.3.0' |
32 | 32 | |
33 | 33 | # Kalibro integration |
34 | -gem 'kalibro_gatekeeper_client', "~> 0.3.1" | |
34 | +gem 'kalibro_gatekeeper_client', "~> 1.0.0.rc2" | |
35 | 35 | |
36 | 36 | # PostgreSQL integration |
37 | 37 | gem "pg", "~> 0.17.0" | ... | ... |
Gemfile.lock
... | ... | @@ -136,7 +136,7 @@ GEM |
136 | 136 | jquery-ui-rails (5.0.0) |
137 | 137 | railties (>= 3.2.16) |
138 | 138 | json (1.8.1) |
139 | - kalibro_gatekeeper_client (0.3.2) | |
139 | + kalibro_gatekeeper_client (1.0.0.rc2) | |
140 | 140 | activesupport (>= 2.2.1) |
141 | 141 | faraday_middleware (~> 0.9.0) |
142 | 142 | konacha (3.2.4) |
... | ... | @@ -293,7 +293,7 @@ DEPENDENCIES |
293 | 293 | jbuilder (~> 2.1.2) |
294 | 294 | jquery-rails |
295 | 295 | jquery-ui-rails (~> 5.0.0) |
296 | - kalibro_gatekeeper_client (~> 0.3.1) | |
296 | + kalibro_gatekeeper_client (~> 1.0.0.rc2) | |
297 | 297 | konacha (~> 3.2.0) |
298 | 298 | mocha |
299 | 299 | pg (~> 0.17.0) | ... | ... |
app/controllers/metric_configurations_controller.rb
... | ... | @@ -2,20 +2,20 @@ class MetricConfigurationsController < BaseMetricConfigurationsController |
2 | 2 | def choose_metric |
3 | 3 | @mezuro_configuration_id = params[:mezuro_configuration_id].to_i |
4 | 4 | @metric_configuration_id = params[:metric_configuration_id].to_i |
5 | - @base_tools = KalibroGatekeeperClient::Entities::BaseTool.all | |
5 | + @base_tools = KalibroGatekeeperClient::Entities::MetricCollector.all | |
6 | 6 | @exist_metric = params[:exist_metric] |
7 | 7 | end |
8 | 8 | |
9 | 9 | def new |
10 | 10 | super |
11 | - metric_configuration.base_tool_name = params[:base_tool_name] | |
12 | - metric_configuration.metric = KalibroGatekeeperClient::Entities::BaseTool.find_by_name(params[:base_tool_name]).metric params[:metric_name] | |
11 | + metric_configuration.metric_collector_name = params[:base_tool_name] | |
12 | + metric_configuration.metric = KalibroGatekeeperClient::Entities::MetricCollector.find_by_name(params[:base_tool_name]).metric params[:metric_name] | |
13 | 13 | end |
14 | 14 | |
15 | 15 | def create |
16 | 16 | super |
17 | - @metric_configuration.metric = KalibroGatekeeperClient::Entities::BaseTool.find_by_name(params[:base_tool_name]).metric params[:metric_name] | |
18 | - @metric_configuration.base_tool_name = params[:base_tool_name] | |
17 | + @metric_configuration.metric = KalibroGatekeeperClient::Entities::MetricCollector.find_by_name(params[:base_tool_name]).metric params[:metric_name] | |
18 | + @metric_configuration.metric_collector_name = params[:base_tool_name] | |
19 | 19 | @metric_configuration.code = @metric_configuration.metric.code |
20 | 20 | respond_to do |format| |
21 | 21 | create_and_redir(format) | ... | ... |
app/views/metric_configurations/_form.html.erb
... | ... | @@ -47,4 +47,4 @@ |
47 | 47 | </div> |
48 | 48 | |
49 | 49 | <%= hidden_field_tag(:metric_name, @metric_configuration.metric.name) %> |
50 | -<%= hidden_field_tag(:base_tool_name, @metric_configuration.base_tool_name) %> | |
50 | +<%= hidden_field_tag(:base_tool_name, @metric_configuration.metric_collector_name) %> | ... | ... |
app/views/metric_configurations/choose_metric.html.erb
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | <% @base_tools.each do |base_tool| %> |
12 | 12 | <h3 class="jquery-ui-accordion"><%= base_tool.name %></h3> |
13 | 13 | <div> |
14 | - <% base_tool.supported_metrics.each do |metric| %> | |
14 | + <% base_tool.supported_metrics.each do |code, metric| %> | |
15 | 15 | <%= link_to metric.name, '#', onclick: "BaseTool.choose_metric(\"#{metric.name}\", \"#{base_tool.name}\");", remote: true %><br> |
16 | 16 | <% end %> |
17 | 17 | </div> | ... | ... |
app/views/metric_configurations/new.html.erb
app/views/metric_configurations/show.html.erb
spec/controllers/metric_configurations_controller_spec.rb
... | ... | @@ -11,7 +11,7 @@ describe MetricConfigurationsController, :type => :controller do |
11 | 11 | context 'when adding new metrics' do |
12 | 12 | before :each do |
13 | 13 | subject.expects(:mezuro_configuration_owner?).returns true |
14 | - KalibroGatekeeperClient::Entities::BaseTool.expects(:all).returns([base_tool]) | |
14 | + KalibroGatekeeperClient::Entities::MetricCollector.expects(:all).returns([base_tool]) | |
15 | 15 | get :choose_metric, mezuro_configuration_id: mezuro_configuration.id |
16 | 16 | end |
17 | 17 | |
... | ... | @@ -29,7 +29,7 @@ describe MetricConfigurationsController, :type => :controller do |
29 | 29 | context 'when the current user owns the mezuro configuration' do |
30 | 30 | before :each do |
31 | 31 | subject.expects(:mezuro_configuration_owner?).returns true |
32 | - KalibroGatekeeperClient::Entities::BaseTool.expects(:find_by_name).with(base_tool.name).returns(base_tool) | |
32 | + KalibroGatekeeperClient::Entities::MetricCollector.expects(:find_by_name).with(base_tool.name).returns(base_tool) | |
33 | 33 | post :new, mezuro_configuration_id: mezuro_configuration.id, metric_name: "Lines of Code", base_tool_name: base_tool.name |
34 | 34 | end |
35 | 35 | |
... | ... | @@ -65,7 +65,7 @@ describe MetricConfigurationsController, :type => :controller do |
65 | 65 | context 'with valid fields' do |
66 | 66 | before :each do |
67 | 67 | MetricConfiguration.any_instance.expects(:save).returns(true) |
68 | - KalibroGatekeeperClient::Entities::BaseTool.expects(:find_by_name).with(base_tool.name).returns(base_tool) | |
68 | + KalibroGatekeeperClient::Entities::MetricCollector.expects(:find_by_name).with(base_tool.name).returns(base_tool) | |
69 | 69 | base_tool.expects(:metric).with(metric_configuration.metric.name).returns(metric_configuration.metric) |
70 | 70 | |
71 | 71 | post :create, mezuro_configuration_id: mezuro_configuration.id, metric_configuration: metric_configuration_params, base_tool_name: base_tool.name, metric_name: metric_configuration.metric.name |
... | ... | @@ -77,7 +77,7 @@ describe MetricConfigurationsController, :type => :controller do |
77 | 77 | context 'with invalid fields' do |
78 | 78 | before :each do |
79 | 79 | MetricConfiguration.any_instance.expects(:save).returns(false) |
80 | - KalibroGatekeeperClient::Entities::BaseTool.expects(:find_by_name).with(base_tool.name).returns(base_tool) | |
80 | + KalibroGatekeeperClient::Entities::MetricCollector.expects(:find_by_name).with(base_tool.name).returns(base_tool) | |
81 | 81 | base_tool.expects(:metric).with(metric_configuration.metric.name).returns(metric_configuration.metric) |
82 | 82 | |
83 | 83 | post :create, mezuro_configuration_id: mezuro_configuration.id, metric_configuration: metric_configuration_params, base_tool_name: base_tool.name, metric_name: metric_configuration.metric.name | ... | ... |
spec/factories/base_tools.rb
1 | 1 | FactoryGirl.define do |
2 | - factory :base_tool, class: KalibroGatekeeperClient::Entities::BaseTool do | |
2 | + factory :base_tool, class: KalibroGatekeeperClient::Entities::MetricCollector do | |
3 | 3 | name 'Analizo' |
4 | - supported_metric {FactoryGirl.build(:loc)} | |
4 | + supported_metrics { { "total_abstract_classes" => FactoryGirl.build(:metric).to_hash, "loc" => FactoryGirl.build(:loc).to_hash } } | |
5 | 5 | end |
6 | 6 | end | ... | ... |
spec/factories/metric_configurations.rb