Commit 3543b6b5c5196a3d73ed0cb376c13554cad2fd3c
1 parent
3fa0223a
Exists in
master
and in
29 other branches
[mezuro] Adding integration tests for clients
Showing
3 changed files
with
51 additions
and
2 deletions
Show diff stats
plugins/mezuro/lib/kalibro/entities/entity.rb
... | ... | @@ -53,8 +53,10 @@ class Kalibro::Entities::Entity |
53 | 53 | end |
54 | 54 | |
55 | 55 | def convert_to_hash(value) |
56 | - return value.collect { |element| convert_to_hash(element) } if value.kind_of?(Array) | |
57 | - return value.to_hash if value.kind_of?(Kalibro::Entities::Entity) | |
56 | + return value.collect { |element| convert_to_hash(element) } if value.is_a?(Array) | |
57 | + return value.to_hash if value.is_a?(Kalibro::Entities::Entity) | |
58 | + return 'INF' if value.is_a?(Float) and value.infinite? == 1 | |
59 | + return '-INF' if value.is_a?(Float) and value.infinite? == -1 | |
58 | 60 | value |
59 | 61 | end |
60 | 62 | ... | ... |
... | ... | @@ -0,0 +1,22 @@ |
1 | +require "test_helper" | |
2 | + | |
3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/native_metric_fixtures" | |
4 | + | |
5 | +class BaseToolClientTest < ActiveSupport::TestCase | |
6 | + | |
7 | + def setup | |
8 | + @client = Kalibro::Client::BaseToolClient.new | |
9 | + end | |
10 | + | |
11 | + should 'get base tool names' do | |
12 | + assert_equal ['Analizo', 'Checkstyle'], @client.base_tool_names | |
13 | + end | |
14 | + | |
15 | + should 'get base tool by name' do | |
16 | + analizo = @client.base_tool('Analizo') | |
17 | + amloc = NativeMetricFixtures.amloc | |
18 | + amloc.languages = ["C", "CPP", "JAVA"] | |
19 | + assert_includes analizo.supported_metrics, amloc | |
20 | + end | |
21 | + | |
22 | +end | |
0 | 23 | \ No newline at end of file | ... | ... |
plugins/mezuro/test/functional/metric_configuration_client_test.rb
0 → 100644
... | ... | @@ -0,0 +1,25 @@ |
1 | +require "test_helper" | |
2 | + | |
3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" | |
4 | + | |
5 | +class MetricConfigurationClientTest < ActiveSupport::TestCase | |
6 | + | |
7 | + def setup | |
8 | + @client = Kalibro::Client::MetricConfigurationClient.new | |
9 | + end | |
10 | + | |
11 | + should 'save metric configuration' do | |
12 | + configuration = MetricConfigurationFixtures.amloc_configuration | |
13 | + @client.save(configuration, 'Configuration X') | |
14 | + end | |
15 | + | |
16 | + should 'get metric configuration by name' do | |
17 | + configuration = MetricConfigurationFixtures.amloc_configuration | |
18 | + assert_equal configuration, @client.metric_configuration('Configuration X', 'Metric X') | |
19 | + end | |
20 | + | |
21 | + should 'remove metric configuration by name' do | |
22 | + @client.remove('Configuration X', 'Metric X') | |
23 | + end | |
24 | + | |
25 | +end | |
0 | 26 | \ No newline at end of file | ... | ... |