update rspec-rails gem

This commit is contained in:
Vokhmin Alexey V 2015-02-19 04:12:08 +03:00
parent 629867cee7
commit db4d1ba457
72 changed files with 225 additions and 209 deletions

View File

@ -125,15 +125,15 @@ group :development do
end end
group :development, :test do group :development, :test do
gem 'rspec-rails', '~> 2.14.1' gem 'rspec-rails'#, '~> 2.14.1'
end end
group :test do group :test do
gem 'factory_girl_rails', '~> 4.4.1' gem 'factory_girl_rails'#, '~> 4.4.1'
gem 'rr', '~> 1.1.2' gem 'rr'#, '~> 1.1.2'
gem 'shoulda' gem 'shoulda'
gem 'shoulda-matchers' gem 'shoulda-matchers'
gem 'mock_redis', '~> 0.11' gem 'mock_redis'#, '~> 0.11'
gem 'webmock' gem 'webmock'
gem 'rake' gem 'rake'
gem 'test_after_commit' gem 'test_after_commit'

View File

@ -10,7 +10,7 @@ GIT
GIT GIT
remote: git://github.com/activeadmin/activeadmin.git remote: git://github.com/activeadmin/activeadmin.git
revision: 51faef09fe27cdf84568cd00b10ccb9ee8a26151 revision: ed1fbca8c64af827616c58f274d7be256ca513b6
specs: specs:
activeadmin (1.0.0.pre) activeadmin (1.0.0.pre)
arbre (~> 1.0, >= 1.0.2) arbre (~> 1.0, >= 1.0.2)
@ -123,7 +123,7 @@ GEM
capistrano_colors (0.5.5) capistrano_colors (0.5.5)
charlock_holmes (0.7.3) charlock_holmes (0.7.3)
chronic (0.10.2) chronic (0.10.2)
chunky_png (1.3.3) chunky_png (1.3.4)
climate_control (0.0.3) climate_control (0.0.3)
activesupport (>= 3.0) activesupport (>= 3.0)
cocaine (0.5.5) cocaine (0.5.5)
@ -137,7 +137,7 @@ GEM
coffee-script (2.3.0) coffee-script (2.3.0)
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.9.0) coffee-script-source (1.9.1)
compass (1.0.3) compass (1.0.3)
chunky_png (~> 1.2) chunky_png (~> 1.2)
compass-core (~> 1.0.2) compass-core (~> 1.0.2)
@ -174,10 +174,10 @@ GEM
eventmachine (1.0.5) eventmachine (1.0.5)
execjs (2.3.0) execjs (2.3.0)
expression_parser (0.9.0) expression_parser (0.9.0)
factory_girl (4.4.0) factory_girl (4.5.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
factory_girl_rails (4.4.1) factory_girl_rails (4.5.0)
factory_girl (~> 4.4.0) factory_girl (~> 4.5.0)
railties (>= 3.0.0) railties (>= 3.0.0)
faraday (0.9.1) faraday (0.9.1)
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
@ -237,7 +237,7 @@ GEM
has_scope (~> 0.6.0.rc) has_scope (~> 0.6.0.rc)
railties (>= 3.2, < 5) railties (>= 3.2, < 5)
responders responders
jbuilder (2.2.6) jbuilder (2.2.7)
activesupport (>= 3.0.0, < 5) activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2) multi_json (~> 1.2)
jquery-migrate-rails (1.2.1) jquery-migrate-rails (1.2.1)
@ -298,7 +298,7 @@ GEM
net-ssh-gateway (1.2.0) net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5) net-ssh (>= 2.6.5)
netrc (0.10.2) netrc (0.10.2)
newrelic_rpm (3.9.9.275) newrelic_rpm (3.10.0.279)
ng-rails-csrf (0.1.0) ng-rails-csrf (0.1.0)
ngmin-rails (0.4.0) ngmin-rails (0.4.0)
rails (>= 3.1) rails (>= 3.1)
@ -341,7 +341,7 @@ GEM
pg (0.17.1) pg (0.17.1)
polyamorous (1.1.0) polyamorous (1.1.0)
activerecord (>= 3.0) activerecord (>= 3.0)
posix-spawn (0.3.9) posix-spawn (0.3.10)
protected_attributes (1.0.8) protected_attributes (1.0.8)
activemodel (>= 4.0.1, < 5.0) activemodel (>= 4.0.1, < 5.0)
puma (2.11.1) puma (2.11.1)
@ -429,18 +429,23 @@ GEM
netrc (~> 0.7) netrc (~> 0.7)
rouge (1.3.4) rouge (1.3.4)
rr (1.1.2) rr (1.1.2)
rspec-core (2.14.8) rspec-core (3.2.0)
rspec-expectations (2.14.5) rspec-support (~> 3.2.0)
diff-lcs (>= 1.1.3, < 2.0) rspec-expectations (3.2.0)
rspec-mocks (2.14.6) diff-lcs (>= 1.2.0, < 2.0)
rspec-rails (2.14.2) rspec-support (~> 3.2.0)
actionpack (>= 3.0) rspec-mocks (3.2.0)
activemodel (>= 3.0) diff-lcs (>= 1.2.0, < 2.0)
activesupport (>= 3.0) rspec-support (~> 3.2.0)
railties (>= 3.0) rspec-rails (3.2.0)
rspec-core (~> 2.14.0) actionpack (>= 3.0, <= 4.2)
rspec-expectations (~> 2.14.0) activesupport (>= 3.0, <= 4.2)
rspec-mocks (~> 2.14.0) 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) ruby-haml-js (0.0.5)
execjs execjs
sprockets (>= 2.0.0) sprockets (>= 2.0.0)
@ -456,12 +461,12 @@ GEM
safe_yaml (1.0.4) safe_yaml (1.0.4)
sanitize (2.1.0) sanitize (2.1.0)
nokogiri (>= 1.4.4) nokogiri (>= 1.4.4)
sass (3.4.11) sass (3.4.12)
sass-rails (4.0.1) sass-rails (4.0.1)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 5.0)
sass (>= 3.1.10) sass (>= 3.1.10)
sprockets-rails (~> 2.0.0) sprockets-rails (~> 2.0.0)
schema_plus (1.8.6) schema_plus (1.8.7)
activerecord (>= 3.2, < 4.3) activerecord (>= 3.2, < 4.3)
valuable valuable
scrivener (0.0.3) scrivener (0.0.3)
@ -579,7 +584,7 @@ DEPENDENCIES
creole creole
devise (~> 3.3) devise (~> 3.3)
diff-display (~> 0.0.1) diff-display (~> 0.0.1)
factory_girl_rails (~> 4.4.1) factory_girl_rails
ffi (~> 1.9.3) ffi (~> 1.9.3)
font-awesome-rails (~> 4.2) font-awesome-rails (~> 4.2)
friendly_id (~> 5.0) friendly_id (~> 5.0)
@ -599,7 +604,7 @@ DEPENDENCIES
mailcatcher mailcatcher
meta-tags (~> 2.0) meta-tags (~> 2.0)
meta_request meta_request
mock_redis (~> 0.11) mock_redis
momentjs-rails momentjs-rails
newrelic_rpm newrelic_rpm
ng-rails-csrf ng-rails-csrf
@ -628,8 +633,8 @@ DEPENDENCIES
resque-status (~> 0.4) resque-status (~> 0.4)
resque_mailer (~> 2.2) resque_mailer (~> 2.2)
rest-client (~> 1.7) rest-client (~> 1.7)
rr (~> 1.1.2) rr
rspec-rails (~> 2.14.1) rspec-rails
ruby-haml-js (~> 0.0.5) ruby-haml-js (~> 0.0.5)
russian (~> 0.6.0) russian (~> 0.6.0)
rvm-capistrano rvm-capistrano

