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