Commit 98e7237dd10694e431c47273d4c876eccaaa16cf

Authored by Rafael Manzo
Committed by Alessandro Palmeira
1 parent 79d52c33

[Mezuro] Beggining of tests for RepositoryController

plugins/mezuro/test/fixtures/configuration_fixtures.rb
... ... @@ -29,4 +29,8 @@ class ConfigurationFixtures
29 29 })
30 30 end
31 31  
  32 +def self.all
  33 + [configuration]
  34 +end
  35 +
32 36 end
... ...
plugins/mezuro/test/fixtures/repository_fixtures.rb
... ... @@ -20,4 +20,8 @@ class RepositoryFixtures
20 20 {:id => 42, :name => "test repository", :description => "test description", :license => "GPL", :process_period => "1", :type => 'SUBVERSION', :address => 'https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator', :configuration_id => 31}
21 21 end
22 22  
  23 + def self.types
  24 + ["SUBVERSION", "GIT"]
  25 + end
  26 +
23 27 end
... ...
plugins/mezuro/test/functional/profile/mezuro_plugin_repository_controller_test.rb 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +require 'test_helper'
  2 +
  3 +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/processing_fixtures"
  4 +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/throwable_fixtures"
  5 +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/repository_fixtures"
  6 +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_content_fixtures"
  7 +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures"
  8 +
  9 +class MezuroPluginRepositoryControllerTest < ActionController::TestCase
  10 +
  11 + def setup
  12 + @controller = MezuroPluginRepositoryController.new
  13 + @request = ActionController::TestRequest.new
  14 + @response = ActionController::TestResponse.new
  15 + @profile = fast_create(Community)
  16 +
  17 + @repository = RepositoryFixtures.repository
  18 + @content = MezuroPlugin::ProjectContent.new(:profile => @profile, :name => name)
  19 + @content.expects(:send_project_to_service).returns(nil)
  20 + @content.stubs(:solr_save)
  21 + @content.save
  22 + end
  23 +
  24 + should 'test stuff' do
  25 + Kalibro::Repository.expects(:repository_types).returns(RepositoryFixtures.types)
  26 + #Kalibro::Configuration.any_instance.expects(:all).returns(ConfigurationFixtures.all)
  27 +
  28 + get :new_repository, :profile => @profile.identifier, :id => @content.id
  29 +
  30 + #assert_equal RepositoryFixtures.types, assigns(:repository_types)
  31 + end
  32 +end
0 33 \ No newline at end of file
... ...