View File

@ -10,6 +10,7 @@ module PersonalRepository
pl = own_platforms.build pl = own_platforms.build
pl.owner = self pl.owner = self
pl.name = "#{self.uname}_personal" pl.name = "#{self.uname}_personal"
pl.default_branch = pl.name
pl.description = "#{self.uname}_personal" pl.description = "#{self.uname}_personal"
pl.platform_type = Platform::TYPE_PERSONAL pl.platform_type = Platform::TYPE_PERSONAL
pl.distrib_type = APP_CONFIG['distr_types'].first pl.distrib_type = APP_CONFIG['distr_types'].first

View File

@ -1,5 +1,5 @@
require 'spec_helper' require 'spec_helper'
describe Admin::BuildScriptsController do describe Admin::BuildScriptsController, type: :controller do
it_should_behave_like 'an admin controller' it_should_behave_like 'an admin controller'
end end

View File

@ -1,5 +1,5 @@
require 'spec_helper' require 'spec_helper'
describe Admin::DashboardController do describe Admin::DashboardController, type: :controller do
it_should_behave_like 'an admin controller' it_should_behave_like 'an admin controller'
end end

View File

@ -1,5 +1,5 @@
require 'spec_helper' require 'spec_helper'
describe Admin::EventLogsController do describe Admin::EventLogsController, type: :controller do
it_should_behave_like 'an admin controller' it_should_behave_like 'an admin controller'
end end

View File

@ -1,5 +1,5 @@
require 'spec_helper' require 'spec_helper'
describe Admin::FlashNotifiesController do describe Admin::FlashNotifiesController, type: :controller do
it_should_behave_like 'an admin controller' it_should_behave_like 'an admin controller'
end end

View File

@ -1,5 +1,5 @@
require 'spec_helper' require 'spec_helper'
describe Admin::NodeInstructionsController do describe Admin::NodeInstructionsController, type: :controller do
it_should_behave_like 'an admin controller' it_should_behave_like 'an admin controller'
end end

View File

@ -1,5 +1,5 @@
require 'spec_helper' require 'spec_helper'
describe Admin::RegisterRequestsController do describe Admin::RegisterRequestsController, type: :controller do
it_should_behave_like 'an admin controller' it_should_behave_like 'an admin controller'
end end

View File

@ -1,5 +1,5 @@
require 'spec_helper' require 'spec_helper'
describe Admin::ResqueController do describe Admin::ResqueController, type: :controller do
it_should_behave_like 'an admin controller' it_should_behave_like 'an admin controller'
end end

View File

@ -1,5 +1,5 @@
require 'spec_helper' require 'spec_helper'
describe Admin::UsersController do describe Admin::UsersController, type: :controller do
it_should_behave_like 'an admin controller' it_should_behave_like 'an admin controller'
end end

View File

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe AdvisoriesController do describe AdvisoriesController, type: :controller do
context 'for all' do context 'for all' do
it "should be able to perform search action" do it "should be able to perform search action" do
get :search get :search

View File

@ -80,7 +80,7 @@ shared_examples_for 'api advisories user without admin rights' do
end end
end end
describe Api::V1::AdvisoriesController do describe Api::V1::AdvisoriesController, type: :controller do
before do before do
stub_symlink_methods stub_symlink_methods

View File

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe Api::V1::ArchesController do describe Api::V1::ArchesController, type: :controller do
before { FactoryGirl.create(:arch) } before { FactoryGirl.create(:arch) }

View File

@ -95,7 +95,7 @@ shared_examples_for 'validation error via build list api' do |message|
end end
end end
describe Api::V1::BuildListsController do describe Api::V1::BuildListsController, type: :controller do
before do before do
stub_symlink_methods stub_symlink_methods
allow_any_instance_of(BuildList).to receive(:valid_branch_for_publish?).and_return(true) allow_any_instance_of(BuildList).to receive(:valid_branch_for_publish?).and_return(true)

View File

@ -175,7 +175,7 @@ shared_examples_for 'api group user without owner rights' do
end end
end end
describe Api::V1::GroupsController do describe Api::V1::GroupsController, type: :controller do
before do before do
stub_symlink_methods stub_symlink_methods

View File

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe Api::V1::IssuesController do describe Api::V1::IssuesController, type: :controller do
before do before do
stub_symlink_methods stub_symlink_methods
any_instance_of(Project, versions: ['v1.0', 'v2.0']) any_instance_of(Project, versions: ['v1.0', 'v2.0'])
@ -79,7 +79,7 @@ describe Api::V1::IssuesController do
it 'should return only assigned issue' do it 'should return only assigned issue' do
get :user_index, format: :json get :user_index, format: :json
assigns[:issues].should include(@own_hidden_issue) assigns[:issues].should include(@own_hidden_issue)
assigns[:issues].should have(1).item expect(assigns[:issues].count).to eq 1
end end
it 'should render right template for user index action' do it 'should render right template for user index action' do

View File

@ -8,19 +8,19 @@ shared_examples_for 'api maintainers user with reader rights' do
it 'loads all of the maintainers into @maintainers' do it 'loads all of the maintainers into @maintainers' do
get :index, platform_id: package.platform_id, format: :json 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) assigns(:maintainers).should include(package, package2)
end end
it 'loads all of the maintainers into @maintainers when search by name' do 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 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) assigns(:maintainers).should include(package)
end end
end end
describe Api::V1::MaintainersController do describe Api::V1::MaintainersController, type: :controller do
before do before do
stub_symlink_methods stub_symlink_methods
FactoryGirl.create(:build_list_package, platform: package.platform) FactoryGirl.create(:build_list_package, platform: package.platform)

View File

