Commit f60d91b1d6f5ca6feb4934ec00dde1b31310d0ba
Committed by
Paulo Meireles
1 parent
f591f6d2
Exists in
master
and in
23 other branches
[Mezuro] Fix tests using fixtures
Showing
10 changed files
with
30 additions
and
8 deletions
Show diff stats
plugins/mezuro/test/mezuro_test.rb
1 | require "test_helper" | 1 | require "test_helper" |
2 | + | ||
2 | require File.dirname(__FILE__) + '/../controllers/mezuro_plugin_myprofile_controller' | 3 | require File.dirname(__FILE__) + '/../controllers/mezuro_plugin_myprofile_controller' |
3 | 4 | ||
4 | class MezuroTest < ActiveSupport::TestCase | 5 | class MezuroTest < ActiveSupport::TestCase |
plugins/mezuro/test/unit/kalibro/client/base_tool_client_test.rb
1 | require "test_helper" | 1 | require "test_helper" |
2 | + | ||
3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" | ||
4 | + | ||
2 | class BaseToolClientTest < ActiveSupport::TestCase | 5 | class BaseToolClientTest < ActiveSupport::TestCase |
3 | 6 | ||
4 | def setup | 7 | def setup |
@@ -25,7 +28,7 @@ class BaseToolClientTest < ActiveSupport::TestCase | @@ -25,7 +28,7 @@ class BaseToolClientTest < ActiveSupport::TestCase | ||
25 | end | 28 | end |
26 | 29 | ||
27 | should 'get base tool by name' do | 30 | should 'get base tool by name' do |
28 | - analizo = BaseToolTest.analizo | 31 | + analizo = BaseToolFixtures.analizo |
29 | request_body = {:base_tool_name => 'Analizo'} | 32 | request_body = {:base_tool_name => 'Analizo'} |
30 | @port.expects(:request).with(:get_base_tool, request_body).returns({:base_tool => analizo.to_hash}) | 33 | @port.expects(:request).with(:get_base_tool, request_body).returns({:base_tool => analizo.to_hash}) |
31 | assert_equal analizo, @client.base_tool('Analizo') | 34 | assert_equal analizo, @client.base_tool('Analizo') |
plugins/mezuro/test/unit/kalibro/client/configuration_client_test.rb
1 | require "test_helper" | 1 | require "test_helper" |
2 | + | ||
3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" | ||
4 | + | ||
2 | class ConfigurationClientTest < ActiveSupport::TestCase | 5 | class ConfigurationClientTest < ActiveSupport::TestCase |
3 | 6 | ||
4 | def setup | 7 | def setup |
@@ -8,7 +11,7 @@ class ConfigurationClientTest < ActiveSupport::TestCase | @@ -8,7 +11,7 @@ class ConfigurationClientTest < ActiveSupport::TestCase | ||
8 | end | 11 | end |
9 | 12 | ||
10 | should 'save configuration' do | 13 | should 'save configuration' do |
11 | - configuration = ConfigurationTest.kalibro_configuration | 14 | + configuration = ConfigurationFixtures.kalibro_configuration |
12 | @port.expects(:request).with(:save_configuration, {:configuration => configuration.to_hash}) | 15 | @port.expects(:request).with(:save_configuration, {:configuration => configuration.to_hash}) |
13 | @client.save(configuration) | 16 | @client.save(configuration) |
14 | end | 17 | end |
@@ -31,7 +34,7 @@ class ConfigurationClientTest < ActiveSupport::TestCase | @@ -31,7 +34,7 @@ class ConfigurationClientTest < ActiveSupport::TestCase | ||
31 | end | 34 | end |
32 | 35 | ||
33 | should 'get configuration by name' do | 36 | should 'get configuration by name' do |
34 | - configuration = ConfigurationTest.kalibro_configuration | 37 | + configuration = ConfigurationFixtures.kalibro_configuration |
35 | request_body = {:configuration_name => configuration.name} | 38 | request_body = {:configuration_name => configuration.name} |
36 | response_hash = {:configuration => configuration.to_hash} | 39 | response_hash = {:configuration => configuration.to_hash} |
37 | @port.expects(:request).with(:get_configuration, request_body).returns(response_hash) | 40 | @port.expects(:request).with(:get_configuration, request_body).returns(response_hash) |
plugins/mezuro/test/unit/kalibro/client/kalibro_client_test.rb
plugins/mezuro/test/unit/kalibro/client/module_result_client_test.rb
1 | require "test_helper" | 1 | require "test_helper" |
2 | + | ||
3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" | ||
4 | + | ||
2 | class ModuleResultClientTest < ActiveSupport::TestCase | 5 | class ModuleResultClientTest < ActiveSupport::TestCase |
3 | 6 | ||
4 | def setup | 7 | def setup |
5 | @port = mock | 8 | @port = mock |
6 | Kalibro::Client::Port.expects(:new).with('ModuleResult').returns(@port) | 9 | Kalibro::Client::Port.expects(:new).with('ModuleResult').returns(@port) |
7 | @client = Kalibro::Client::ModuleResultClient.new | 10 | @client = Kalibro::Client::ModuleResultClient.new |
8 | - @result = ModuleResultTest.fixture | 11 | + @result = ModuleResultFixtures.create |
9 | end | 12 | end |
10 | 13 | ||
11 | should 'get module result' do | 14 | should 'get module result' do |
plugins/mezuro/test/unit/kalibro/client/port_test.rb
plugins/mezuro/test/unit/kalibro/client/project_client_test.rb
1 | require "test_helper" | 1 | require "test_helper" |
2 | + | ||
3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_fixtures" | ||
4 | + | ||
2 | class ProjectClientTest < ActiveSupport::TestCase | 5 | class ProjectClientTest < ActiveSupport::TestCase |
3 | 6 | ||
4 | def setup | 7 | def setup |
@@ -8,7 +11,7 @@ class ProjectClientTest < ActiveSupport::TestCase | @@ -8,7 +11,7 @@ class ProjectClientTest < ActiveSupport::TestCase | ||
8 | end | 11 | end |
9 | 12 | ||
10 | should 'save project' do | 13 | should 'save project' do |
11 | - project = ProjectTest.qt_calculator | 14 | + project = ProjectFixtures.qt_calculator |
12 | @port.expects(:request).with(:save_project, {:project => project.to_hash}) | 15 | @port.expects(:request).with(:save_project, {:project => project.to_hash}) |
13 | @client.save(project) | 16 | @client.save(project) |
14 | end | 17 | end |
@@ -31,7 +34,7 @@ class ProjectClientTest < ActiveSupport::TestCase | @@ -31,7 +34,7 @@ class ProjectClientTest < ActiveSupport::TestCase | ||
31 | end | 34 | end |
32 | 35 | ||
33 | should 'get project by name' do | 36 | should 'get project by name' do |
34 | - project = ProjectTest.qt_calculator | 37 | + project = ProjectFixtures.qt_calculator |
35 | request_body = {:project_name => project.name} | 38 | request_body = {:project_name => project.name} |
36 | response_hash = {:project => project.to_hash} | 39 | response_hash = {:project => project.to_hash} |
37 | @port.expects(:request).with(:get_project, request_body).returns(response_hash) | 40 | @port.expects(:request).with(:get_project, request_body).returns(response_hash) |
plugins/mezuro/test/unit/kalibro/client/project_result_client_test.rb
1 | require "test_helper" | 1 | require "test_helper" |
2 | + | ||
3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" | ||
4 | + | ||
2 | class ProjectResultClientTest < ActiveSupport::TestCase | 5 | class ProjectResultClientTest < ActiveSupport::TestCase |
3 | 6 | ||
4 | def setup | 7 | def setup |
@@ -6,7 +9,7 @@ class ProjectResultClientTest < ActiveSupport::TestCase | @@ -6,7 +9,7 @@ class ProjectResultClientTest < ActiveSupport::TestCase | ||
6 | Kalibro::Client::Port.expects(:new).with('ProjectResult').returns(@port) | 9 | Kalibro::Client::Port.expects(:new).with('ProjectResult').returns(@port) |
7 | @client = Kalibro::Client::ProjectResultClient.new | 10 | @client = Kalibro::Client::ProjectResultClient.new |
8 | 11 | ||
9 | - @result = ProjectResultTest.qt_calculator | 12 | + @result = ProjectResultFixtures.qt_calculator |
10 | @project_name = @result.project.name | 13 | @project_name = @result.project.name |
11 | @date = @result.date | 14 | @date = @result.date |
12 | @flag = DateTime.now.sec % 2 == 0 | 15 | @flag = DateTime.now.sec % 2 == 0 |
plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb
1 | require "test_helper" | 1 | require "test_helper" |
2 | + | ||
3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_fixtures" | ||
4 | + | ||
2 | class ProjectContentTest < ActiveSupport::TestCase | 5 | class ProjectContentTest < ActiveSupport::TestCase |
3 | 6 | ||
4 | def setup | 7 | def setup |
5 | - @project = ProjectTest.qt_calculator | 8 | + @project = ProjectFixtures.qt_calculator |
6 | @content = MezuroPlugin::ProjectContent.new | 9 | @content = MezuroPlugin::ProjectContent.new |
7 | @content.name = @project.name | 10 | @content.name = @project.name |
8 | @content.license = @project.license | 11 | @content.license = @project.license |