From ec3ea92870e43cbe7ddbbd70fc9642e1f9dfdcaa Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 19 Feb 2015 04:53:47 +0300 Subject: [PATCH] updated specs --- spec/controllers/platforms/platforms_controller_spec.rb | 4 ++-- spec/controllers/platforms/repositories_controller_spec.rb | 2 +- spec/factories/rpm_build_nodes.rb | 5 ++++- spec/integration/api_defender_spec.rb | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/spec/controllers/platforms/platforms_controller_spec.rb b/spec/controllers/platforms/platforms_controller_spec.rb index 61501144d..b893c8a32 100644 --- a/spec/controllers/platforms/platforms_controller_spec.rb +++ b/spec/controllers/platforms/platforms_controller_spec.rb @@ -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 @@ -249,7 +249,7 @@ shared_examples_for 'platform user with show rights' do end 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, default_branch: 'new_name'}} } before do stub_symlink_methods diff --git a/spec/controllers/platforms/repositories_controller_spec.rb b/spec/controllers/platforms/repositories_controller_spec.rb index 5a4de3700..070abec67 100644 --- a/spec/controllers/platforms/repositories_controller_spec.rb +++ b/spec/controllers/platforms/repositories_controller_spec.rb @@ -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 diff --git a/spec/factories/rpm_build_nodes.rb b/spec/factories/rpm_build_nodes.rb index 6bb155698..6809b7d97 100644 --- a/spec/factories/rpm_build_nodes.rb +++ b/spec/factories/rpm_build_nodes.rb @@ -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 diff --git a/spec/integration/api_defender_spec.rb b/spec/integration/api_defender_spec.rb index 4207cbbac..442e7fd23 100644 --- a/spec/integration/api_defender_spec.rb +++ b/spec/integration/api_defender_spec.rb @@ -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, '']