@ -207,7 +207,7 @@ shared_examples_for "api platform user with show rights" do
end end
end end
describe Api::V1::PlatformsController do describe Api::V1::PlatformsController, type: :controller do
let(:clone_or_create_params) do let(:clone_or_create_params) do
{ id: @platform.id, { id: @platform.id,
platform: { description: 'new description', name: 'new_name', platform: { description: 'new description', name: 'new_name',

View File

@ -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 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 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.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 end
it 'ensures that return correct answer for wrong creating action' do 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
end end
describe Api::V1::ProductBuildListsController do describe Api::V1::ProductBuildListsController, type: :controller do
before(:each) do before(:each) do
stub_symlink_methods stub_symlink_methods
FactoryGirl.create(:arch, name: 'x86_64') FactoryGirl.create(:arch, name: 'x86_64')

View File

@ -114,7 +114,7 @@ shared_examples_for 'api user with admin rights' do
#end #end
end end
describe Api::V1::ProductsController do describe Api::V1::ProductsController, type: :controller do
before(:each) do before(:each) do
stub_symlink_methods stub_symlink_methods

View File

@ -276,7 +276,7 @@ shared_examples_for 'api projects user without owner rights' do
end end
end end
describe Api::V1::ProjectsController do describe Api::V1::ProjectsController, type: :controller do
before(:each) do before(:each) do
stub_symlink_methods stub_symlink_methods

View File

@ -8,7 +8,7 @@ def create_pull to_ref, from_ref, owner, project = @project
pull pull
end end
describe Api::V1::PullRequestsController do describe Api::V1::PullRequestsController, type: :controller do
before(:all) do before(:all) do
stub_symlink_methods stub_symlink_methods
@ -87,7 +87,7 @@ describe Api::V1::PullRequestsController do
it 'should return only assigned pull request' do it 'should return only assigned pull request' do
get :user_index, format: :json get :user_index, format: :json
assigns[:pulls].should include(@own_hidden_pull) assigns[:pulls].should include(@own_hidden_pull)
assigns[:pulls].should have(1).item expect(assigns[:pulls].count).to eq 1
end end
it 'should render right template for user index action' do it 'should render right template for user index action' do

View File

@ -298,7 +298,7 @@ shared_examples_for 'api repository user without project manage rights' do
end end
describe Api::V1::RepositoriesController do describe Api::V1::RepositoriesController, type: :controller do
before(:each) do before(:each) do
stub_symlink_methods stub_symlink_methods

View File

@ -14,7 +14,7 @@ shared_examples_for 'not able search with api' do
end end
end end
describe Api::V1::SearchController do describe Api::V1::SearchController, type: :controller do
before { stub_symlink_methods } before { stub_symlink_methods }
context 'as guest' do context 'as guest' do

View File

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe Api::V1::UsersController do describe Api::V1::UsersController, type: :controller do
before(:all) { User.destroy_all } before(:all) { User.destroy_all }
before do before do
stub_symlink_methods stub_symlink_methods
@ -44,7 +44,7 @@ describe Api::V1::UsersController do
it { response.should_not be_success } it { response.should_not be_success }
it 'ensures that user notification settings have not been updated' do it 'ensures that user notification settings have not been updated' do
@user.reload @user.reload
@user.notifier.can_notify.should be_true @user.notifier.can_notify.should be_truthy
end end
end end
@ -85,7 +85,7 @@ describe Api::V1::UsersController do
it { response.should be_success } it { response.should be_success }
it 'ensures that user notification settings have been updated' do it 'ensures that user notification settings have been updated' do
@user.reload @user.reload
@user.notifier.can_notify.should be_false @user.notifier.can_notify.should be_falsy
end end
end end

View File

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe AutocompletesController do describe AutocompletesController, type: :controller do
before {stub_symlink_methods} before {stub_symlink_methods}
context 'for user' do context 'for user' do

View File

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe Groups::MembersController do describe Groups::MembersController, type: :controller do
before(:each) do before(:each) do
stub_symlink_methods stub_symlink_methods
@group = FactoryGirl.create(:group) @group = FactoryGirl.create(:group)

View File

@ -68,7 +68,7 @@ shared_examples_for 'group owner' do
end end
end end
describe Groups::ProfileController do describe Groups::ProfileController, type: :controller do
before(:each) do before(:each) do
stub_symlink_methods stub_symlink_methods
@group = FactoryGirl.create(:group) @group = FactoryGirl.create(:group)

View File

@ -56,7 +56,7 @@ shared_examples_for 'content platform user with member rights' do
end end
end end
describe Platforms::ContentsController do describe Platforms::ContentsController, type: :controller do
before do before do
stub_symlink_methods stub_symlink_methods

View File

@ -66,7 +66,7 @@ shared_examples_for 'key_pair platform reader' do
end end
end end
describe Platforms::KeyPairsController do describe Platforms::KeyPairsController, type: :controller do
before(:each) do before(:each) do
stub_symlink_methods stub_symlink_methods

View File

@ -8,7 +8,7 @@ shared_examples_for 'guest user' do
end end
end end
describe Platforms::MaintainersController do describe Platforms::MaintainersController, type: :controller do
before(:each) do before(:each) do
stub_symlink_methods stub_symlink_methods

View File

@ -115,7 +115,7 @@ shared_examples_for 'mass_build platform reader' do
end end
describe Platforms::MassBuildsController do describe Platforms::MassBuildsController, type: :controller do
before(:each) do before(:each) do
stub_symlink_methods stub_symlink_methods

View File

@ -248,7 +248,7 @@ shared_examples_for 'platform user with show rights' do
end end
end end
describe Platforms::PlatformsController do 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}} } 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}} }
before do before do
stub_symlink_methods stub_symlink_methods

View File

@ -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}) put :update, valid_attributes_for_show.merge(product_build_list: {time_living: 100,not_delete: true})
time_living = @pbl.time_living time_living = @pbl.time_living
@pbl.reload.time_living.should == time_living @pbl.reload.time_living.should == time_living
@pbl.not_delete.should be_true @pbl.not_delete.should be_truthy
end end
it 'should be able to perform log action' do it 'should be able to perform log action' do
@ -98,7 +98,7 @@ shared_examples_for 'product build list user' do
end end
end end
describe Platforms::ProductBuildListsController do describe Platforms::ProductBuildListsController, type: :controller do
before(:each) { stub_symlink_methods } before(:each) { stub_symlink_methods }
context 'crud' do context 'crud' do

View File

@ -21,7 +21,7 @@ shared_examples_for 'admin user' do
end end
describe Platforms::ProductsController do describe Platforms::ProductsController, type: :controller do
before(:each) do before(:each) do
stub_symlink_methods stub_symlink_methods

View File

@ -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 it 'should not be able to perform regenerate_metadata action' do
put :regenerate_metadata, id: @repository, platform_id: @platform put :regenerate_metadata, id: @repository, platform_id: @platform
response.should redirect_to(redirect_path) response.should redirect_to(redirect_path)
@repository.repository_statuses.should have(:no).items expect(@repository.repository_statuses.count).to eq 0
end end
it 'should not be able to remove project from repository' do 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 it 'should not be able to perform regenerate_metadata action' do
put :regenerate_metadata, id: @repository, platform_id: @platform put :regenerate_metadata, id: @repository, platform_id: @platform
response.should redirect_to(redirect_path) response.should redirect_to(redirect_path)
@repository.repository_statuses.should have(:no).items expect(@repository.repository_statuses.count).to eq 0
end end
it 'should not be able to perform regenerate_metadata action of personal repository' do 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 put :regenerate_metadata, id: @personal_repository, platform_id: @personal_repository.platform
response.should redirect_to(redirect_path) response.should redirect_to(redirect_path)
@personal_repository.repository_statuses.should have(:no).items expect(@personal_repository.repository_statuses.count).to eq 0
end end
it 'should not be able to perform create action' do it 'should not be able to perform create action' do
@ -150,20 +150,20 @@ shared_examples_for 'platform admin user' do
put :regenerate_metadata, id: @repository, platform_id: @platform put :regenerate_metadata, id: @repository, platform_id: @platform
response.should redirect_to(platform_repository_path(@platform, @repository)) response.should redirect_to(platform_repository_path(@platform, @repository))
@repository.repository_statuses.find_by(platform_id: @platform). @repository.repository_statuses.find_by(platform_id: @platform).
waiting_for_regeneration?.should be_true waiting_for_regeneration?.should be_truthy
end end
it 'should be able to perform regenerate_metadata action of personal repository' do 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 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)) response.should redirect_to(platform_repository_path(@personal_repository.platform, @personal_repository))
@personal_repository.repository_statuses.find_by(platform_id: @platform). @personal_repository.repository_statuses.find_by(platform_id: @platform).
waiting_for_regeneration?.should be_true waiting_for_regeneration?.should be_truthy
end end
it 'should not be able to perform regenerate_metadata action of personal repository when build_for_platform does not exist' do 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 put :regenerate_metadata, id: @personal_repository, platform_id: @personal_repository.platform
response.should render_template(file: "#{Rails.root}/public/404.html") 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 end
it 'should be able to create repository' do 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' it_should_behave_like 'user with change projects in repository rights'
end end
describe Platforms::RepositoriesController do describe Platforms::RepositoriesController, type: :controller do
before(:each) do before(:each) do
stub_symlink_methods stub_symlink_methods

