From 83010eca32b8a92a08c6cee2a8150e65dd7cfc57 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Tue, 18 Mar 2014 15:39:58 +0600 Subject: [PATCH] [#345] fix specs; fix project url; fix missing method error --- .../controllers/project_schedule_controller.js | 2 +- app/models/concerns/event_loggable.rb | 2 +- app/models/git_hook.rb | 2 +- app/models/project.rb | 2 +- spec/models/project_spec.rb | 18 ++++++++---------- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/angularjs/controllers/project_schedule_controller.js b/app/assets/javascripts/angularjs/controllers/project_schedule_controller.js index 3daf59b45..03c4bed73 100644 --- a/app/assets/javascripts/angularjs/controllers/project_schedule_controller.js +++ b/app/assets/javascripts/angularjs/controllers/project_schedule_controller.js @@ -1,6 +1,6 @@ RosaABF.controller('ProjectScheduleController', ['$scope', '$http', function($scope, $http) { - // See: Modules::Models::Autostart::AUTOSTART_STATUSES + // See: Autostart::AUTOSTART_STATUSES $scope.statuses = { '0': 'autostart_statuses.0', '1': 'autostart_statuses.1', diff --git a/app/models/concerns/event_loggable.rb b/app/models/concerns/event_loggable.rb index ff8b7ecce..777139420 100644 --- a/app/models/concerns/event_loggable.rb +++ b/app/models/concerns/event_loggable.rb @@ -26,7 +26,7 @@ module EventLoggable end end - def destroying_event + def log_destroying_event ActiveSupport::Notifications.instrument(self.class.name, eventable: self) end end diff --git a/app/models/git_hook.rb b/app/models/git_hook.rb index eefcf29df..641b90495 100644 --- a/app/models/git_hook.rb +++ b/app/models/git_hook.rb @@ -65,7 +65,7 @@ class GitHook end def self.process(*args) - create_notifications(args.size > 1 ? GitHook.new(*args) : args.first) + Feed::Git.create_notifications(args.size > 1 ? GitHook.new(*args) : args.first) end def find_user(user) diff --git a/app/models/project.rb b/app/models/project.rb index 9fea40776..5b446377a 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -161,7 +161,7 @@ class Project < ActiveRecord::Base def git_project_address auth_user opts = default_url_options opts.merge!({user: auth_user.authentication_token, password: ''}) unless self.public? - Rails.application.routes.url_helpers.project_url(self.owner.uname, self.name, opts) + '.git' + Rails.application.routes.url_helpers.project_url(self.name_with_owner, opts) + '.git' #path #share by NFS end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 36fb3cc45..d1d9daaf6 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -208,17 +208,17 @@ describe Project do it { repository.platform.platform_arch_settings.should have(2).item } context 'once_a_12_hours' do - before { project.update_attributes(autostart_status: Modules::Models::Autostart::ONCE_A_12_HOURS) } + before { project.update_attributes(autostart_status: Autostart::ONCE_A_12_HOURS) } it_should_behave_like 'autostart build_lists', 1, 0, 0 end context 'once_a_day' do - before { project.update_attributes(autostart_status: Modules::Models::Autostart::ONCE_A_DAY) } + before { project.update_attributes(autostart_status: Autostart::ONCE_A_DAY) } it_should_behave_like 'autostart build_lists', 0, 1, 0 end context 'once_a_day' do - before { project.update_attributes(autostart_status: Modules::Models::Autostart::ONCE_A_WEEK) } + before { project.update_attributes(autostart_status: Autostart::ONCE_A_WEEK) } it_should_behave_like 'autostart build_lists', 0, 0, 1 end @@ -232,7 +232,7 @@ describe Project do before do repositories = [repository, main_repository] # 1 - + # Create 1 main platforms with main repositories repositories << FactoryGirl.create(:repository, name: 'main') # 2 # Create platform without main repository @@ -242,7 +242,7 @@ describe Project do r.platform.update_attributes(visibility: 'hidden') repositories << r # 3 - # Without access to hidden platform + # Without access to hidden platform r = FactoryGirl.create(:repository, name: 'main') r.platform.update_attributes(visibility: 'hidden') @@ -266,20 +266,18 @@ describe Project do # into main platforms: 2 + 1(hidden) # into personal platform: 3(main) * 1 context 'once_a_12_hours' do - before { project.update_attributes(autostart_status: Modules::Models::Autostart::ONCE_A_12_HOURS) } + before { project.update_attributes(autostart_status: Autostart::ONCE_A_12_HOURS) } it_should_behave_like 'autostart build_lists', 6, 0, 0 end context 'once_a_day' do - before { project.update_attributes(autostart_status: Modules::Models::Autostart::ONCE_A_DAY) } + before { project.update_attributes(autostart_status: Autostart::ONCE_A_DAY) } it_should_behave_like 'autostart build_lists', 0, 6, 0 end context 'once_a_day' do - before { project.update_attributes(autostart_status: Modules::Models::Autostart::ONCE_A_WEEK) } + before { project.update_attributes(autostart_status: Autostart::ONCE_A_WEEK) } it_should_behave_like 'autostart build_lists', 0, 0, 6 end - end - end