From 7f0c3e71e1f2b36701e3010a3261b9e880946088 Mon Sep 17 00:00:00 2001 From: Alessandro Palmeira + Diego Araújo Date: Fri, 13 Jul 2012 09:59:07 -0300 Subject: [PATCH] [Mezuro] Fixed project and test to save on method create --- plugins/mezuro/lib/kalibro/project.rb | 7 +++---- plugins/mezuro/test/unit/kalibro/project_test.rb | 4 +--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/plugins/mezuro/lib/kalibro/project.rb b/plugins/mezuro/lib/kalibro/project.rb index aea2da4..1b273e5 100644 --- a/plugins/mezuro/lib/kalibro/project.rb +++ b/plugins/mezuro/lib/kalibro/project.rb @@ -8,14 +8,13 @@ class Kalibro::Project < Kalibro::Model def self.find_by_name(project_name) begin - attributes = request("Project", :get_project, :project_name => project_name)[:project] - new attributes + new request("Project", :get_project, :project_name => project_name)[:project] rescue Exception => error nil end end - def self.create (content) + def self.create(content) new({ :name => content.name, :license => content.license, @@ -25,7 +24,7 @@ class Kalibro::Project < Kalibro::Model :address => content.repository_url }, :configuration_name => content.configuration_name - }) + }).save end def destroy diff --git a/plugins/mezuro/test/unit/kalibro/project_test.rb b/plugins/mezuro/test/unit/kalibro/project_test.rb index 4f0fb31..1d115a3 100644 --- a/plugins/mezuro/test/unit/kalibro/project_test.rb +++ b/plugins/mezuro/test/unit/kalibro/project_test.rb @@ -57,9 +57,7 @@ class ProjectTest < ActiveSupport::TestCase end should 'create project' do - project = Kalibro::Project.create @project_content - assert_equal @project.name, project.name - assert_equal @project.repository.type, project.repository.type + assert Kalibro::Project.create @project_content end should 'convert project to hash' do -- libgit2 0.21.2