View File

@ -50,7 +50,7 @@ shared_examples_for 'token of platform for simple user or guest' do
end end
end end
describe Platforms::TokensController do describe Platforms::TokensController, type: :controller do
before do before do
stub_symlink_methods stub_symlink_methods

View File

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe Projects::BuildListsController do describe Projects::BuildListsController, type: :controller do
shared_examples_for 'show build list' do shared_examples_for 'show build list' do
it 'should be able to perform show action' do it 'should be able to perform show action' do

View File

@ -44,12 +44,12 @@ shared_examples_for 'project admin user' do
it 'should add new collaborator with reader role' do it 'should add new collaborator with reader role' do
post :create, @create_params.merge(collaborator: @user_params) 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 end
it 'should add new group with reader role' do it 'should add new group with reader role' do
post :create, @create_params.merge(collaborator: @group_params) 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 end
it 'should be able to set reader role for any user' do 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
end end
describe Projects::CollaboratorsController do describe Projects::CollaboratorsController, type: :controller do
include_context "collaborators controller" include_context "collaborators controller"
context 'for guest' do context 'for guest' do

View File

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe Projects::CommentsController do describe Projects::CommentsController, type: :controller do
before(:each) do before(:each) do
stub_symlink_methods stub_symlink_methods
@project = FactoryGirl.create(:project_with_commit) @project = FactoryGirl.create(:project_with_commit)

View File

@ -21,7 +21,7 @@ shared_context "comments controller" do
end end
describe Projects::CommentsController do describe Projects::CommentsController, type: :controller do
include_context "comments controller" include_context "comments controller"
context 'for global admin user' do context 'for global admin user' do

View File

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe Projects::Git::TreesController do describe Projects::Git::TreesController, type: :controller do
before(:each) do before(:each) do
stub_symlink_methods stub_symlink_methods

View File

@ -54,7 +54,7 @@ shared_examples_for 'hooks user without project admin rights' do
end end
end end
describe Projects::HooksController do describe Projects::HooksController, type: :controller do
before(:each) do before(:each) do
stub_symlink_methods stub_symlink_methods

View File

@ -86,7 +86,7 @@ shared_examples_for 'issue user with project writer rights' do
end end
it 'label should be attached to issue' do 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 end
end end
@ -138,7 +138,7 @@ shared_examples_for 'project with issues turned off' do
end end
end end
describe Projects::IssuesController do describe Projects::IssuesController, type: :controller do
include_context "issues controller" include_context "issues controller"
context 'for global admin user' do context 'for global admin user' do
@ -201,7 +201,7 @@ describe Projects::IssuesController do
end end
it 'label should not be attached to issue' do 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
end end

View File

@ -116,7 +116,7 @@ shared_examples_for 'projects user without project admin rights' do
end end
end end
describe Projects::ProjectsController do describe Projects::ProjectsController, type: :controller do
before(:each) do before(:each) do
stub_symlink_methods stub_symlink_methods

View File

@ -160,7 +160,7 @@ shared_examples_for 'pull request when project with issues turned off' do
end end
end end
describe Projects::PullRequestsController do describe Projects::PullRequestsController, type: :controller do
include_context "pull request controller" include_context "pull request controller"
context 'for global admin user' do context 'for global admin user' do

View File

@ -46,7 +46,7 @@ shared_examples_for 'can not unsubscribe' do
end end
end end
describe Projects::SubscribesController do describe Projects::SubscribesController, type: :controller do
before(:each) do before(:each) do
stub_symlink_methods stub_symlink_methods

View File

@ -1,5 +1,5 @@
require 'spec_helper' require 'spec_helper'
describe Projects::WikiController do describe Projects::WikiController, type: :controller do
end end

View File

@ -14,7 +14,7 @@ shared_examples_for 'not able search' do
end end
end end
describe SearchController do describe SearchController, type: :controller do
before { stub_symlink_methods } before { stub_symlink_methods }
context 'as guest' do context 'as guest' do

View File

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe SitemapController do describe SitemapController, type: :controller do
describe 'robots' do describe 'robots' do
it 'is successful' do it 'is successful' do

View File

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe Users::ProfileController do describe Users::ProfileController, type: :controller do
before(:each) do before(:each) do
stub_symlink_methods stub_symlink_methods

View File

@ -1,6 +1,7 @@
FactoryGirl.define do FactoryGirl.define do
factory :platform do factory :platform do
name { FactoryGirl.generate(:unixname) } name { FactoryGirl.generate(:unixname) }
default_branch { |p| p.name }
description { FactoryGirl.generate(:string) } description { FactoryGirl.generate(:string) }
platform_type 'main' platform_type 'main'
distrib_type APP_CONFIG['distr_types'].first distrib_type APP_CONFIG['distr_types'].first

View File

@ -32,7 +32,7 @@ describe RestartNodesJob do
RestartNodesJob.perform 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 include(ni2, ni3)
NodeInstruction.where(status: NodeInstruction::RESTARTING).should_not include(ni1) NodeInstruction.where(status: NodeInstruction::RESTARTING).should_not include(ni1)
end end

View File

@ -30,7 +30,7 @@ describe Advisory do
it_should_behave_like 'attach advisory to build_list' it_should_behave_like 'attach advisory to build_list'
it 'ensure that advisory has been created' do it 'ensure that advisory has been created' do
Advisory.should have(1).item expect(Advisory.count).to eq 1
end end
end end

View File

