[#345] fix specs; fix project url; fix missing method error

This commit is contained in:
Alexander Machehin 2014-03-18 15:39:58 +06:00
parent 4cf3e931bd
commit 83010eca32
5 changed files with 12 additions and 14 deletions

View File

@ -1,6 +1,6 @@
RosaABF.controller('ProjectScheduleController', ['$scope', '$http', function($scope, $http) { RosaABF.controller('ProjectScheduleController', ['$scope', '$http', function($scope, $http) {
// See: Modules::Models::Autostart::AUTOSTART_STATUSES // See: Autostart::AUTOSTART_STATUSES
$scope.statuses = { $scope.statuses = {
'0': 'autostart_statuses.0', '0': 'autostart_statuses.0',
'1': 'autostart_statuses.1', '1': 'autostart_statuses.1',

View File

@ -26,7 +26,7 @@ module EventLoggable
end end
end end
def destroying_event def log_destroying_event
ActiveSupport::Notifications.instrument(self.class.name, eventable: self) ActiveSupport::Notifications.instrument(self.class.name, eventable: self)
end end
end end

View File

@ -65,7 +65,7 @@ class GitHook
end end
def self.process(*args) 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 end
def find_user(user) def find_user(user)

View File

@ -161,7 +161,7 @@ class Project < ActiveRecord::Base
def git_project_address auth_user def git_project_address auth_user
opts = default_url_options opts = default_url_options
opts.merge!({user: auth_user.authentication_token, password: ''}) unless self.public? 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 #path #share by NFS
end end

View File

@ -208,17 +208,17 @@ describe Project do
it { repository.platform.platform_arch_settings.should have(2).item } it { repository.platform.platform_arch_settings.should have(2).item }
context 'once_a_12_hours' do 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 it_should_behave_like 'autostart build_lists', 1, 0, 0
end end
context 'once_a_day' do 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 it_should_behave_like 'autostart build_lists', 0, 1, 0
end end
context 'once_a_day' do 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 it_should_behave_like 'autostart build_lists', 0, 0, 1
end end
@ -232,7 +232,7 @@ describe Project do
before do before do
repositories = [repository, main_repository] # 1 repositories = [repository, main_repository] # 1
# Create 1 main platforms with main repositories # Create 1 main platforms with main repositories
repositories << FactoryGirl.create(:repository, name: 'main') # 2 repositories << FactoryGirl.create(:repository, name: 'main') # 2
# Create platform without main repository # Create platform without main repository
@ -242,7 +242,7 @@ describe Project do
r.platform.update_attributes(visibility: 'hidden') r.platform.update_attributes(visibility: 'hidden')
repositories << r # 3 repositories << r # 3
# Without access to hidden platform # Without access to hidden platform
r = FactoryGirl.create(:repository, name: 'main') r = FactoryGirl.create(:repository, name: 'main')
r.platform.update_attributes(visibility: 'hidden') r.platform.update_attributes(visibility: 'hidden')
@ -266,20 +266,18 @@ describe Project do
# into main platforms: 2 + 1(hidden) # into main platforms: 2 + 1(hidden)
# into personal platform: 3(main) * 1 # into personal platform: 3(main) * 1
context 'once_a_12_hours' do 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 it_should_behave_like 'autostart build_lists', 6, 0, 0
end end
context 'once_a_day' do 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 it_should_behave_like 'autostart build_lists', 0, 6, 0
end end
context 'once_a_day' do 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 it_should_behave_like 'autostart build_lists', 0, 0, 6
end end
end end
end end