Commit 6cbd22d0c45a2d240c18795834fe2143cc69b632
Committed by
Caio
1 parent
80e4ce40
Exists in
master
and in
29 other branches
[Mezuro] Continued refactoring tests.
Showing
3 changed files
with
37 additions
and
3 deletions
Show diff stats
plugins/mezuro/lib/mezuro_plugin/configuration_content.rb
plugins/mezuro/test/unit/mezuro_plugin/metric_configuration_content_test.rb
... | ... | @@ -18,7 +18,27 @@ class MetricConfigurationContentTest < ActiveSupport::TestCase |
18 | 18 | assert_equal 'Sets of thresholds to interpret a metric', MezuroPlugin::MetricConfigurationContent.description |
19 | 19 | end |
20 | 20 | |
21 | - should 'return metric configuration' do | |
22 | - pending "Need refactoring" | |
21 | + should 'have an html view' do | |
22 | + assert_not_nil @metric_configuration.to_html | |
23 | 23 | end |
24 | + | |
25 | + #should 'return metric configuration' do | |
26 | + # pending "Need refactoring" | |
27 | + #end | |
28 | + | |
29 | + should 'send metric configuration to service after saving' do | |
30 | + @metric_configuration.expects :send_metric_configuration_to_service | |
31 | + @metric_configuration.run_callbacks :after_save | |
32 | + end | |
33 | + | |
34 | + should 'send correct metric configuration to service' do | |
35 | + Kalibro::Client::MetricConfigurationClient.expects(:save).with(@metric_configuration) | |
36 | + @metric_configuration.send :send_metric_configuration_to_service | |
37 | + end | |
38 | + | |
39 | + should 'remove metric configuration from service' do | |
40 | + Kalibro::Client::MetricConfigurationClient.expects(:remove).with(@metric_configuration.name) | |
41 | + @metric_configuration.send :remove_metric_configuration_from_service | |
42 | + end | |
43 | + | |
24 | 44 | end | ... | ... |
plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb
1 | 1 | require "test_helper" |
2 | 2 | |
3 | 3 | require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_fixtures" |
4 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_result_fixtures" | |
4 | 5 | |
5 | 6 | class ProjectContentTest < ActiveSupport::TestCase |
6 | 7 | |
... | ... | @@ -42,6 +43,19 @@ class ProjectContentTest < ActiveSupport::TestCase |
42 | 43 | Kalibro::Client::ProjectResultClient.expects(:last_result).with(@content.name).returns(project_result) |
43 | 44 | assert_equal project_result, @content.project_result |
44 | 45 | end |
46 | + | |
47 | + #def get_date_result(date) | |
48 | + # client = Kalibro::Client::ProjectResultClient.new | |
49 | + # @project_result ||= client.has_results_before(name, date) ? client.last_result_before(name, date) : client.first_result_after(name, date) | |
50 | + #end | |
51 | + | |
52 | + should 'get date result from service when has_result_before is true' do | |
53 | + client = mock | |
54 | + Kalibro::Client::ProjectResultClient.expects(:new).returns(client) | |
55 | + client.expects(:has_results_before).with(@project.name, "2012-05-22T22:00:33+04:00").returns(true) | |
56 | + client.expects(:last_result_before).with(@project.name, "2012-05-22T22:00:33+04:00").returns(project_result) | |
57 | + assert_equal project_result, @content.project_result | |
58 | + end | |
45 | 59 | |
46 | 60 | should 'get module result from service' do |
47 | 61 | mock_project_client | ... | ... |