@ -6,12 +6,12 @@ describe BuildList do
context 'validates that repository contains project' do context 'validates that repository contains project' do
it 'when repository contains project' do it 'when repository contains project' do
bl = FactoryGirl.build(:build_list) bl = FactoryGirl.build(:build_list)
bl.valid?.should be_true bl.valid?.should be_truthy
end end
it 'when repository does not contain project' do it 'when repository does not contain project' do
bl = FactoryGirl.build(:build_list) bl = FactoryGirl.build(:build_list)
bl.project.repositories = [] bl.project.repositories = []
bl.valid?.should be_false bl.valid?.should be_falsy
end end
end end
@ -65,61 +65,61 @@ describe BuildList do
shared_examples_for 'build list notifications by email' do shared_examples_for 'build list notifications by email' do
it "gets notification by email when status - Build complete" do it "gets notification by email when status - Build complete" do
build_list.build_success build_list.build_success
should have(1).item expect(subject.count).to eq 1
end end
it "gets notification by email when status - Build error" do it "gets notification by email when status - Build error" do
build_list.build_error build_list.build_error
should have(1).item expect(subject.count).to eq 1
end end
it "gets notification by email when status - Unpermitted architecture" do it "gets notification by email when status - Unpermitted architecture" do
build_list.unpermitted_arch build_list.unpermitted_arch
should have(1).item expect(subject.count).to eq 1
end end
it "gets notification by email when auto_publish and status - Build error" do 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.auto_publish_status = BuildList::AUTO_PUBLISH_STATUS_DEFAULT
build_list.build_error build_list.build_error
should have(1).item expect(subject.count).to eq 1
end end
it "gets notification by email when status - Failed publish" do it "gets notification by email when status - Failed publish" do
build_list.status = BuildList::BUILD_PUBLISH build_list.status = BuildList::BUILD_PUBLISH
build_list.fail_publish build_list.fail_publish
should have(1).item expect(subject.count).to eq 1
end end
it "gets notification by email when auto_publish and status - Failed publish" do 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.auto_publish_status = BuildList::AUTO_PUBLISH_STATUS_DEFAULT
build_list.status = BuildList::BUILD_PUBLISH build_list.status = BuildList::BUILD_PUBLISH
build_list.fail_publish build_list.fail_publish
should have(1).item expect(subject.count).to eq 1
end end
it "gets notification by email when status - Build published" do it "gets notification by email when status - Build published" do
build_list.status = BuildList::BUILD_PUBLISH build_list.status = BuildList::BUILD_PUBLISH
build_list.published build_list.published
should have(1).item expect(subject.count).to eq 1
end end
it "gets notification by email when auto_publish and status - Build published" do 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.auto_publish_status = BuildList::AUTO_PUBLISH_STATUS_DEFAULT
build_list.status = BuildList::BUILD_PUBLISH build_list.status = BuildList::BUILD_PUBLISH
build_list.published build_list.published
should have(1).item expect(subject.count).to eq 1
end end
it "doesn't get notification by email when auto_publish and status - Build complete" do 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.auto_publish_status = BuildList::AUTO_PUBLISH_STATUS_DEFAULT
build_list.build_success build_list.build_success
should have(:no).items expect(subject.count).to eq 0
end end
it "doesn't get notification by email when auto_publish_into_testing and status - Build complete" do 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.auto_publish_status = BuildList::AUTO_PUBLISH_STATUS_TESTING
build_list.build_success build_list.build_success
should have(:no).items expect(subject.count).to eq 0
end end
it "doesn't get notification by email when mass build" do 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.mass_build_id = mb.id
build_list.status = BuildList::BUILD_PUBLISH build_list.status = BuildList::BUILD_PUBLISH
build_list.published build_list.published
should have(:no).items expect(subject.count).to eq 0
end end
it "doesn't get notification by email when notification by email has been disabled" do it "doesn't get notification by email when notification by email has been disabled" do
notifier.update_attributes(can_notify: false) notifier.update_attributes(can_notify: false)
build_list.build_success build_list.build_success
should have(:no).items expect(subject.count).to eq 0
end end
end end
@ -151,14 +151,14 @@ describe BuildList do
it "doesn't get notification by email when 'build list' notifications has been disabled" 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) allow(notifier).to receive(:new_build?).and_return(false)
build_list.build_success build_list.build_success
should have(:no).items expect(subject.count).to eq 0
end end
it "doesn't get notification by email when 'build list' notifications - enabled, email notifications - disabled" do 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(:can_notify?).and_return(false)
allow(notifier).to receive(:new_build?).and_return(true) allow(notifier).to receive(:new_build?).and_return(true)
build_list.build_success build_list.build_success
should have(:no).items expect(subject.count).to eq 0
end end
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 it "doesn't get notification by email when 'associated build list' notifications has been disabled" do
notifier.update_attributes(new_associated_build: false) notifier.update_attributes(new_associated_build: false)
build_list.build_success build_list.build_success
should have(:no).items expect(subject.count).to eq 0
end end
it "doesn't get notification by email when 'associated build list' notifications - enabled, email notifications - disabled" do 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) notifier.update_attributes(can_notify: false, new_associated_build: true)
build_list.build_success build_list.build_success
should have(:no).items expect(subject.count).to eq 0
end end
end end
@ -194,7 +194,7 @@ describe BuildList do
bl.update_attributes({commit_hash: bl.project.repo.commits('master').last.id, bl.update_attributes({commit_hash: bl.project.repo.commits('master').last.id,
status: BuildList::BUILD_PUBLISH}, without_protection: true) status: BuildList::BUILD_PUBLISH}, without_protection: true)
bl.published bl.published
should have(1).item expect(subject.count).to eq 1
end end
end # notify_users 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 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.save_to_platform.update_attributes(released: true)
build_list.has_new_packages?.should be_false build_list.has_new_packages?.should be_falsy
end end
it 'ensures that return true if version of packages are same and platform RHEL is released' do 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.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 end
it 'ensures that return true if version of packages are same and platform is not released' do 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 end
context 'ensures that return false if version of published package >' do context 'ensures that return false if version of published package >' do
it 'published: 3.1.13, new: 3.1.12' do it 'published: 3.1.13, new: 3.1.12' do
published_build_list_package.update_attributes(version: '3.1.13') 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 end
it 'published: 3.1.12, new: 3.0.999' do it 'published: 3.1.12, new: 3.0.999' do
build_list_package.update_attributes(version: '3.0.999') 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 end
it 'published: 3.0.0, new: 3.0.rc1' do it 'published: 3.0.0, new: 3.0.rc1' do
published_build_list_package.update_attributes(version: '3.0.0') published_build_list_package.update_attributes(version: '3.0.0')
build_list_package.update_attributes(version: '3.0.rc1') 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
end end
@ -260,25 +260,25 @@ describe BuildList do
it 'published: 3.1.11, new: 3.1.12' do it 'published: 3.1.11, new: 3.1.12' do
published_build_list_package.update_attributes(version: '3.1.11') 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 end
it 'published: 3.0.999, new: 3.1.12' do it 'published: 3.0.999, new: 3.1.12' do
published_build_list_package.update_attributes(version: '3.0.999') 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 end
it 'published: 3.0.rc1, new: 3.0.0' do it 'published: 3.0.rc1, new: 3.0.0' do
published_build_list_package.update_attributes(version: '3.0.rc1') published_build_list_package.update_attributes(version: '3.0.rc1')
build_list_package.update_attributes(version: '3.0.0') 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
end end
it 'ensures that return true if release of published package <' do it 'ensures that return true if release of published package <' do
published_build_list_package.update_attributes(release: 5) 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
end end
@ -292,22 +292,22 @@ describe BuildList do
end end
it 'returns true for eligible build' do it 'returns true for eligible build' do
expect(build_list.can_publish?).to be_true expect(build_list.can_publish?).to be_truthy
end end
it 'returns false if branch invalid' do it 'returns false if branch invalid' do
allow(build_list).to receive(:valid_branch_for_publish?).and_return(false) 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 end
it 'returns false if extra builds not published' do it 'returns false if extra builds not published' do
allow(build_list).to receive(:extra_build_lists_published?).and_return(false) 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 end
it 'returns false if project does not exist in repository' do it 'returns false if project does not exist in repository' do
build_list.stub_chain(:save_to_repository, :projects, :exists?).and_return(false) 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
end end
@ -320,12 +320,12 @@ describe BuildList do
it 'returns true for eligible build' do it 'returns true for eligible build' do
allow(build_list).to receive(:valid_branch_for_publish?).and_return(true) 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 end
it 'returns false if branch invalid' do it 'returns false if branch invalid' do
allow(build_list).to receive(:valid_branch_for_publish?).and_return(false) 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
end end

