Commit 7f0c3e71e1f2b36701e3010a3261b9e880946088

Authored by Alessandro Palmeira + Diego Araújo
Committed by Paulo Meireles
1 parent 50c6e1f7

[Mezuro] Fixed project and test to save on method create

plugins/mezuro/lib/kalibro/project.rb
... ... @@ -8,14 +8,13 @@ class Kalibro::Project < Kalibro::Model
8 8  
9 9 def self.find_by_name(project_name)
10 10 begin
11   - attributes = request("Project", :get_project, :project_name => project_name)[:project]
12   - new attributes
  11 + new request("Project", :get_project, :project_name => project_name)[:project]
13 12 rescue Exception => error
14 13 nil
15 14 end
16 15 end
17 16  
18   - def self.create (content)
  17 + def self.create(content)
19 18 new({
20 19 :name => content.name,
21 20 :license => content.license,
... ... @@ -25,7 +24,7 @@ class Kalibro::Project < Kalibro::Model
25 24 :address => content.repository_url
26 25 },
27 26 :configuration_name => content.configuration_name
28   - })
  27 + }).save
29 28 end
30 29  
31 30 def destroy
... ...
plugins/mezuro/test/unit/kalibro/project_test.rb
... ... @@ -57,9 +57,7 @@ class ProjectTest < ActiveSupport::TestCase
57 57 end
58 58  
59 59 should 'create project' do
60   - project = Kalibro::Project.create @project_content
61   - assert_equal @project.name, project.name
62   - assert_equal @project.repository.type, project.repository.type
  60 + assert Kalibro::Project.create @project_content
63 61 end
64 62  
65 63 should 'convert project to hash' do
... ...