Merge pull request #457 from abf/rosa-build:rails-4.0.13
Update rails to 4.0.13
This commit is contained in:
commit
a01661abaf
10
Gemfile
10
Gemfile
|
@ -1,6 +1,6 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem 'rails', '4.0.11'
|
||||
gem 'rails', '4.0.13'
|
||||
|
||||
gem 'activeadmin', github: 'activeadmin'
|
||||
gem 'pg', '~> 0.17.1'
|
||||
|
@ -125,15 +125,15 @@ group :development do
|
|||
end
|
||||
|
||||
group :development, :test do
|
||||
gem 'rspec-rails', '~> 2.14.1'
|
||||
gem 'rspec-rails'
|
||||
end
|
||||
|
||||
group :test do
|
||||
gem 'factory_girl_rails', '~> 4.4.1'
|
||||
gem 'rr', '~> 1.1.2'
|
||||
gem 'factory_girl_rails'
|
||||
gem 'rr'
|
||||
gem 'shoulda'
|
||||
gem 'shoulda-matchers'
|
||||
gem 'mock_redis', '~> 0.11'
|
||||
gem 'mock_redis'
|
||||
gem 'webmock'
|
||||
gem 'rake'
|
||||
gem 'test_after_commit'
|
||||
|
|
99
Gemfile.lock
99
Gemfile.lock
|
@ -10,7 +10,7 @@ GIT
|
|||
|
||||
GIT
|
||||
remote: git://github.com/activeadmin/activeadmin.git
|
||||
revision: 51faef09fe27cdf84568cd00b10ccb9ee8a26151
|
||||
revision: ed1fbca8c64af827616c58f274d7be256ca513b6
|
||||
specs:
|
||||
activeadmin (1.0.0.pre)
|
||||
arbre (~> 1.0, >= 1.0.2)
|
||||
|
@ -53,25 +53,25 @@ GEM
|
|||
remote: https://rubygems.org/
|
||||
specs:
|
||||
RedCloth (4.2.9)
|
||||
actionmailer (4.0.11)
|
||||
actionpack (= 4.0.11)
|
||||
actionmailer (4.0.13)
|
||||
actionpack (= 4.0.13)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
actionpack (4.0.11)
|
||||
activesupport (= 4.0.11)
|
||||
actionpack (4.0.13)
|
||||
activesupport (= 4.0.13)
|
||||
builder (~> 3.1.0)
|
||||
erubis (~> 2.7.0)
|
||||
rack (~> 1.5.2)
|
||||
rack-test (~> 0.6.2)
|
||||
activemodel (4.0.11)
|
||||
activesupport (= 4.0.11)
|
||||
activemodel (4.0.13)
|
||||
activesupport (= 4.0.13)
|
||||
builder (~> 3.1.0)
|
||||
activerecord (4.0.11)
|
||||
activemodel (= 4.0.11)
|
||||
activerecord (4.0.13)
|
||||
activemodel (= 4.0.13)
|
||||
activerecord-deprecated_finders (~> 1.0.2)
|
||||
activesupport (= 4.0.11)
|
||||
activesupport (= 4.0.13)
|
||||
arel (~> 4.0.0)
|
||||
activerecord-deprecated_finders (1.0.3)
|
||||
activesupport (4.0.11)
|
||||
activesupport (4.0.13)
|
||||
i18n (~> 0.6, >= 0.6.9)
|
||||
minitest (~> 4.2)
|
||||
multi_json (~> 1.3)
|
||||
|
@ -123,7 +123,7 @@ GEM
|
|||
capistrano_colors (0.5.5)
|
||||
charlock_holmes (0.7.3)
|
||||
chronic (0.10.2)
|
||||
chunky_png (1.3.3)
|
||||
chunky_png (1.3.4)
|
||||
climate_control (0.0.3)
|
||||
activesupport (>= 3.0)
|
||||
cocaine (0.5.5)
|
||||
|
@ -137,7 +137,7 @@ GEM
|
|||
coffee-script (2.3.0)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.9.0)
|
||||
coffee-script-source (1.9.1)
|
||||
compass (1.0.3)
|
||||
chunky_png (~> 1.2)
|
||||
compass-core (~> 1.0.2)
|
||||
|
@ -174,10 +174,10 @@ GEM
|
|||
eventmachine (1.0.5)
|
||||
execjs (2.3.0)
|
||||
expression_parser (0.9.0)
|
||||
factory_girl (4.4.0)
|
||||
factory_girl (4.5.0)
|
||||
activesupport (>= 3.0.0)
|
||||
factory_girl_rails (4.4.1)
|
||||
factory_girl (~> 4.4.0)
|
||||
factory_girl_rails (4.5.0)
|
||||
factory_girl (~> 4.5.0)
|
||||
railties (>= 3.0.0)
|
||||
faraday (0.9.1)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
|
@ -237,7 +237,7 @@ GEM
|
|||
has_scope (~> 0.6.0.rc)
|
||||
railties (>= 3.2, < 5)
|
||||
responders
|
||||
jbuilder (2.2.6)
|
||||
jbuilder (2.2.7)
|
||||
activesupport (>= 3.0.0, < 5)
|
||||
multi_json (~> 1.2)
|
||||
jquery-migrate-rails (1.2.1)
|
||||
|
@ -298,7 +298,7 @@ GEM
|
|||
net-ssh-gateway (1.2.0)
|
||||
net-ssh (>= 2.6.5)
|
||||
netrc (0.10.2)
|
||||
newrelic_rpm (3.9.9.275)
|
||||
newrelic_rpm (3.10.0.279)
|
||||
ng-rails-csrf (0.1.0)
|
||||
ngmin-rails (0.4.0)
|
||||
rails (>= 3.1)
|
||||
|
@ -341,7 +341,7 @@ GEM
|
|||
pg (0.17.1)
|
||||
polyamorous (1.1.0)
|
||||
activerecord (>= 3.0)
|
||||
posix-spawn (0.3.9)
|
||||
posix-spawn (0.3.10)
|
||||
protected_attributes (1.0.8)
|
||||
activemodel (>= 4.0.1, < 5.0)
|
||||
puma (2.11.1)
|
||||
|
@ -358,21 +358,21 @@ GEM
|
|||
rack (>= 1.0)
|
||||
rack-throttle (0.3.0)
|
||||
rack (>= 1.0.0)
|
||||
rails (4.0.11)
|
||||
actionmailer (= 4.0.11)
|
||||
actionpack (= 4.0.11)
|
||||
activerecord (= 4.0.11)
|
||||
activesupport (= 4.0.11)
|
||||
rails (4.0.13)
|
||||
actionmailer (= 4.0.13)
|
||||
actionpack (= 4.0.13)
|
||||
activerecord (= 4.0.13)
|
||||
activesupport (= 4.0.13)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.0.11)
|
||||
railties (= 4.0.13)
|
||||
sprockets-rails (~> 2.0)
|
||||
rails3-generators (1.0.0)
|
||||
railties (>= 3.0.0)
|
||||
rails3-jquery-autocomplete (1.0.15)
|
||||
rails (>= 3.2)
|
||||
railties (4.0.11)
|
||||
actionpack (= 4.0.11)
|
||||
activesupport (= 4.0.11)
|
||||
railties (4.0.13)
|
||||
actionpack (= 4.0.13)
|
||||
activesupport (= 4.0.13)
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rake (10.4.2)
|
||||
|
@ -429,18 +429,23 @@ GEM
|
|||
netrc (~> 0.7)
|
||||
rouge (1.3.4)
|
||||
rr (1.1.2)
|
||||
rspec-core (2.14.8)
|
||||
rspec-expectations (2.14.5)
|
||||
diff-lcs (>= 1.1.3, < 2.0)
|
||||
rspec-mocks (2.14.6)
|
||||
rspec-rails (2.14.2)
|
||||
actionpack (>= 3.0)
|
||||
activemodel (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
railties (>= 3.0)
|
||||
rspec-core (~> 2.14.0)
|
||||
rspec-expectations (~> 2.14.0)
|
||||
rspec-mocks (~> 2.14.0)
|
||||
rspec-core (3.2.0)
|
||||
rspec-support (~> 3.2.0)
|
||||
rspec-expectations (3.2.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.2.0)
|
||||
rspec-mocks (3.2.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.2.0)
|
||||
rspec-rails (3.2.0)
|
||||
actionpack (>= 3.0, <= 4.2)
|
||||
activesupport (>= 3.0, <= 4.2)
|
||||
railties (>= 3.0, <= 4.2)
|
||||
rspec-core (~> 3.2.0)
|
||||
rspec-expectations (~> 3.2.0)
|
||||
rspec-mocks (~> 3.2.0)
|
||||
rspec-support (~> 3.2.0)
|
||||
rspec-support (3.2.1)
|
||||
ruby-haml-js (0.0.5)
|
||||
execjs
|
||||
sprockets (>= 2.0.0)
|
||||
|
@ -456,12 +461,12 @@ GEM
|
|||
safe_yaml (1.0.4)
|
||||
sanitize (2.1.0)
|
||||
nokogiri (>= 1.4.4)
|
||||
sass (3.4.11)
|
||||
sass (3.4.12)
|
||||
sass-rails (4.0.1)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
sass (>= 3.1.10)
|
||||
sprockets-rails (~> 2.0.0)
|
||||
schema_plus (1.8.6)
|
||||
schema_plus (1.8.7)
|
||||
activerecord (>= 3.2, < 4.3)
|
||||
valuable
|
||||
scrivener (0.0.3)
|
||||
|
@ -579,7 +584,7 @@ DEPENDENCIES
|
|||
creole
|
||||
devise (~> 3.3)
|
||||
diff-display (~> 0.0.1)
|
||||
factory_girl_rails (~> 4.4.1)
|
||||
factory_girl_rails
|
||||
ffi (~> 1.9.3)
|
||||
font-awesome-rails (~> 4.2)
|
||||
friendly_id (~> 5.0)
|
||||
|
@ -599,7 +604,7 @@ DEPENDENCIES
|
|||
mailcatcher
|
||||
meta-tags (~> 2.0)
|
||||
meta_request
|
||||
mock_redis (~> 0.11)
|
||||
mock_redis
|
||||
momentjs-rails
|
||||
newrelic_rpm
|
||||
ng-rails-csrf
|
||||
|
@ -616,7 +621,7 @@ DEPENDENCIES
|
|||
protected_attributes
|
||||
puma
|
||||
rack-throttle (~> 0.3.0)
|
||||
rails (= 4.0.11)
|
||||
rails (= 4.0.13)
|
||||
rails3-generators
|
||||
rails3-jquery-autocomplete
|
||||
rake
|
||||
|
@ -628,8 +633,8 @@ DEPENDENCIES
|
|||
resque-status (~> 0.4)
|
||||
resque_mailer (~> 2.2)
|
||||
rest-client (~> 1.7)
|
||||
rr (~> 1.1.2)
|
||||
rspec-rails (~> 2.14.1)
|
||||
rr
|
||||
rspec-rails
|
||||
ruby-haml-js (~> 0.0.5)
|
||||
russian (~> 0.6.0)
|
||||
rvm-capistrano
|
||||
|
|
|
@ -10,6 +10,7 @@ module PersonalRepository
|
|||
pl = own_platforms.build
|
||||
pl.owner = self
|
||||
pl.name = "#{self.uname}_personal"
|
||||
pl.default_branch = pl.name
|
||||
pl.description = "#{self.uname}_personal"
|
||||
pl.platform_type = Platform::TYPE_PERSONAL
|
||||
pl.distrib_type = APP_CONFIG['distr_types'].first
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::BuildScriptsController do
|
||||
describe Admin::BuildScriptsController, type: :controller do
|
||||
it_should_behave_like 'an admin controller'
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::DashboardController do
|
||||
describe Admin::DashboardController, type: :controller do
|
||||
it_should_behave_like 'an admin controller'
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::EventLogsController do
|
||||
describe Admin::EventLogsController, type: :controller do
|
||||
it_should_behave_like 'an admin controller'
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::FlashNotifiesController do
|
||||
describe Admin::FlashNotifiesController, type: :controller do
|
||||
it_should_behave_like 'an admin controller'
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::NodeInstructionsController do
|
||||
describe Admin::NodeInstructionsController, type: :controller do
|
||||
it_should_behave_like 'an admin controller'
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::RegisterRequestsController do
|
||||
describe Admin::RegisterRequestsController, type: :controller do
|
||||
it_should_behave_like 'an admin controller'
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::ResqueController do
|
||||
describe Admin::ResqueController, type: :controller do
|
||||
it_should_behave_like 'an admin controller'
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::UsersController do
|
||||
describe Admin::UsersController, type: :controller do
|
||||
it_should_behave_like 'an admin controller'
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe AdvisoriesController do
|
||||
describe AdvisoriesController, type: :controller do
|
||||
context 'for all' do
|
||||
it "should be able to perform search action" do
|
||||
get :search
|
||||
|
|
|
@ -80,7 +80,7 @@ shared_examples_for 'api advisories user without admin rights' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Api::V1::AdvisoriesController do
|
||||
describe Api::V1::AdvisoriesController, type: :controller do
|
||||
|
||||
before do
|
||||
stub_symlink_methods
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Api::V1::ArchesController do
|
||||
describe Api::V1::ArchesController, type: :controller do
|
||||
|
||||
before { FactoryGirl.create(:arch) }
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ shared_examples_for 'validation error via build list api' do |message|
|
|||
end
|
||||
end
|
||||
|
||||
describe Api::V1::BuildListsController do
|
||||
describe Api::V1::BuildListsController, type: :controller do
|
||||
before do
|
||||
stub_symlink_methods
|
||||
allow_any_instance_of(BuildList).to receive(:valid_branch_for_publish?).and_return(true)
|
||||
|
@ -468,7 +468,7 @@ describe Api::V1::BuildListsController do
|
|||
|
||||
context "do reject_publish" do
|
||||
before do
|
||||
any_instance_of(BuildList, current_duration: 100)
|
||||
allow_any_instance_of(BuildList).to receive(:current_duration).and_return(100)
|
||||
@build_list.save_to_repository.update_column(:publish_without_qa, false)
|
||||
end
|
||||
|
||||
|
@ -636,7 +636,7 @@ describe Api::V1::BuildListsController do
|
|||
# Create and show params:
|
||||
@create_params = {build_list: @build_list.attributes.symbolize_keys}
|
||||
@create_params = @create_params.merge(arches: [@params[:arch_id]], build_for_platform_id: @platform.id, format: :json)
|
||||
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
|
||||
allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0))
|
||||
|
||||
# Groups:
|
||||
@owner_group = FactoryGirl.create(:group, owner: @owner_user)
|
||||
|
|
|
@ -175,7 +175,7 @@ shared_examples_for 'api group user without owner rights' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Api::V1::GroupsController do
|
||||
describe Api::V1::GroupsController, type: :controller do
|
||||
before do
|
||||
stub_symlink_methods
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Api::V1::IssuesController do
|
||||
describe Api::V1::IssuesController, type: :controller do
|
||||
before do
|
||||
stub_symlink_methods
|
||||
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
|
||||
allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0))
|
||||
|
||||
@project = FactoryGirl.create(:project_with_commit)
|
||||
@issue = FactoryGirl.create(:issue, project: @project)
|
||||
|
@ -79,7 +79,7 @@ describe Api::V1::IssuesController do
|
|||
it 'should return only assigned issue' do
|
||||
get :user_index, format: :json
|
||||
assigns[:issues].should include(@own_hidden_issue)
|
||||
assigns[:issues].should have(1).item
|
||||
expect(assigns[:issues].count).to eq 1
|
||||
end
|
||||
|
||||
it 'should render right template for user index action' do
|
||||
|
|
|
@ -8,19 +8,19 @@ shared_examples_for 'api maintainers user with reader rights' do
|
|||
|
||||
it 'loads all of the maintainers into @maintainers' do
|
||||
get :index, platform_id: package.platform_id, format: :json
|
||||
assigns(:maintainers).should have(2).items
|
||||
expect(assigns(:maintainers).count).to eq 2
|
||||
assigns(:maintainers).should include(package, package2)
|
||||
end
|
||||
|
||||
it 'loads all of the maintainers into @maintainers when search by name' do
|
||||
get :index, platform_id: package.platform_id, package_name: 'package1', format: :json
|
||||
assigns(:maintainers).should have(1).item
|
||||
expect(assigns(:maintainers).count).to eq 1
|
||||
assigns(:maintainers).should include(package)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe Api::V1::MaintainersController do
|
||||
describe Api::V1::MaintainersController, type: :controller do
|
||||
before do
|
||||
stub_symlink_methods
|
||||
FactoryGirl.create(:build_list_package, platform: package.platform)
|
||||
|
|
|
@ -44,7 +44,7 @@ shared_examples_for 'api platform user with owner rights' do
|
|||
response.should_not be_success
|
||||
end
|
||||
it 'ensures that personal platform has not been destroyed' do
|
||||
lambda { delete :destroy, id: @personal_platform.id, format: :json }.should_not change{ Platform.count }
|
||||
lambda { delete :destroy, id: @personal_platform.id, format: :json }.should change{ Platform.count }.by(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -168,7 +168,7 @@ shared_examples_for 'api platform user without global admin rights' do
|
|||
response.should_not be_success
|
||||
end
|
||||
it "ensures that platform has not been #{action}d" do
|
||||
lambda { post action, clone_or_create_params }.should_not change{ Platform.count }
|
||||
lambda { post action, clone_or_create_params }.should change{ Platform.count }.by(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -207,11 +207,11 @@ shared_examples_for "api platform user with show rights" do
|
|||
end
|
||||
end
|
||||
|
||||
describe Api::V1::PlatformsController do
|
||||
describe Api::V1::PlatformsController, type: :controller do
|
||||
let(:clone_or_create_params) do
|
||||
{ id: @platform.id,
|
||||
platform: { description: 'new description', name: 'new_name',
|
||||
owner_id: @user.id, distrib_type: APP_CONFIG['distr_types'].first }, format: :json }
|
||||
owner_id: @user.id, distrib_type: APP_CONFIG['distr_types'].first, default_branch: 'new_name' }, format: :json }
|
||||
end
|
||||
before do
|
||||
stub_symlink_methods
|
||||
|
|
|
@ -103,7 +103,7 @@ shared_examples_for 'api user with admin rights' do
|
|||
it "ensures that only not_delete field of product build list has been updated" do
|
||||
put :update, @update_params.merge(id: @product_build_list.id), format: :json
|
||||
@product_build_list.reload.time_living.should == 150*60 # in seconds
|
||||
@product_build_list.not_delete.should be_true
|
||||
@product_build_list.not_delete.should be_truthy
|
||||
end
|
||||
|
||||
it 'ensures that return correct answer for wrong creating action' do
|
||||
|
@ -112,7 +112,7 @@ shared_examples_for 'api user with admin rights' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Api::V1::ProductBuildListsController do
|
||||
describe Api::V1::ProductBuildListsController, type: :controller do
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
FactoryGirl.create(:arch, name: 'x86_64')
|
||||
|
|
|
@ -114,7 +114,7 @@ shared_examples_for 'api user with admin rights' do
|
|||
#end
|
||||
end
|
||||
|
||||
describe Api::V1::ProductsController do
|
||||
describe Api::V1::ProductsController, type: :controller do
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
|
||||
|
|
|
@ -276,7 +276,7 @@ shared_examples_for 'api projects user without owner rights' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Api::V1::ProjectsController do
|
||||
describe Api::V1::ProjectsController, type: :controller do
|
||||
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
|
|
|
@ -8,7 +8,7 @@ def create_pull to_ref, from_ref, owner, project = @project
|
|||
pull
|
||||
end
|
||||
|
||||
describe Api::V1::PullRequestsController do
|
||||
describe Api::V1::PullRequestsController, type: :controller do
|
||||
before(:all) do
|
||||
stub_symlink_methods
|
||||
|
||||
|
@ -87,7 +87,7 @@ describe Api::V1::PullRequestsController do
|
|||
it 'should return only assigned pull request' do
|
||||
get :user_index, format: :json
|
||||
assigns[:pulls].should include(@own_hidden_pull)
|
||||
assigns[:pulls].should have(1).item
|
||||
expect(assigns[:pulls].count).to eq 1
|
||||
end
|
||||
|
||||
it 'should render right template for user index action' do
|
||||
|
|
|
@ -298,7 +298,7 @@ shared_examples_for 'api repository user without project manage rights' do
|
|||
end
|
||||
|
||||
|
||||
describe Api::V1::RepositoriesController do
|
||||
describe Api::V1::RepositoriesController, type: :controller do
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ shared_examples_for 'not able search with api' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Api::V1::SearchController do
|
||||
describe Api::V1::SearchController, type: :controller do
|
||||
before { stub_symlink_methods }
|
||||
|
||||
context 'as guest' do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Api::V1::UsersController do
|
||||
describe Api::V1::UsersController, type: :controller do
|
||||
before(:all) { User.destroy_all }
|
||||
before do
|
||||
stub_symlink_methods
|
||||
|
@ -44,7 +44,7 @@ describe Api::V1::UsersController do
|
|||
it { response.should_not be_success }
|
||||
it 'ensures that user notification settings have not been updated' do
|
||||
@user.reload
|
||||
@user.notifier.can_notify.should be_true
|
||||
@user.notifier.can_notify.should be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -85,7 +85,7 @@ describe Api::V1::UsersController do
|
|||
it { response.should be_success }
|
||||
it 'ensures that user notification settings have been updated' do
|
||||
@user.reload
|
||||
@user.notifier.can_notify.should be_false
|
||||
@user.notifier.can_notify.should be_falsy
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe AutocompletesController do
|
||||
describe AutocompletesController, type: :controller do
|
||||
before {stub_symlink_methods}
|
||||
|
||||
context 'for user' do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Groups::MembersController do
|
||||
describe Groups::MembersController, type: :controller do
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
@group = FactoryGirl.create(:group)
|
||||
|
|
|
@ -68,7 +68,7 @@ shared_examples_for 'group owner' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Groups::ProfileController do
|
||||
describe Groups::ProfileController, type: :controller do
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
@group = FactoryGirl.create(:group)
|
||||
|
|
|
@ -56,7 +56,7 @@ shared_examples_for 'content platform user with member rights' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Platforms::ContentsController do
|
||||
describe Platforms::ContentsController, type: :controller do
|
||||
before do
|
||||
stub_symlink_methods
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ shared_examples_for 'key_pair platform reader' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Platforms::KeyPairsController do
|
||||
describe Platforms::KeyPairsController, type: :controller do
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ shared_examples_for 'guest user' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Platforms::MaintainersController do
|
||||
describe Platforms::MaintainersController, type: :controller do
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ shared_examples_for 'mass_build platform reader' do
|
|||
end
|
||||
|
||||
|
||||
describe Platforms::MassBuildsController do
|
||||
describe Platforms::MassBuildsController, type: :controller do
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ shared_examples_for 'platform user with owner rights' do
|
|||
response.should_not be_success
|
||||
end
|
||||
it 'ensures that personal platform has not been destroyed' do
|
||||
lambda { delete :destroy, id: @personal_platform.id }.should_not change{ Platform.count }
|
||||
lambda { delete :destroy, id: @personal_platform.id }.should change{ Platform.count }.by(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -248,8 +248,8 @@ shared_examples_for 'platform user with show rights' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Platforms::PlatformsController do
|
||||
let(:clone_or_create_params) { {id: @platform.id, platform: {description: 'new description', name: 'new_name', owner_id: @user.id, distrib_type: APP_CONFIG['distr_types'].first}} }
|
||||
describe Platforms::PlatformsController, type: :controller do
|
||||
let(:clone_or_create_params) { {id: @platform.id, platform: {description: 'new description', name: 'new_name', owner_id: @user.id, distrib_type: APP_CONFIG['distr_types'].first, default_branch: 'new_name'}} }
|
||||
before do
|
||||
stub_symlink_methods
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ shared_examples_for 'product build list admin' do
|
|||
put :update, valid_attributes_for_show.merge(product_build_list: {time_living: 100,not_delete: true})
|
||||
time_living = @pbl.time_living
|
||||
@pbl.reload.time_living.should == time_living
|
||||
@pbl.not_delete.should be_true
|
||||
@pbl.not_delete.should be_truthy
|
||||
end
|
||||
|
||||
it 'should be able to perform log action' do
|
||||
|
@ -98,7 +98,7 @@ shared_examples_for 'product build list user' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Platforms::ProductBuildListsController do
|
||||
describe Platforms::ProductBuildListsController, type: :controller do
|
||||
before(:each) { stub_symlink_methods }
|
||||
|
||||
context 'crud' do
|
||||
|
|
|
@ -21,7 +21,7 @@ shared_examples_for 'admin user' do
|
|||
|
||||
end
|
||||
|
||||
describe Platforms::ProductsController do
|
||||
describe Platforms::ProductsController, type: :controller do
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ shared_examples_for 'user without change projects in repository rights' do
|
|||
it 'should not be able to perform regenerate_metadata action' do
|
||||
put :regenerate_metadata, id: @repository, platform_id: @platform
|
||||
response.should redirect_to(redirect_path)
|
||||
@repository.repository_statuses.should have(:no).items
|
||||
expect(@repository.repository_statuses.count).to eq 0
|
||||
end
|
||||
|
||||
it 'should not be able to remove project from repository' do
|
||||
|
@ -64,13 +64,13 @@ shared_examples_for 'registered user or guest' do
|
|||
it 'should not be able to perform regenerate_metadata action' do
|
||||
put :regenerate_metadata, id: @repository, platform_id: @platform
|
||||
response.should redirect_to(redirect_path)
|
||||
@repository.repository_statuses.should have(:no).items
|
||||
expect(@repository.repository_statuses.count).to eq 0
|
||||
end
|
||||
|
||||
it 'should not be able to perform regenerate_metadata action of personal repository' do
|
||||
put :regenerate_metadata, id: @personal_repository, platform_id: @personal_repository.platform
|
||||
response.should redirect_to(redirect_path)
|
||||
@personal_repository.repository_statuses.should have(:no).items
|
||||
expect(@personal_repository.repository_statuses.count).to eq 0
|
||||
end
|
||||
|
||||
it 'should not be able to perform create action' do
|
||||
|
@ -108,7 +108,7 @@ shared_examples_for 'registered user or guest' do
|
|||
it 'should not be able to destroy repository in main platform' do
|
||||
delete :destroy, id: @repository, platform_id: @platform
|
||||
response.should redirect_to(redirect_path)
|
||||
lambda { delete :destroy, id: @repository, platform_id: @platform }.should_not change{ Repository.count }.by(-1)
|
||||
lambda { delete :destroy, id: @repository, platform_id: @platform }.should change{ Repository.count }.by(0)
|
||||
end
|
||||
|
||||
it 'should not be able to destroy personal repository' do
|
||||
|
@ -150,20 +150,20 @@ shared_examples_for 'platform admin user' do
|
|||
put :regenerate_metadata, id: @repository, platform_id: @platform
|
||||
response.should redirect_to(platform_repository_path(@platform, @repository))
|
||||
@repository.repository_statuses.find_by(platform_id: @platform).
|
||||
waiting_for_regeneration?.should be_true
|
||||
waiting_for_regeneration?.should be_truthy
|
||||
end
|
||||
|
||||
it 'should be able to perform regenerate_metadata action of personal repository' do
|
||||
put :regenerate_metadata, id: @personal_repository, platform_id: @personal_repository.platform, build_for_platform_id: @platform.id
|
||||
response.should redirect_to(platform_repository_path(@personal_repository.platform, @personal_repository))
|
||||
@personal_repository.repository_statuses.find_by(platform_id: @platform).
|
||||
waiting_for_regeneration?.should be_true
|
||||
waiting_for_regeneration?.should be_truthy
|
||||
end
|
||||
|
||||
it 'should not be able to perform regenerate_metadata action of personal repository when build_for_platform does not exist' do
|
||||
put :regenerate_metadata, id: @personal_repository, platform_id: @personal_repository.platform
|
||||
response.should render_template(file: "#{Rails.root}/public/404.html")
|
||||
@personal_repository.repository_statuses.should have(:no).items
|
||||
expect(@personal_repository.repository_statuses.count).to eq 0
|
||||
end
|
||||
|
||||
it 'should be able to create repository' do
|
||||
|
@ -215,7 +215,7 @@ shared_examples_for 'platform admin user' do
|
|||
it_should_behave_like 'user with change projects in repository rights'
|
||||
end
|
||||
|
||||
describe Platforms::RepositoriesController do
|
||||
describe Platforms::RepositoriesController, type: :controller do
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ shared_examples_for 'token of platform for simple user or guest' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Platforms::TokensController do
|
||||
describe Platforms::TokensController, type: :controller do
|
||||
before do
|
||||
stub_symlink_methods
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Projects::BuildListsController do
|
||||
describe Projects::BuildListsController, type: :controller do
|
||||
|
||||
shared_examples_for 'show build list' do
|
||||
it 'should be able to perform show action' do
|
||||
|
@ -92,7 +92,7 @@ describe Projects::BuildListsController do
|
|||
arches: [FactoryGirl.create(:arch).id],
|
||||
build_for_platforms: [@platform.id]
|
||||
}
|
||||
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
|
||||
allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0))
|
||||
end
|
||||
|
||||
context 'for guest' do
|
||||
|
@ -110,7 +110,7 @@ describe Projects::BuildListsController do
|
|||
|
||||
context 'for user' do
|
||||
before do
|
||||
any_instance_of(BuildList, current_duration: 100)
|
||||
allow_any_instance_of(BuildList).to receive(:current_duration).and_return(100)
|
||||
@build_list = FactoryGirl.create(:build_list)
|
||||
@project = @build_list.project
|
||||
@owner_user = @project.owner
|
||||
|
|
|
@ -44,12 +44,12 @@ shared_examples_for 'project admin user' do
|
|||
|
||||
it 'should add new collaborator with reader role' do
|
||||
post :create, @create_params.merge(collaborator: @user_params)
|
||||
@project.relations.exists?(actor_type: 'User', actor_id: @another_user.id, role: 'reader').should be_true
|
||||
@project.relations.exists?(actor_type: 'User', actor_id: @another_user.id, role: 'reader').should be_truthy
|
||||
end
|
||||
|
||||
it 'should add new group with reader role' do
|
||||
post :create, @create_params.merge(collaborator: @group_params)
|
||||
@project.relations.exists?(actor_type: 'Group', actor_id: @group.id, role: 'reader').should be_true
|
||||
@project.relations.exists?(actor_type: 'Group', actor_id: @group.id, role: 'reader').should be_truthy
|
||||
end
|
||||
|
||||
it 'should be able to set reader role for any user' do
|
||||
|
@ -75,7 +75,7 @@ shared_examples_for 'user with no rights for this project' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Projects::CollaboratorsController do
|
||||
describe Projects::CollaboratorsController, type: :controller do
|
||||
include_context "collaborators controller"
|
||||
|
||||
context 'for guest' do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Projects::CommentsController do
|
||||
describe Projects::CommentsController, type: :controller do
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
@project = FactoryGirl.create(:project_with_commit)
|
||||
|
@ -10,7 +10,8 @@ describe Projects::CommentsController do
|
|||
commit_id: @commit.id, format: :json }
|
||||
@update_params = { comment: { body: 'updated' }, name_with_owner: @project.name_with_owner, commit_id: @commit.id }
|
||||
|
||||
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
|
||||
allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0))
|
||||
|
||||
@comment = FactoryGirl.create(:comment, commentable: @commit, project: @project)
|
||||
@user = FactoryGirl.create(:user)
|
||||
@own_comment = FactoryGirl.create(:comment, commentable: @commit, user: @user, project: @project)
|
||||
|
|
|
@ -21,7 +21,7 @@ shared_context "comments controller" do
|
|||
|
||||
end
|
||||
|
||||
describe Projects::CommentsController do
|
||||
describe Projects::CommentsController, type: :controller do
|
||||
include_context "comments controller"
|
||||
|
||||
context 'for global admin user' do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Projects::Git::TreesController do
|
||||
describe Projects::Git::TreesController, type: :controller do
|
||||
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
|
|
|
@ -54,7 +54,7 @@ shared_examples_for 'hooks user without project admin rights' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Projects::HooksController do
|
||||
describe Projects::HooksController, type: :controller do
|
||||
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
|
|
|
@ -86,7 +86,7 @@ shared_examples_for 'issue user with project writer rights' do
|
|||
end
|
||||
|
||||
it 'label should be attached to issue' do
|
||||
@project.issues.last.labels.should have(1).item
|
||||
expect(@project.issues.last.labels.count).to eq 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -138,7 +138,7 @@ shared_examples_for 'project with issues turned off' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Projects::IssuesController do
|
||||
describe Projects::IssuesController, type: :controller do
|
||||
include_context "issues controller"
|
||||
|
||||
context 'for global admin user' do
|
||||
|
@ -201,7 +201,7 @@ describe Projects::IssuesController do
|
|||
end
|
||||
|
||||
it 'label should not be attached to issue' do
|
||||
@project.issues.last.labels.should have(:no).items
|
||||
expect(@project.issues.last.labels.count).to eq 0
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ shared_examples_for 'projects user without project admin rights' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Projects::ProjectsController do
|
||||
describe Projects::ProjectsController, type: :controller do
|
||||
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
|
|
|
@ -160,7 +160,7 @@ shared_examples_for 'pull request when project with issues turned off' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Projects::PullRequestsController do
|
||||
describe Projects::PullRequestsController, type: :controller do
|
||||
include_context "pull request controller"
|
||||
|
||||
context 'for global admin user' do
|
||||
|
|
|
@ -46,7 +46,7 @@ shared_examples_for 'can not unsubscribe' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Projects::SubscribesController do
|
||||
describe Projects::SubscribesController, type: :controller do
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
|
||||
|
@ -56,7 +56,7 @@ describe Projects::SubscribesController do
|
|||
@create_params = { issue_id: @issue.serial_id, name_with_owner: @project.name_with_owner }
|
||||
@destroy_params = { issue_id: @issue.serial_id, name_with_owner: @project.name_with_owner }
|
||||
|
||||
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
|
||||
allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0))
|
||||
|
||||
@request.env['HTTP_REFERER'] = project_issue_path(@project, @issue)
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Projects::WikiController do
|
||||
describe Projects::WikiController, type: :controller do
|
||||
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ shared_examples_for 'not able search' do
|
|||
end
|
||||
end
|
||||
|
||||
describe SearchController do
|
||||
describe SearchController, type: :controller do
|
||||
before { stub_symlink_methods }
|
||||
|
||||
context 'as guest' do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe SitemapController do
|
||||
describe SitemapController, type: :controller do
|
||||
describe 'robots' do
|
||||
|
||||
it 'is successful' do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Users::ProfileController do
|
||||
describe Users::ProfileController, type: :controller do
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
FactoryGirl.define do
|
||||
factory :platform do
|
||||
name { FactoryGirl.generate(:unixname) }
|
||||
default_branch { |p| p.name }
|
||||
description { FactoryGirl.generate(:string) }
|
||||
platform_type 'main'
|
||||
distrib_type APP_CONFIG['distr_types'].first
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
FactoryGirl.define do
|
||||
factory :rpm_build_node do
|
||||
id { FactoryGirl.generate(:string) }
|
||||
# id { FactoryGirl.generate(:string) }
|
||||
user_id { FactoryGirl.create(:user).id }
|
||||
before(:build) do |n|
|
||||
n.send :id=, FactoryGirl.generate(:string)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ApiDefender do
|
||||
describe ApiDefender, type: :request do
|
||||
def get_basic_auth user = @user, by_token = false, by_email = false
|
||||
u,pass = if by_token
|
||||
[user.authentication_token, '']
|
||||
|
|
|
@ -32,7 +32,7 @@ describe RestartNodesJob do
|
|||
|
||||
RestartNodesJob.perform
|
||||
|
||||
NodeInstruction.where(status: NodeInstruction::RESTARTING).should have(2).items
|
||||
expect(NodeInstruction.where(status: NodeInstruction::RESTARTING).count).to eq 2
|
||||
NodeInstruction.where(status: NodeInstruction::RESTARTING).should include(ni2, ni3)
|
||||
NodeInstruction.where(status: NodeInstruction::RESTARTING).should_not include(ni1)
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ describe UserMailer do
|
|||
@project = FactoryGirl.create(:project)
|
||||
@issue_user = FactoryGirl.create(:user)
|
||||
|
||||
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
|
||||
allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0))
|
||||
|
||||
@issue = FactoryGirl.create(:issue, project: @project, assignee: @issue_user, user: @issue_user)
|
||||
@email = UserMailer.new_issue_notification(@issue, @issue_user).deliver!
|
||||
|
@ -44,7 +44,7 @@ describe UserMailer do
|
|||
@issue_user = FactoryGirl.create(:user)
|
||||
@user = FactoryGirl.create(:user)
|
||||
|
||||
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
|
||||
allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0))
|
||||
|
||||
@issue = FactoryGirl.create(:issue, project_id: @project.id, assignee_id: @issue_user.id, user: @issue_user)
|
||||
@email = UserMailer.issue_assign_notification(@issue, @user).deliver!
|
||||
|
@ -76,7 +76,7 @@ describe UserMailer do
|
|||
@issue_user = FactoryGirl.create(:user)
|
||||
@user = FactoryGirl.create(:user)
|
||||
|
||||
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
|
||||
allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0))
|
||||
|
||||
@issue = FactoryGirl.create(:issue, project: @project, assignee: @issue_user, user: @issue_user)
|
||||
@comment = FactoryGirl.create(:comment, commentable: @issue, user: @user, project: @project)
|
||||
|
|
|
@ -30,7 +30,7 @@ describe Advisory do
|
|||
it_should_behave_like 'attach advisory to build_list'
|
||||
|
||||
it 'ensure that advisory has been created' do
|
||||
Advisory.should have(1).item
|
||||
expect(Advisory.count).to eq 1
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@ describe BuildList do
|
|||
context 'validates that repository contains project' do
|
||||
it 'when repository contains project' do
|
||||
bl = FactoryGirl.build(:build_list)
|
||||
bl.valid?.should be_true
|
||||
bl.valid?.should be_truthy
|
||||
end
|
||||
it 'when repository does not contain project' do
|
||||
bl = FactoryGirl.build(:build_list)
|
||||
bl.project.repositories = []
|
||||
bl.valid?.should be_false
|
||||
bl.valid?.should be_falsy
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -65,61 +65,61 @@ describe BuildList do
|
|||
shared_examples_for 'build list notifications by email' do
|
||||
it "gets notification by email when status - Build complete" do
|
||||
build_list.build_success
|
||||
should have(1).item
|
||||
expect(subject.count).to eq 1
|
||||
end
|
||||
|
||||
it "gets notification by email when status - Build error" do
|
||||
build_list.build_error
|
||||
should have(1).item
|
||||
expect(subject.count).to eq 1
|
||||
end
|
||||
|
||||
it "gets notification by email when status - Unpermitted architecture" do
|
||||
build_list.unpermitted_arch
|
||||
should have(1).item
|
||||
expect(subject.count).to eq 1
|
||||
end
|
||||
|
||||
it "gets notification by email when auto_publish and status - Build error" do
|
||||
build_list.auto_publish_status = BuildList::AUTO_PUBLISH_STATUS_DEFAULT
|
||||
build_list.build_error
|
||||
should have(1).item
|
||||
expect(subject.count).to eq 1
|
||||
end
|
||||
|
||||
it "gets notification by email when status - Failed publish" do
|
||||
build_list.status = BuildList::BUILD_PUBLISH
|
||||
build_list.fail_publish
|
||||
should have(1).item
|
||||
expect(subject.count).to eq 1
|
||||
end
|
||||
|
||||
it "gets notification by email when auto_publish and status - Failed publish" do
|
||||
build_list.auto_publish_status = BuildList::AUTO_PUBLISH_STATUS_DEFAULT
|
||||
build_list.status = BuildList::BUILD_PUBLISH
|
||||
build_list.fail_publish
|
||||
should have(1).item
|
||||
expect(subject.count).to eq 1
|
||||
end
|
||||
|
||||
it "gets notification by email when status - Build published" do
|
||||
build_list.status = BuildList::BUILD_PUBLISH
|
||||
build_list.published
|
||||
should have(1).item
|
||||
expect(subject.count).to eq 1
|
||||
end
|
||||
|
||||
it "gets notification by email when auto_publish and status - Build published" do
|
||||
build_list.auto_publish_status = BuildList::AUTO_PUBLISH_STATUS_DEFAULT
|
||||
build_list.status = BuildList::BUILD_PUBLISH
|
||||
build_list.published
|
||||
should have(1).item
|
||||
expect(subject.count).to eq 1
|
||||
end
|
||||
|
||||
it "doesn't get notification by email when auto_publish and status - Build complete" do
|
||||
build_list.auto_publish_status = BuildList::AUTO_PUBLISH_STATUS_DEFAULT
|
||||
build_list.build_success
|
||||
should have(:no).items
|
||||
expect(subject.count).to eq 0
|
||||
end
|
||||
|
||||
it "doesn't get notification by email when auto_publish_into_testing and status - Build complete" do
|
||||
build_list.auto_publish_status = BuildList::AUTO_PUBLISH_STATUS_TESTING
|
||||
build_list.build_success
|
||||
should have(:no).items
|
||||
expect(subject.count).to eq 0
|
||||
end
|
||||
|
||||
it "doesn't get notification by email when mass build" do
|
||||
|
@ -127,13 +127,13 @@ describe BuildList do
|
|||
build_list.mass_build_id = mb.id
|
||||
build_list.status = BuildList::BUILD_PUBLISH
|
||||
build_list.published
|
||||
should have(:no).items
|
||||
expect(subject.count).to eq 0
|
||||
end
|
||||
|
||||
it "doesn't get notification by email when notification by email has been disabled" do
|
||||
notifier.update_attributes(can_notify: false)
|
||||
build_list.build_success
|
||||
should have(:no).items
|
||||
expect(subject.count).to eq 0
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -151,14 +151,14 @@ describe BuildList do
|
|||
it "doesn't get notification by email when 'build list' notifications has been disabled" do
|
||||
allow(notifier).to receive(:new_build?).and_return(false)
|
||||
build_list.build_success
|
||||
should have(:no).items
|
||||
expect(subject.count).to eq 0
|
||||
end
|
||||
|
||||
it "doesn't get notification by email when 'build list' notifications - enabled, email notifications - disabled" do
|
||||
allow(notifier).to receive(:can_notify?).and_return(false)
|
||||
allow(notifier).to receive(:new_build?).and_return(true)
|
||||
build_list.build_success
|
||||
should have(:no).items
|
||||
expect(subject.count).to eq 0
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -174,13 +174,13 @@ describe BuildList do
|
|||
it "doesn't get notification by email when 'associated build list' notifications has been disabled" do
|
||||
notifier.update_attributes(new_associated_build: false)
|
||||
build_list.build_success
|
||||
should have(:no).items
|
||||
expect(subject.count).to eq 0
|
||||
end
|
||||
|
||||
it "doesn't get notification by email when 'associated build list' notifications - enabled, email notifications - disabled" do
|
||||
notifier.update_attributes(can_notify: false, new_associated_build: true)
|
||||
build_list.build_success
|
||||
should have(:no).items
|
||||
expect(subject.count).to eq 0
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -194,7 +194,7 @@ describe BuildList do
|
|||
bl.update_attributes({commit_hash: bl.project.repo.commits('master').last.id,
|
||||
status: BuildList::BUILD_PUBLISH}, without_protection: true)
|
||||
bl.published
|
||||
should have(1).item
|
||||
expect(subject.count).to eq 1
|
||||
end
|
||||
|
||||
end # notify_users
|
||||
|
@ -224,34 +224,34 @@ describe BuildList do
|
|||
|
||||
it 'ensures that return false if version of packages are same and platform is released' do
|
||||
build_list.save_to_platform.update_attributes(released: true)
|
||||
build_list.has_new_packages?.should be_false
|
||||
build_list.has_new_packages?.should be_falsy
|
||||
end
|
||||
|
||||
it 'ensures that return true if version of packages are same and platform RHEL is released' do
|
||||
build_list.save_to_platform.update_attributes(released: true, distrib_type: 'rhel')
|
||||
build_list.has_new_packages?.should be_true
|
||||
build_list.has_new_packages?.should be_truthy
|
||||
end
|
||||
|
||||
it 'ensures that return true if version of packages are same and platform is not released' do
|
||||
build_list.has_new_packages?.should be_true
|
||||
build_list.has_new_packages?.should be_truthy
|
||||
end
|
||||
|
||||
context 'ensures that return false if version of published package >' do
|
||||
|
||||
it 'published: 3.1.13, new: 3.1.12' do
|
||||
published_build_list_package.update_attributes(version: '3.1.13')
|
||||
build_list.has_new_packages?.should be_false
|
||||
build_list.has_new_packages?.should be_falsy
|
||||
end
|
||||
|
||||
it 'published: 3.1.12, new: 3.0.999' do
|
||||
build_list_package.update_attributes(version: '3.0.999')
|
||||
build_list.has_new_packages?.should be_false
|
||||
build_list.has_new_packages?.should be_falsy
|
||||
end
|
||||
|
||||
it 'published: 3.0.0, new: 3.0.rc1' do
|
||||
published_build_list_package.update_attributes(version: '3.0.0')
|
||||
build_list_package.update_attributes(version: '3.0.rc1')
|
||||
build_list.has_new_packages?.should be_false
|
||||
build_list.has_new_packages?.should be_falsy
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -260,25 +260,25 @@ describe BuildList do
|
|||
|
||||
it 'published: 3.1.11, new: 3.1.12' do
|
||||
published_build_list_package.update_attributes(version: '3.1.11')
|
||||
build_list.has_new_packages?.should be_true
|
||||
build_list.has_new_packages?.should be_truthy
|
||||
end
|
||||
|
||||
it 'published: 3.0.999, new: 3.1.12' do
|
||||
published_build_list_package.update_attributes(version: '3.0.999')
|
||||
build_list.has_new_packages?.should be_true
|
||||
build_list.has_new_packages?.should be_truthy
|
||||
end
|
||||
|
||||
it 'published: 3.0.rc1, new: 3.0.0' do
|
||||
published_build_list_package.update_attributes(version: '3.0.rc1')
|
||||
build_list_package.update_attributes(version: '3.0.0')
|
||||
build_list.has_new_packages?.should be_true
|
||||
build_list.has_new_packages?.should be_truthy
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
it 'ensures that return true if release of published package <' do
|
||||
published_build_list_package.update_attributes(release: 5)
|
||||
build_list.has_new_packages?.should be_true
|
||||
build_list.has_new_packages?.should be_truthy
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -292,22 +292,22 @@ describe BuildList do
|
|||
end
|
||||
|
||||
it 'returns true for eligible build' do
|
||||
expect(build_list.can_publish?).to be_true
|
||||
expect(build_list.can_publish?).to be_truthy
|
||||
end
|
||||
|
||||
it 'returns false if branch invalid' do
|
||||
allow(build_list).to receive(:valid_branch_for_publish?).and_return(false)
|
||||
expect(build_list.can_publish?).to be_false
|
||||
expect(build_list.can_publish?).to be_falsy
|
||||
end
|
||||
|
||||
it 'returns false if extra builds not published' do
|
||||
allow(build_list).to receive(:extra_build_lists_published?).and_return(false)
|
||||
expect(build_list.can_publish?).to be_false
|
||||
expect(build_list.can_publish?).to be_falsy
|
||||
end
|
||||
|
||||
it 'returns false if project does not exist in repository' do
|
||||
build_list.stub_chain(:save_to_repository, :projects, :exists?).and_return(false)
|
||||
expect(build_list.can_publish?).to be_false
|
||||
expect(build_list.can_publish?).to be_falsy
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -320,12 +320,12 @@ describe BuildList do
|
|||
|
||||
it 'returns true for eligible build' do
|
||||
allow(build_list).to receive(:valid_branch_for_publish?).and_return(true)
|
||||
expect(build_list.can_publish_into_testing?).to be_true
|
||||
expect(build_list.can_publish_into_testing?).to be_truthy
|
||||
end
|
||||
|
||||
it 'returns false if branch invalid' do
|
||||
allow(build_list).to receive(:valid_branch_for_publish?).and_return(false)
|
||||
expect(build_list.can_publish_into_testing?).to be_false
|
||||
expect(build_list.can_publish_into_testing?).to be_falsy
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ describe CanCan do
|
|||
end
|
||||
|
||||
it 'should manage all' do
|
||||
#(@ability.can? :manage, :all).should be_true
|
||||
#(@ability.can? :manage, :all).should be_truthy
|
||||
@ability.should be_able_to(:manage, :all)
|
||||
end
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ def set_comments_data_for_commit
|
|||
@subscribe_params = {project_id: @project.id, subscribeable_id: @commit.id.hex, subscribeable_type: @commit.class.name}
|
||||
Subscribe.destroy_all
|
||||
|
||||
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
|
||||
allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0))
|
||||
end
|
||||
|
||||
def should_send_email(args={})
|
||||
|
|
|
@ -10,7 +10,7 @@ def set_commentable_data
|
|||
@comment = FactoryGirl.create(:comment, commentable: @issue, user: @user, project: @project)
|
||||
@stranger_comment = FactoryGirl.create(:comment, commentable: @issue, user: @stranger, project: @project)
|
||||
|
||||
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
|
||||
allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0))
|
||||
end
|
||||
|
||||
def create_comment_in_issue issue, body
|
||||
|
@ -170,8 +170,8 @@ describe Comment do
|
|||
it 'should create automatic comment by issue title' do
|
||||
issue = FactoryGirl.create(:issue, project: @project, user: @user,
|
||||
title: "link to ##{@issue.serial_id}")
|
||||
Comment.where(automatic: true,
|
||||
created_from_issue_id: issue.id).should have(1).item
|
||||
expect(Comment.where(automatic: true,
|
||||
created_from_issue_id: issue.id).count).to eq 1
|
||||
end
|
||||
|
||||
it 'should create automatic comment from issue body' do
|
||||
|
|
|
@ -14,7 +14,7 @@ end
|
|||
describe Issue do
|
||||
before do
|
||||
stub_symlink_methods
|
||||
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
|
||||
allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0))
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ describe KeyPair do
|
|||
describe 'check_keys validation' do
|
||||
subject { FactoryGirl.build(:key_pair) }
|
||||
|
||||
it { subject.valid?.should be_true }
|
||||
it { subject.valid?.should be_truthy }
|
||||
it 'checks error when wrong public key' do
|
||||
subject.public = 'test'
|
||||
subject.valid?
|
||||
|
|
|
@ -6,7 +6,7 @@ describe MassBuild do
|
|||
context 'ensures that validations and associations exist' do
|
||||
|
||||
it 'is valid given valid attributes' do
|
||||
FactoryGirl.create(:mass_build).should be_true
|
||||
FactoryGirl.create(:mass_build).should be_truthy
|
||||
end
|
||||
|
||||
it { should belong_to(:build_for_platform) }
|
||||
|
@ -37,7 +37,7 @@ describe MassBuild do
|
|||
mass_build = FactoryGirl.build(:mass_build, projects_list: projects_list)
|
||||
mass_build.should be_valid
|
||||
list = mass_build.projects_list.split(/[\r]*\n/)
|
||||
list.should have(2).items
|
||||
expect(list.count).to eq 2
|
||||
list.should include('at', 'ab')
|
||||
end
|
||||
|
||||
|
|
|
@ -14,13 +14,13 @@ describe PlatformContent do
|
|||
|
||||
it 'ensures that finds files' do
|
||||
# + /repository folder
|
||||
subject.find_by_platform(platform, '', '').should have(3).items
|
||||
expect(subject.find_by_platform(platform, '', '').count).to eq 3
|
||||
end
|
||||
|
||||
context 'ensures that finds files by name' do
|
||||
it { subject.find_by_platform(platform, '', 'test').should have(2).items }
|
||||
it { subject.find_by_platform(platform, '', 'test001').should have(1).item }
|
||||
it { subject.find_by_platform(platform, 'repository', 'test').should have(:no).items }
|
||||
it { expect(subject.find_by_platform(platform, '', 'test').count).to eq 2 }
|
||||
it { expect(subject.find_by_platform(platform, '', 'test001').count).to eq 1 }
|
||||
it { expect(subject.find_by_platform(platform, 'repository', 'test').count).to eq 0 }
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -28,13 +28,13 @@ describe PlatformContent do
|
|||
context '#is_folder?' do
|
||||
it 'ensures that returns true for folder' do
|
||||
subject.find_by_platform(platform, '', 'repository').first.is_folder?
|
||||
.should be_true
|
||||
.should be_truthy
|
||||
end
|
||||
|
||||
it 'ensures that returns false for file' do
|
||||
File.open(File.join(platform.path, 'test001'), "w")
|
||||
subject.find_by_platform(platform, '', 'test').first.is_folder?
|
||||
.should be_false
|
||||
.should be_falsy
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -4,18 +4,18 @@ describe Platform do
|
|||
before { stub_symlink_methods }
|
||||
|
||||
context 'ensures that validations and associations exist' do
|
||||
before do
|
||||
# Need for validate_uniqueness_of check
|
||||
FactoryGirl.create(:platform)
|
||||
end
|
||||
|
||||
it { should belong_to(:owner) }
|
||||
it { should have_many(:members)}
|
||||
it { should have_many(:repositories)}
|
||||
it { should have_many(:products)}
|
||||
|
||||
it { should validate_presence_of(:name)}
|
||||
it { should validate_uniqueness_of(:name).case_insensitive }
|
||||
|
||||
context 'validates uniqueness' do
|
||||
before { FactoryGirl.create(:platform) }
|
||||
it { should validate_uniqueness_of(:name).case_insensitive }
|
||||
end
|
||||
|
||||
it { should allow_value('Basic_platform-name-1234').for(:name) }
|
||||
it { should_not allow_value('.!').for(:name) }
|
||||
it { should validate_presence_of(:default_branch)}
|
||||
|
@ -26,12 +26,12 @@ describe Platform do
|
|||
Platform::VISIBILITIES.each do |value|
|
||||
it {should allow_value(value).for(:visibility)}
|
||||
end
|
||||
it {should_not allow_value('custom_status').for(:visibility)}
|
||||
it { should_not allow_value('custom_status').for(:visibility) }
|
||||
|
||||
['', nil] + Platform::AUTOMATIC_METADATA_REGENERATIONS.each do |value|
|
||||
it {should allow_value(value).for(:automatic_metadata_regeneration)}
|
||||
end
|
||||
it {should_not allow_value('custom_status').for(:visibility)}
|
||||
it { should_not allow_value('custom_status').for(:visibility) }
|
||||
|
||||
|
||||
it { should have_readonly_attribute(:name) }
|
||||
|
@ -51,27 +51,27 @@ describe Platform do
|
|||
platform = FactoryGirl.create :platform
|
||||
FileUtils.mkdir_p platform.path
|
||||
platform.destroy
|
||||
Dir.exists?(platform.path).should be_false
|
||||
Dir.exists?(platform.path).should be_falsy
|
||||
end
|
||||
|
||||
it 'ensures that owner of personal platform can not be changed' do
|
||||
platform = FactoryGirl.create :personal_platform
|
||||
owner = platform.owner
|
||||
platform.owner = FactoryGirl.create :user
|
||||
platform.save.should be_false
|
||||
platform.save.should be_falsy
|
||||
end
|
||||
|
||||
it 'ensures that owner of platform of group can not be changed' do
|
||||
group = FactoryGirl.create :group
|
||||
platform = FactoryGirl.create :personal_platform, owner: group
|
||||
platform.owner = FactoryGirl.create :user
|
||||
platform.save.should be_false
|
||||
platform.save.should be_falsy
|
||||
end
|
||||
|
||||
it 'ensures that owner of main platform can be changed' do
|
||||
platform = FactoryGirl.create :platform
|
||||
platform.owner = FactoryGirl.create :user
|
||||
platform.save.should be_true
|
||||
platform.save.should be_truthy
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ describe ProductBuildList do
|
|||
it 'is valid given valid attributes' do
|
||||
arch = FactoryGirl.create(:arch, name: 'x86_64')
|
||||
allow(Arch).to receive(:find_by).with(name: 'x86_64').and_return(arch)
|
||||
FactoryGirl.create(:product_build_list).should be_true
|
||||
FactoryGirl.create(:product_build_list).should be_truthy
|
||||
end
|
||||
|
||||
it { should belong_to(:product) }
|
||||
|
|
|
@ -9,7 +9,7 @@ describe Product do
|
|||
it 'is valid given valid attributes' do
|
||||
# arch = FactoryGirl.create(:arch, name: 'x86_64')
|
||||
# allow(Arch).to receive(:find_by).with(name: 'x86_64').and_return(arch)
|
||||
FactoryGirl.create(:product).should be_true
|
||||
FactoryGirl.create(:product).should be_truthy
|
||||
end
|
||||
|
||||
it { should belong_to(:platform) }
|
||||
|
@ -57,7 +57,7 @@ describe Product do
|
|||
|
||||
it 'product should has product_build_list' do
|
||||
Product.autostart_iso_builds Product::ONCE_A_12_HOURS
|
||||
product.product_build_lists.should have(1).item
|
||||
expect(product.product_build_lists.count).to eq 1
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -106,7 +106,7 @@ describe Project do
|
|||
|
||||
it "ensures that personal repository has not been attached when project had been created as not package" do
|
||||
project = FactoryGirl.create(:project, owner: user, is_package: false)
|
||||
project.repositories.should have(:no).items
|
||||
expect(project.repositories.count).to eq 0
|
||||
end
|
||||
|
||||
it "ensures that personal repository has been attached when project had been updated as package" do
|
||||
|
@ -118,7 +118,7 @@ describe Project do
|
|||
it "ensures that personal repository has been removed from project when project had been updated as not package" do
|
||||
project = FactoryGirl.create(:project, owner: user, is_package: true)
|
||||
project.update_attribute(:is_package, false)
|
||||
project.repositories.should have(:no).items
|
||||
expect(project.repositories.count).to eq 0
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -126,7 +126,7 @@ describe Project do
|
|||
let!(:project) { FactoryGirl.build(:project, name: ' test_name ') }
|
||||
|
||||
it 'ensures that validation passed' do
|
||||
project.valid?.should be_true
|
||||
project.valid?.should be_truthy
|
||||
end
|
||||
|
||||
it 'ensures that name has been truncated' do
|
||||
|
@ -146,7 +146,7 @@ describe Project do
|
|||
it 'ensures that path to git repository has been changed after rename of project' do
|
||||
project = FactoryGirl.create(:project_with_commit)
|
||||
project.update_attributes(name: "#{project.name}-new")
|
||||
Dir.exists?(project.path).should be_true
|
||||
Dir.exists?(project.path).should be_truthy
|
||||
end
|
||||
|
||||
context 'manage branches' do
|
||||
|
@ -157,7 +157,7 @@ describe Project do
|
|||
|
||||
context '#delete_branch' do
|
||||
it 'ensures that returns true on success' do
|
||||
project.delete_branch(branch, user).should be_true
|
||||
project.delete_branch(branch, user).should be_truthy
|
||||
end
|
||||
|
||||
it 'ensures that branch has been deleted' do
|
||||
|
@ -165,7 +165,7 @@ describe Project do
|
|||
end
|
||||
|
||||
it 'ensures that returns false on delete master' do
|
||||
project.delete_branch(master, user).should be_false
|
||||
project.delete_branch(master, user).should be_falsy
|
||||
end
|
||||
|
||||
it 'ensures that master has not been deleted' do
|
||||
|
@ -174,7 +174,7 @@ describe Project do
|
|||
|
||||
it 'ensures that returns false on delete wrong branch' do
|
||||
project.delete_branch(branch, user)
|
||||
project.delete_branch(branch, user).should be_false
|
||||
project.delete_branch(branch, user).should be_falsy
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -184,7 +184,7 @@ describe Project do
|
|||
end
|
||||
|
||||
it 'ensures that returns true on success' do
|
||||
project.create_branch(branch.name, branch.commit.id, user).should be_true
|
||||
project.create_branch(branch.name, branch.commit.id, user).should be_truthy
|
||||
end
|
||||
|
||||
it 'ensures that branch has been created' do
|
||||
|
@ -192,7 +192,7 @@ describe Project do
|
|||
end
|
||||
|
||||
it 'ensures that returns false on create wrong branch' do
|
||||
project.create_branch(branch.name, GitHook::ZERO, user).should be_false
|
||||
project.create_branch(branch.name, GitHook::ZERO, user).should be_falsy
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -233,8 +233,8 @@ describe Project do
|
|||
Project.run_mass_import(url, "abf-worker-service-1-3.src.rpm\nredir-2.2.1-7.res6.src.rpm\n", visibility, owner, repository.id)
|
||||
|
||||
Project.count.should == 2
|
||||
repository.projects.should have(2).items
|
||||
owner.projects.should have(2).items
|
||||
expect(repository.projects.count).to eq 2
|
||||
expect(owner.projects.count).to eq 2
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -261,8 +261,8 @@ describe Project do
|
|||
FactoryGirl.create(:platform_arch_setting, platform: repository.platform, default: false)
|
||||
end
|
||||
|
||||
it { ProjectToRepository.autostart_enabled.should have(1).item }
|
||||
it { repository.platform.platform_arch_settings.should have(2).item }
|
||||
it { expect(ProjectToRepository.autostart_enabled.count).to eq 1 }
|
||||
it { expect(repository.platform.platform_arch_settings.count).to eq 2 }
|
||||
|
||||
context 'once_a_12_hours' do
|
||||
before { project.update_attributes(autostart_status: Autostart::ONCE_A_12_HOURS) }
|
||||
|
@ -317,8 +317,8 @@ describe Project do
|
|||
end
|
||||
|
||||
# 1(personal) + 2(main) + 1(hidden) + 1(main, without main repository)
|
||||
it { ProjectToRepository.autostart_enabled.should have(5).item }
|
||||
it { main_repository.platform.platform_arch_settings.should have(2).item }
|
||||
it { expect(ProjectToRepository.autostart_enabled.count).to eq 5 }
|
||||
it { expect(main_repository.platform.platform_arch_settings.count).to eq 2 }
|
||||
|
||||
# into main platforms: 2 + 1(hidden)
|
||||
# into personal platform: 3(main) * 1
|
||||
|
|
|
@ -10,7 +10,7 @@ def set_data_for_pull
|
|||
|
||||
@other_project = FactoryGirl.create(:project_with_commit, owner: @user)
|
||||
|
||||
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
|
||||
allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0))
|
||||
end
|
||||
|
||||
describe PullRequest do
|
||||
|
@ -37,7 +37,7 @@ describe PullRequest do
|
|||
@pull.check
|
||||
@project.update_attributes(name: "#{@project.name}-new")
|
||||
@pull.reload
|
||||
Dir.exists?(@pull.path).should be_true
|
||||
Dir.exists?(@pull.path).should be_truthy
|
||||
end
|
||||
|
||||
it 'master should merge with non_conflicts branch' do
|
||||
|
|
|
@ -8,7 +8,7 @@ describe Repository do
|
|||
context 'ensures that validations and associations exist' do
|
||||
|
||||
it 'is valid given valid attributes' do
|
||||
repository.should be_true
|
||||
repository.should be_truthy
|
||||
end
|
||||
|
||||
it { should belong_to(:platform) }
|
||||
|
@ -42,34 +42,34 @@ describe Repository do
|
|||
before { FileUtils.mkdir_p path }
|
||||
|
||||
it 'ensures that #sync_lock_file_exists? returns false if .sync.lock file does not exist' do
|
||||
repository.sync_lock_file_exists?.should be_false
|
||||
repository.sync_lock_file_exists?.should be_falsy
|
||||
end
|
||||
|
||||
it 'ensures that #sync_lock_file_exists? returns true if .sync.lock file does exist' do
|
||||
FileUtils.touch "#{path}/.sync.lock"
|
||||
repository.sync_lock_file_exists?.should be_true
|
||||
repository.sync_lock_file_exists?.should be_truthy
|
||||
end
|
||||
|
||||
it 'ensures that #add_sync_lock_file creates .sync.lock file' do
|
||||
repository.add_sync_lock_file
|
||||
File.exist?("#{path}/.sync.lock").should be_true
|
||||
File.exist?("#{path}/.sync.lock").should be_truthy
|
||||
end
|
||||
|
||||
it 'ensures that #remove_sync_lock_file removes .sync.lock file' do
|
||||
FileUtils.touch "#{path}/.sync.lock"
|
||||
repository.remove_sync_lock_file
|
||||
File.exist?("#{path}/.sync.lock").should be_false
|
||||
File.exist?("#{path}/.sync.lock").should be_falsy
|
||||
end
|
||||
|
||||
it 'ensures that #add_repo_lock_file creates .repo.lock file' do
|
||||
repository.add_repo_lock_file
|
||||
File.exist?("#{path}/.repo.lock").should be_true
|
||||
File.exist?("#{path}/.repo.lock").should be_truthy
|
||||
end
|
||||
|
||||
it 'ensures that #remove_repo_lock_file removes .repo.lock file' do
|
||||
FileUtils.touch "#{path}/.repo.lock"
|
||||
repository.remove_repo_lock_file
|
||||
File.exist?("#{path}/.repo.lock").should be_false
|
||||
File.exist?("#{path}/.repo.lock").should be_falsy
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -97,7 +97,7 @@ describe Repository do
|
|||
map{ |type| "#{r.platform.path}/repository/#{type}/#{r.name}" }.
|
||||
each{ |path| FileUtils.mkdir_p path }
|
||||
r.destroy
|
||||
paths.each{ |path| Dir.exists?(path).should be_false }
|
||||
paths.each{ |path| Dir.exists?(path).should be_falsy }
|
||||
end
|
||||
|
||||
it "repository of personal platform" do
|
||||
|
@ -108,7 +108,7 @@ describe Repository do
|
|||
map{ |type| "#{r.platform.path}/repository/#{main_platform.name}/#{type}/#{r.name}" }.
|
||||
each{ |path| FileUtils.mkdir_p path }
|
||||
r.destroy
|
||||
paths.each{ |path| Dir.exists?(path).should be_false }
|
||||
paths.each{ |path| Dir.exists?(path).should be_falsy }
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -118,14 +118,14 @@ describe Repository do
|
|||
repository = FactoryGirl.create(:repository)
|
||||
project = FactoryGirl.create(:project)
|
||||
repository.add_projects(project.name_with_owner, FactoryGirl.create(:user))
|
||||
repository.projects.should have(1).item
|
||||
expect(repository.projects.count).to eq 1
|
||||
end
|
||||
|
||||
it 'user has no ability to read of adding project' do
|
||||
repository = FactoryGirl.create(:repository)
|
||||
project = FactoryGirl.create(:project, visibility: 'hidden')
|
||||
repository.add_projects(project.name_with_owner, FactoryGirl.create(:user))
|
||||
repository.projects.should have(:no).items
|
||||
expect(repository.projects.count).to eq 0
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -135,7 +135,7 @@ describe Repository do
|
|||
repository.projects << project
|
||||
repository.remove_projects(project.name)
|
||||
repository.reload
|
||||
repository.projects.should have(:no).items
|
||||
expect(repository.projects.count).to eq 0
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -37,7 +37,7 @@ describe Statistic do
|
|||
)
|
||||
}
|
||||
end.should_not raise_exception
|
||||
expect(Statistic).to have(1).item
|
||||
expect(Statistic.count).to eq 1
|
||||
expect(Statistic.first.counter).to eq 2
|
||||
end
|
||||
end
|
||||
|
@ -52,8 +52,8 @@ describe Statistic do
|
|||
FactoryGirl.create(:statistic, project: project1)
|
||||
FactoryGirl.create(:statistic, project: project2)
|
||||
|
||||
expect(Statistic.for_groups([group1.id])).to have(1).item
|
||||
expect(Statistic.for_groups([group1.id, group2])).to have(2).items
|
||||
expect(Statistic.for_groups([group1.id]).count).to eq 1
|
||||
expect(Statistic.for_groups([group1.id, group2]).count).to eq 2
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ def set_testable_data
|
|||
@project = FactoryGirl.create(:project)
|
||||
@issue = FactoryGirl.create(:issue, project_id: @project.id)
|
||||
|
||||
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
|
||||
allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0))
|
||||
end
|
||||
|
||||
describe Subscribe do
|
||||
|
|
|
@ -22,7 +22,7 @@ describe Token do
|
|||
it 'ensures that authentication_token unique' do
|
||||
token = FactoryGirl.create(:platform_token)
|
||||
token.authentication_token = platform_token.authentication_token
|
||||
token.valid?.should be_false
|
||||
token.valid?.should be_falsy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -57,17 +57,17 @@ describe AbfWorkerService::Rpm do
|
|||
it "ensures that repository_status has status publish" do
|
||||
build_list.save_to_repository.repository_statuses.
|
||||
find_by(platform_id: build_list.build_for_platform_id).publish?.
|
||||
should be_true
|
||||
should be_truthy
|
||||
end
|
||||
|
||||
it "ensures that 'locked build lists' has only one item" do
|
||||
queue = @redis_instance.lrange(subject::LOCKED_BUILD_LISTS, 0, -1)
|
||||
queue.should have(1).item
|
||||
expect(queue.count).to eq 1
|
||||
queue.should include(build_list.id.to_s)
|
||||
end
|
||||
|
||||
it "ensures that new task for publishing has been created" do
|
||||
@redis_instance.lrange('resque:queue:publish_worker_default', 0, -1).should have(1).item
|
||||
expect(@redis_instance.lrange('resque:queue:publish_worker_default', 0, -1).count).to eq 1
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -86,14 +86,14 @@ describe AbfWorkerService::Rpm do
|
|||
subject.publish!
|
||||
subject.publish!
|
||||
|
||||
RepositoryStatus.where(status: RepositoryStatus::PUBLISH).should have(4).items
|
||||
expect(RepositoryStatus.where(status: RepositoryStatus::PUBLISH).count).to eq 4
|
||||
end
|
||||
|
||||
it "ensures that 'locked build lists' has 4 items" do
|
||||
subject.publish!
|
||||
subject.publish!
|
||||
|
||||
@redis_instance.lrange(subject::LOCKED_BUILD_LISTS, 0, -1).should have(4).items
|
||||
expect(@redis_instance.lrange(subject::LOCKED_BUILD_LISTS, 0, -1).count).to eq 4
|
||||
end
|
||||
|
||||
it "ensures that new tasks for publishing has been created" do
|
||||
|
@ -129,14 +129,14 @@ describe AbfWorkerService::Rpm do
|
|||
it "ensures that only one repository_status has status publish" do
|
||||
subject.publish!
|
||||
subject.publish!
|
||||
RepositoryStatus.where(status: RepositoryStatus::PUBLISH).should have(1).item
|
||||
expect(RepositoryStatus.where(status: RepositoryStatus::PUBLISH).count).to eq 1
|
||||
end
|
||||
|
||||
it "ensures that 'locked build lists' has 2 items" do
|
||||
subject.publish!
|
||||
subject.publish!
|
||||
queue = @redis_instance.lrange(subject::LOCKED_BUILD_LISTS, 0, -1)
|
||||
queue.should have(2).item
|
||||
expect(queue.count).to eq 2
|
||||
queue.should include(build_list.id.to_s, build_list2.id.to_s)
|
||||
end
|
||||
|
||||
|
@ -173,7 +173,7 @@ describe AbfWorkerService::Rpm do
|
|||
subject.publish!
|
||||
|
||||
queue = @redis_instance.lrange(subject::PROJECTS_FOR_CLEANUP, 0, -1)
|
||||
queue.should have(1).item
|
||||
expect(queue.count).to eq 1
|
||||
queue.should include("testing-#{build_list3.project_id}-#{build_list3.save_to_repository_id}-#{build_list3.build_for_platform_id}")
|
||||
end
|
||||
|
||||
|
@ -181,7 +181,7 @@ describe AbfWorkerService::Rpm do
|
|||
subject.publish!
|
||||
subject.publish!
|
||||
|
||||
RepositoryStatus.where(status: RepositoryStatus::PUBLISH).should have(1).item
|
||||
expect(RepositoryStatus.where(status: RepositoryStatus::PUBLISH).count).to eq 1
|
||||
end
|
||||
|
||||
it "ensures that 'locked projects for cleanup' has only one item" do
|
||||
|
@ -189,7 +189,7 @@ describe AbfWorkerService::Rpm do
|
|||
subject.publish!
|
||||
|
||||
queue = @redis_instance.lrange(subject::LOCKED_PROJECTS_FOR_CLEANUP, 0, -1)
|
||||
queue.should have(1).item
|
||||
expect(queue.count).to eq 1
|
||||
queue.should include("#{build_list3.project_id}-#{build_list3.save_to_repository_id}-#{build_list3.build_for_platform_id}")
|
||||
end
|
||||
|
||||
|
@ -205,7 +205,7 @@ describe AbfWorkerService::Rpm do
|
|||
subject.publish!
|
||||
|
||||
queue = @redis_instance.lrange(subject::LOCKED_BUILD_LISTS, 0, -1)
|
||||
queue.should have(1).item
|
||||
expect(queue.count).to eq 1
|
||||
queue.should include(build_list.id.to_s)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,17 +12,17 @@ describe FileStoreService::File do
|
|||
|
||||
it 'returns true if file exists' do
|
||||
stub_request(:get, url).to_return(body: response)
|
||||
expect(subject.exist?).to be_true
|
||||
expect(subject.exist?).to be_truthy
|
||||
end
|
||||
|
||||
it 'returns false if file does not exist' do
|
||||
stub_request(:get, url).to_return(body: '[]')
|
||||
expect(subject.exist?).to be_false
|
||||
expect(subject.exist?).to be_falsy
|
||||
end
|
||||
|
||||
it 'returns false on error' do
|
||||
stub_request(:get, url).to_raise(StandardError)
|
||||
expect(subject.exist?).to be_false
|
||||
expect(subject.exist?).to be_falsy
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -16,7 +16,16 @@ RSpec.configure do |config|
|
|||
# config.mock_with :mocha
|
||||
# config.mock_with :flexmock
|
||||
# config.mock_with :rr
|
||||
config.mock_with :rspec
|
||||
# config.mock_with :rspec
|
||||
#
|
||||
# rspec-mocks config goes here. You can use an alternate test double
|
||||
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
||||
config.mock_with :rspec do |mocks|
|
||||
# Prevents you from mocking or stubbing a method that does not exist on
|
||||
# a real object. This is generally recommended, and will default to
|
||||
# `true` in RSpec 4.
|
||||
mocks.verify_partial_doubles = true
|
||||
end
|
||||
|
||||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
||||
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||
|
|
Loading…
Reference in New Issue