View File

@ -31,7 +31,7 @@ describe CanCan do
end end
it 'should manage all' do 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) @ability.should be_able_to(:manage, :all)
end end

View File

@ -170,8 +170,8 @@ describe Comment do
it 'should create automatic comment by issue title' do it 'should create automatic comment by issue title' do
issue = FactoryGirl.create(:issue, project: @project, user: @user, issue = FactoryGirl.create(:issue, project: @project, user: @user,
title: "link to ##{@issue.serial_id}") title: "link to ##{@issue.serial_id}")
Comment.where(automatic: true, expect(Comment.where(automatic: true,
created_from_issue_id: issue.id).should have(1).item created_from_issue_id: issue.id).count).to eq 1
end end
it 'should create automatic comment from issue body' do it 'should create automatic comment from issue body' do

View File

@ -15,7 +15,7 @@ describe KeyPair do
describe 'check_keys validation' do describe 'check_keys validation' do
subject { FactoryGirl.build(:key_pair) } 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 it 'checks error when wrong public key' do
subject.public = 'test' subject.public = 'test'
subject.valid? subject.valid?

View File

@ -6,7 +6,7 @@ describe MassBuild do
context 'ensures that validations and associations exist' do context 'ensures that validations and associations exist' do
it 'is valid given valid attributes' do it 'is valid given valid attributes' do
FactoryGirl.create(:mass_build).should be_true FactoryGirl.create(:mass_build).should be_truthy
end end
it { should belong_to(:build_for_platform) } 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 = FactoryGirl.build(:mass_build, projects_list: projects_list)
mass_build.should be_valid mass_build.should be_valid
list = mass_build.projects_list.split(/[\r]*\n/) list = mass_build.projects_list.split(/[\r]*\n/)
list.should have(2).items expect(list.count).to eq 2
list.should include('at', 'ab') list.should include('at', 'ab')
end end

View File

@ -14,13 +14,13 @@ describe PlatformContent do
it 'ensures that finds files' do it 'ensures that finds files' do
# + /repository folder # + /repository folder
subject.find_by_platform(platform, '', '').should have(3).items expect(subject.find_by_platform(platform, '', '').count).to eq 3
end end
context 'ensures that finds files by name' do context 'ensures that finds files by name' do
it { subject.find_by_platform(platform, '', 'test').should have(2).items } it { expect(subject.find_by_platform(platform, '', 'test').count).to eq 2 }
it { subject.find_by_platform(platform, '', 'test001').should have(1).item } it { expect(subject.find_by_platform(platform, '', 'test001').count).to eq 1 }
it { subject.find_by_platform(platform, 'repository', 'test').should have(:no).items } it { expect(subject.find_by_platform(platform, 'repository', 'test').count).to eq 0 }
end end
end end
@ -28,13 +28,13 @@ describe PlatformContent do
context '#is_folder?' do context '#is_folder?' do
it 'ensures that returns true for folder' do it 'ensures that returns true for folder' do
subject.find_by_platform(platform, '', 'repository').first.is_folder? subject.find_by_platform(platform, '', 'repository').first.is_folder?
.should be_true .should be_truthy
end end
it 'ensures that returns false for file' do it 'ensures that returns false for file' do
File.open(File.join(platform.path, 'test001'), "w") File.open(File.join(platform.path, 'test001'), "w")
subject.find_by_platform(platform, '', 'test').first.is_folder? subject.find_by_platform(platform, '', 'test').first.is_folder?
.should be_false .should be_falsy
end end
end end

View File

@ -4,18 +4,18 @@ describe Platform do
before { stub_symlink_methods } before { stub_symlink_methods }
context 'ensures that validations and associations exist' do 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 belong_to(:owner) }
it { should have_many(:members)} it { should have_many(:members)}
it { should have_many(:repositories)} it { should have_many(:repositories)}
it { should have_many(:products)} it { should have_many(:products)}
it { should validate_presence_of(:name)} 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 allow_value('Basic_platform-name-1234').for(:name) }
it { should_not allow_value('.!').for(:name) } it { should_not allow_value('.!').for(:name) }
it { should validate_presence_of(:default_branch)} it { should validate_presence_of(:default_branch)}
@ -26,12 +26,12 @@ describe Platform do
Platform::VISIBILITIES.each do |value| Platform::VISIBILITIES.each do |value|
it {should allow_value(value).for(:visibility)} it {should allow_value(value).for(:visibility)}
end 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| ['', nil] + Platform::AUTOMATIC_METADATA_REGENERATIONS.each do |value|
it {should allow_value(value).for(:automatic_metadata_regeneration)} it {should allow_value(value).for(:automatic_metadata_regeneration)}
end 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) } it { should have_readonly_attribute(:name) }
@ -51,27 +51,27 @@ describe Platform do
platform = FactoryGirl.create :platform platform = FactoryGirl.create :platform
FileUtils.mkdir_p platform.path FileUtils.mkdir_p platform.path
platform.destroy platform.destroy
Dir.exists?(platform.path).should be_false Dir.exists?(platform.path).should be_falsy
end end
it 'ensures that owner of personal platform can not be changed' do it 'ensures that owner of personal platform can not be changed' do
platform = FactoryGirl.create :personal_platform platform = FactoryGirl.create :personal_platform
owner = platform.owner owner = platform.owner
platform.owner = FactoryGirl.create :user platform.owner = FactoryGirl.create :user
platform.save.should be_false platform.save.should be_falsy
end end
it 'ensures that owner of platform of group can not be changed' do it 'ensures that owner of platform of group can not be changed' do
group = FactoryGirl.create :group group = FactoryGirl.create :group
platform = FactoryGirl.create :personal_platform, owner: group platform = FactoryGirl.create :personal_platform, owner: group
platform.owner = FactoryGirl.create :user platform.owner = FactoryGirl.create :user
platform.save.should be_false platform.save.should be_falsy
end end
it 'ensures that owner of main platform can be changed' do it 'ensures that owner of main platform can be changed' do
platform = FactoryGirl.create :platform platform = FactoryGirl.create :platform
platform.owner = FactoryGirl.create :user platform.owner = FactoryGirl.create :user
platform.save.should be_true platform.save.should be_truthy
end end
end end

View File

@ -12,7 +12,7 @@ describe ProductBuildList do
it 'is valid given valid attributes' do it 'is valid given valid attributes' do
arch = FactoryGirl.create(:arch, name: 'x86_64') arch = FactoryGirl.create(:arch, name: 'x86_64')
allow(Arch).to receive(:find_by).with(name: 'x86_64').and_return(arch) 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 end
it { should belong_to(:product) } it { should belong_to(:product) }

View File

@ -9,7 +9,7 @@ describe Product do
it 'is valid given valid attributes' do it 'is valid given valid attributes' do
# arch = FactoryGirl.create(:arch, name: 'x86_64') # arch = FactoryGirl.create(:arch, name: 'x86_64')
# allow(Arch).to receive(:find_by).with(name: 'x86_64').and_return(arch) # 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 end
it { should belong_to(:platform) } it { should belong_to(:platform) }
@ -57,7 +57,7 @@ describe Product do
it 'product should has product_build_list' do it 'product should has product_build_list' do
Product.autostart_iso_builds Product::ONCE_A_12_HOURS 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
end end

View File

@ -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 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 = FactoryGirl.create(:project, owner: user, is_package: false)
project.repositories.should have(:no).items expect(project.repositories.count).to eq 0
end end
it "ensures that personal repository has been attached when project had been updated as package" do 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 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 = FactoryGirl.create(:project, owner: user, is_package: true)
project.update_attribute(:is_package, false) project.update_attribute(:is_package, false)
project.repositories.should have(:no).items expect(project.repositories.count).to eq 0
end end
end end
@ -126,7 +126,7 @@ describe Project do
let!(:project) { FactoryGirl.build(:project, name: ' test_name ') } let!(:project) { FactoryGirl.build(:project, name: ' test_name ') }
it 'ensures that validation passed' do it 'ensures that validation passed' do
project.valid?.should be_true project.valid?.should be_truthy
end end
it 'ensures that name has been truncated' do 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 it 'ensures that path to git repository has been changed after rename of project' do
project = FactoryGirl.create(:project_with_commit) project = FactoryGirl.create(:project_with_commit)
project.update_attributes(name: "#{project.name}-new") project.update_attributes(name: "#{project.name}-new")
Dir.exists?(project.path).should be_true Dir.exists?(project.path).should be_truthy
end end
context 'manage branches' do context 'manage branches' do
@ -157,7 +157,7 @@ describe Project do
context '#delete_branch' do context '#delete_branch' do
it 'ensures that returns true on success' 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 end
it 'ensures that branch has been deleted' do it 'ensures that branch has been deleted' do
@ -165,7 +165,7 @@ describe Project do
end end
it 'ensures that returns false on delete master' do 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 end
it 'ensures that master has not been deleted' do 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 it 'ensures that returns false on delete wrong branch' do
project.delete_branch(branch, user) project.delete_branch(branch, user)
project.delete_branch(branch, user).should be_false project.delete_branch(branch, user).should be_falsy
end end
end end
@ -184,7 +184,7 @@ describe Project do
end end
it 'ensures that returns true on success' do 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 end
it 'ensures that branch has been created' do it 'ensures that branch has been created' do
@ -192,7 +192,7 @@ describe Project do
end end
it 'ensures that returns false on create wrong branch' do 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
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.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 Project.count.should == 2
repository.projects.should have(2).items expect(repository.projects.count).to eq 2
owner.projects.should have(2).items expect(owner.projects.count).to eq 2
end end
end end
@ -261,8 +261,8 @@ describe Project do
FactoryGirl.create(:platform_arch_setting, platform: repository.platform, default: false) FactoryGirl.create(:platform_arch_setting, platform: repository.platform, default: false)
end end
it { ProjectToRepository.autostart_enabled.should have(1).item } it { expect(ProjectToRepository.autostart_enabled.count).to eq 1 }
it { repository.platform.platform_arch_settings.should have(2).item } it { expect(repository.platform.platform_arch_settings.count).to eq 2 }
context 'once_a_12_hours' do context 'once_a_12_hours' do
before { project.update_attributes(autostart_status: Autostart::ONCE_A_12_HOURS) } before { project.update_attributes(autostart_status: Autostart::ONCE_A_12_HOURS) }
@ -317,8 +317,8 @@ describe Project do
end end
# 1(personal) + 2(main) + 1(hidden) + 1(main, without main repository) # 1(personal) + 2(main) + 1(hidden) + 1(main, without main repository)
it { ProjectToRepository.autostart_enabled.should have(5).item } it { expect(ProjectToRepository.autostart_enabled.count).to eq 5 }
it { main_repository.platform.platform_arch_settings.should have(2).item } it { expect(main_repository.platform.platform_arch_settings.count).to eq 2 }
# into main platforms: 2 + 1(hidden) # into main platforms: 2 + 1(hidden)
# into personal platform: 3(main) * 1 # into personal platform: 3(main) * 1

View File

@ -37,7 +37,7 @@ describe PullRequest do
@pull.check @pull.check
@project.update_attributes(name: "#{@project.name}-new") @project.update_attributes(name: "#{@project.name}-new")
@pull.reload @pull.reload
Dir.exists?(@pull.path).should be_true Dir.exists?(@pull.path).should be_truthy
end end
it 'master should merge with non_conflicts branch' do it 'master should merge with non_conflicts branch' do

View File

@ -8,7 +8,7 @@ describe Repository do
context 'ensures that validations and associations exist' do context 'ensures that validations and associations exist' do
it 'is valid given valid attributes' do it 'is valid given valid attributes' do
repository.should be_true repository.should be_truthy
end end
it { should belong_to(:platform) } it { should belong_to(:platform) }
@ -42,34 +42,34 @@ describe Repository do
before { FileUtils.mkdir_p path } before { FileUtils.mkdir_p path }
it 'ensures that #sync_lock_file_exists? returns false if .sync.lock file does not exist' do 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 end
it 'ensures that #sync_lock_file_exists? returns true if .sync.lock file does exist' do it 'ensures that #sync_lock_file_exists? returns true if .sync.lock file does exist' do
FileUtils.touch "#{path}/.sync.lock" FileUtils.touch "#{path}/.sync.lock"
repository.sync_lock_file_exists?.should be_true repository.sync_lock_file_exists?.should be_truthy
end end
it 'ensures that #add_sync_lock_file creates .sync.lock file' do it 'ensures that #add_sync_lock_file creates .sync.lock file' do
repository.add_sync_lock_file repository.add_sync_lock_file
File.exist?("#{path}/.sync.lock").should be_true File.exist?("#{path}/.sync.lock").should be_truthy
end end
it 'ensures that #remove_sync_lock_file removes .sync.lock file' do it 'ensures that #remove_sync_lock_file removes .sync.lock file' do
FileUtils.touch "#{path}/.sync.lock" FileUtils.touch "#{path}/.sync.lock"
repository.remove_sync_lock_file repository.remove_sync_lock_file
File.exist?("#{path}/.sync.lock").should be_false File.exist?("#{path}/.sync.lock").should be_falsy
end end
it 'ensures that #add_repo_lock_file creates .repo.lock file' do it 'ensures that #add_repo_lock_file creates .repo.lock file' do
repository.add_repo_lock_file repository.add_repo_lock_file
File.exist?("#{path}/.repo.lock").should be_true File.exist?("#{path}/.repo.lock").should be_truthy
end end
it 'ensures that #remove_repo_lock_file removes .repo.lock file' do it 'ensures that #remove_repo_lock_file removes .repo.lock file' do
FileUtils.touch "#{path}/.repo.lock" FileUtils.touch "#{path}/.repo.lock"
repository.remove_repo_lock_file repository.remove_repo_lock_file
File.exist?("#{path}/.repo.lock").should be_false File.exist?("#{path}/.repo.lock").should be_falsy
end end
end end
@ -97,7 +97,7 @@ describe Repository do
map{ |type| "#{r.platform.path}/repository/#{type}/#{r.name}" }. map{ |type| "#{r.platform.path}/repository/#{type}/#{r.name}" }.
each{ |path| FileUtils.mkdir_p path } each{ |path| FileUtils.mkdir_p path }
r.destroy r.destroy
paths.each{ |path| Dir.exists?(path).should be_false } paths.each{ |path| Dir.exists?(path).should be_falsy }
end end
it "repository of personal platform" do 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}" }. map{ |type| "#{r.platform.path}/repository/#{main_platform.name}/#{type}/#{r.name}" }.
each{ |path| FileUtils.mkdir_p path } each{ |path| FileUtils.mkdir_p path }
r.destroy r.destroy
paths.each{ |path| Dir.exists?(path).should be_false } paths.each{ |path| Dir.exists?(path).should be_falsy }
end end
end end
@ -118,14 +118,14 @@ describe Repository do
repository = FactoryGirl.create(:repository) repository = FactoryGirl.create(:repository)
project = FactoryGirl.create(:project) project = FactoryGirl.create(:project)
repository.add_projects(project.name_with_owner, FactoryGirl.create(:user)) repository.add_projects(project.name_with_owner, FactoryGirl.create(:user))
repository.projects.should have(1).item expect(repository.projects.count).to eq 1
end end
it 'user has no ability to read of adding project' do it 'user has no ability to read of adding project' do
repository = FactoryGirl.create(:repository) repository = FactoryGirl.create(:repository)
project = FactoryGirl.create(:project, visibility: 'hidden') project = FactoryGirl.create(:project, visibility: 'hidden')
repository.add_projects(project.name_with_owner, FactoryGirl.create(:user)) 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
end end
@ -135,7 +135,7 @@ describe Repository do
repository.projects << project repository.projects << project
repository.remove_projects(project.name) repository.remove_projects(project.name)
repository.reload repository.reload
repository.projects.should have(:no).items expect(repository.projects.count).to eq 0
end end
end end

View File

@ -37,7 +37,7 @@ describe Statistic do
) )
} }
end.should_not raise_exception end.should_not raise_exception
expect(Statistic).to have(1).item expect(Statistic.count).to eq 1
expect(Statistic.first.counter).to eq 2 expect(Statistic.first.counter).to eq 2
end end
end end
@ -52,8 +52,8 @@ describe Statistic do
FactoryGirl.create(:statistic, project: project1) FactoryGirl.create(:statistic, project: project1)
FactoryGirl.create(:statistic, project: project2) FactoryGirl.create(:statistic, project: project2)
expect(Statistic.for_groups([group1.id])).to have(1).item expect(Statistic.for_groups([group1.id]).count).to eq 1
expect(Statistic.for_groups([group1.id, group2])).to have(2).items expect(Statistic.for_groups([group1.id, group2]).count).to eq 2
end end
end end

View File

@ -22,7 +22,7 @@ describe Token do
it 'ensures that authentication_token unique' do it 'ensures that authentication_token unique' do
token = FactoryGirl.create(:platform_token) token = FactoryGirl.create(:platform_token)
token.authentication_token = platform_token.authentication_token token.authentication_token = platform_token.authentication_token
token.valid?.should be_false token.valid?.should be_falsy
end end
end end
end end

View File

@ -57,17 +57,17 @@ describe AbfWorkerService::Rpm do
it "ensures that repository_status has status publish" do it "ensures that repository_status has status publish" do
build_list.save_to_repository.repository_statuses. build_list.save_to_repository.repository_statuses.
find_by(platform_id: build_list.build_for_platform_id).publish?. find_by(platform_id: build_list.build_for_platform_id).publish?.
should be_true should be_truthy
end end
it "ensures that 'locked build lists' has only one item" do it "ensures that 'locked build lists' has only one item" do
queue = @redis_instance.lrange(subject::LOCKED_BUILD_LISTS, 0, -1) 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) queue.should include(build_list.id.to_s)
end end
it "ensures that new task for publishing has been created" do 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
end end
@ -86,14 +86,14 @@ describe AbfWorkerService::Rpm do
subject.publish! subject.publish!
subject.publish! subject.publish!
RepositoryStatus.where(status: RepositoryStatus::PUBLISH).should have(4).items expect(RepositoryStatus.where(status: RepositoryStatus::PUBLISH).count).to eq 4
end end
it "ensures that 'locked build lists' has 4 items" do it "ensures that 'locked build lists' has 4 items" do
subject.publish! subject.publish!
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 end
it "ensures that new tasks for publishing has been created" do 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 it "ensures that only one repository_status has status publish" do
subject.publish! subject.publish!
subject.publish! subject.publish!
RepositoryStatus.where(status: RepositoryStatus::PUBLISH).should have(1).item expect(RepositoryStatus.where(status: RepositoryStatus::PUBLISH).count).to eq 1
end end
it "ensures that 'locked build lists' has 2 items" do it "ensures that 'locked build lists' has 2 items" do
subject.publish! subject.publish!
subject.publish! subject.publish!
queue = @redis_instance.lrange(subject::LOCKED_BUILD_LISTS, 0, -1) 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) queue.should include(build_list.id.to_s, build_list2.id.to_s)
end end
@ -173,7 +173,7 @@ describe AbfWorkerService::Rpm do
subject.publish! subject.publish!
queue = @redis_instance.lrange(subject::PROJECTS_FOR_CLEANUP, 0, -1) 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}") queue.should include("testing-#{build_list3.project_id}-#{build_list3.save_to_repository_id}-#{build_list3.build_for_platform_id}")
end end
@ -181,7 +181,7 @@ describe AbfWorkerService::Rpm do
subject.publish! subject.publish!
subject.publish! subject.publish!
RepositoryStatus.where(status: RepositoryStatus::PUBLISH).should have(1).item expect(RepositoryStatus.where(status: RepositoryStatus::PUBLISH).count).to eq 1
end end
it "ensures that 'locked projects for cleanup' has only one item" do it "ensures that 'locked projects for cleanup' has only one item" do
@ -189,7 +189,7 @@ describe AbfWorkerService::Rpm do
subject.publish! subject.publish!
queue = @redis_instance.lrange(subject::LOCKED_PROJECTS_FOR_CLEANUP, 0, -1) 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}") queue.should include("#{build_list3.project_id}-#{build_list3.save_to_repository_id}-#{build_list3.build_for_platform_id}")
end end
@ -205,7 +205,7 @@ describe AbfWorkerService::Rpm do
subject.publish! subject.publish!
queue = @redis_instance.lrange(subject::LOCKED_BUILD_LISTS, 0, -1) 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) queue.should include(build_list.id.to_s)
end end
end end

View File

@ -12,17 +12,17 @@ describe FileStoreService::File do
it 'returns true if file exists' do it 'returns true if file exists' do
stub_request(:get, url).to_return(body: response) stub_request(:get, url).to_return(body: response)
expect(subject.exist?).to be_true expect(subject.exist?).to be_truthy
end end
it 'returns false if file does not exist' do it 'returns false if file does not exist' do
stub_request(:get, url).to_return(body: '[]') stub_request(:get, url).to_return(body: '[]')
expect(subject.exist?).to be_false expect(subject.exist?).to be_falsy
end end
it 'returns false on error' do it 'returns false on error' do
stub_request(:get, url).to_raise(StandardError) stub_request(:get, url).to_raise(StandardError)
expect(subject.exist?).to be_false expect(subject.exist?).to be_falsy
end end
end end

View File

@ -16,7 +16,16 @@ RSpec.configure do |config|
# config.mock_with :mocha # config.mock_with :mocha
# config.mock_with :flexmock # config.mock_with :flexmock
# config.mock_with :rr # 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 # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures" config.fixture_path = "#{::Rails.root}/spec/fixtures"