diff options
author | Rémy Coutable <remy@rymai.me> | 2017-07-25 11:08:26 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-07-25 11:08:26 +0300 |
commit | e43bda0ebb56991f9f128946fefed375a695eac1 (patch) | |
tree | 3a90bf088b2b13d999e5b012ceaa5d85de14c38e | |
parent | 1897aafdf8bada00f171e38558444265ccbadbaa (diff) | |
parent | 3a0b9e06e1dd5f6141a6f04dd2b39dbb803c07f1 (diff) |
Merge branch 'dz-update-shoulda' into 'master'
Update shoulda-matchers gem to 3.1.2
See merge request !13040
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | Gemfile.lock | 6 | ||||
-rw-r--r-- | spec/controllers/projects/issues_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/controllers/projects/merge_requests_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/controllers/sent_notifications_controller_spec.rb | 6 | ||||
-rw-r--r-- | spec/models/list_spec.rb | 6 | ||||
-rw-r--r-- | spec/models/notification_setting_spec.rb | 9 | ||||
-rw-r--r-- | spec/models/pages_domain_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/redirect_route_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/route_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 4 | ||||
-rw-r--r-- | spec/spec_helper.rb | 7 |
12 files changed, 30 insertions, 20 deletions
@@ -353,7 +353,7 @@ group :development, :test do end group :test do - gem 'shoulda-matchers', '~> 2.8.0', require: false + gem 'shoulda-matchers', '~> 3.1.2', require: false gem 'email_spec', '~> 1.6.0' gem 'json-schema', '~> 2.6.2' gem 'webmock', '~> 2.3.2' diff --git a/Gemfile.lock b/Gemfile.lock index 6ffff0d8735..f6c1636dfaf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -774,8 +774,8 @@ GEM sexp_processor (4.9.0) sham_rack (1.3.6) rack - shoulda-matchers (2.8.0) - activesupport (>= 3.0.0) + shoulda-matchers (3.1.2) + activesupport (>= 4.0.0) sidekiq (5.0.4) concurrent-ruby (~> 1.0) connection_pool (~> 2.2, >= 2.2.0) @@ -1084,7 +1084,7 @@ DEPENDENCIES sentry-raven (~> 2.5.3) settingslogic (~> 2.0.9) sham_rack (~> 1.3.6) - shoulda-matchers (~> 2.8.0) + shoulda-matchers (~> 3.1.2) sidekiq (~> 5.0) sidekiq-cron (~> 0.6.0) sidekiq-limit_fetch (~> 3.4) diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index e56f5d11daf..2c57f3bcf8d 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -827,7 +827,7 @@ describe Projects::IssuesController do delete :destroy, namespace_id: project.namespace, project_id: project, id: issue.iid expect(response).to have_http_status(302) - expect(controller).to set_flash[:notice].to(/The issue was successfully deleted\./).now + expect(controller).to set_flash[:notice].to(/The issue was successfully deleted\./) end it 'delegates the update of the todos count cache to TodoService' do diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index c193babead0..2fce4b7a85f 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -439,7 +439,7 @@ describe Projects::MergeRequestsController do delete :destroy, namespace_id: project.namespace, project_id: project, id: merge_request.iid expect(response).to have_http_status(302) - expect(controller).to set_flash[:notice].to(/The merge request was successfully deleted\./).now + expect(controller).to set_flash[:notice].to(/The merge request was successfully deleted\./) end it 'delegates the update of the todos count cache to TodoService' do diff --git a/spec/controllers/sent_notifications_controller_spec.rb b/spec/controllers/sent_notifications_controller_spec.rb index 7340a4e16c0..c8771eda313 100644 --- a/spec/controllers/sent_notifications_controller_spec.rb +++ b/spec/controllers/sent_notifications_controller_spec.rb @@ -23,7 +23,7 @@ describe SentNotificationsController, type: :controller do end it 'sets the flash message' do - expect(controller).to set_flash[:notice].to(/unsubscribed/).now + expect(controller).to set_flash[:notice].to(/unsubscribed/) end it 'redirects to the login page' do @@ -83,7 +83,7 @@ describe SentNotificationsController, type: :controller do end it 'sets the flash message' do - expect(controller).to set_flash[:notice].to(/unsubscribed/).now + expect(controller).to set_flash[:notice].to(/unsubscribed/) end it 'redirects to the issue page' do @@ -109,7 +109,7 @@ describe SentNotificationsController, type: :controller do end it 'sets the flash message' do - expect(controller).to set_flash[:notice].to(/unsubscribed/).now + expect(controller).to set_flash[:notice].to(/unsubscribed/) end it 'redirects to the merge request page' do diff --git a/spec/models/list_spec.rb b/spec/models/list_spec.rb index db2c2619968..a6cc01bea5f 100644 --- a/spec/models/list_spec.rb +++ b/spec/models/list_spec.rb @@ -13,12 +13,6 @@ describe List do it { is_expected.to validate_presence_of(:position) } it { is_expected.to validate_numericality_of(:position).only_integer.is_greater_than_or_equal_to(0) } - it 'validates uniqueness of label scoped to board_id' do - create(:list) - - expect(subject).to validate_uniqueness_of(:label_id).scoped_to(:board_id) - end - context 'when list_type is set to closed' do subject { described_class.new(list_type: :closed) } diff --git a/spec/models/notification_setting_spec.rb b/spec/models/notification_setting_spec.rb index cc235ad467e..76a7b07949f 100644 --- a/spec/models/notification_setting_spec.rb +++ b/spec/models/notification_setting_spec.rb @@ -11,7 +11,14 @@ RSpec.describe NotificationSetting, type: :model do it { is_expected.to validate_presence_of(:user) } it { is_expected.to validate_presence_of(:level) } - it { is_expected.to validate_uniqueness_of(:user_id).scoped_to([:source_id, :source_type]).with_message(/already exists in source/) } + + describe 'user_id' do + before do + subject.user = create(:user) + end + + it { is_expected.to validate_uniqueness_of(:user_id).scoped_to([:source_type, :source_id]).with_message(/already exists in source/) } + end context "events" do let(:user) { create(:user) } diff --git a/spec/models/pages_domain_spec.rb b/spec/models/pages_domain_spec.rb index f9d060d4e0e..d4a777a9bd9 100644 --- a/spec/models/pages_domain_spec.rb +++ b/spec/models/pages_domain_spec.rb @@ -11,7 +11,7 @@ describe PagesDomain, models: true do context 'is unique' do let(:domain) { 'my.domain.com' } - it { is_expected.to validate_uniqueness_of(:domain) } + it { is_expected.to validate_uniqueness_of(:domain).case_insensitive } end { diff --git a/spec/models/redirect_route_spec.rb b/spec/models/redirect_route_spec.rb index 71827421dd7..a97af28cb8e 100644 --- a/spec/models/redirect_route_spec.rb +++ b/spec/models/redirect_route_spec.rb @@ -11,7 +11,7 @@ describe RedirectRoute, models: true do describe 'validations' do it { is_expected.to validate_presence_of(:source) } it { is_expected.to validate_presence_of(:path) } - it { is_expected.to validate_uniqueness_of(:path) } + it { is_expected.to validate_uniqueness_of(:path).case_insensitive } end describe '.matching_path_and_descendants' do diff --git a/spec/models/route_spec.rb b/spec/models/route_spec.rb index 1754253e0f2..12f7611fb28 100644 --- a/spec/models/route_spec.rb +++ b/spec/models/route_spec.rb @@ -15,7 +15,7 @@ describe Route, models: true do it { is_expected.to validate_presence_of(:source) } it { is_expected.to validate_presence_of(:path) } - it { is_expected.to validate_uniqueness_of(:path) } + it { is_expected.to validate_uniqueness_of(:path).case_insensitive } end describe 'callbacks' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index a1d6d7e6e0b..20bdb7e37da 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -114,7 +114,9 @@ describe User, models: true do end it 'validates uniqueness' do - expect(subject).to validate_uniqueness_of(:username).case_insensitive + user = build(:user) + + expect(user).to validate_uniqueness_of(:username).case_insensitive end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5d5715b10ff..e7329210896 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -148,3 +148,10 @@ FactoryGirl::SyntaxRunner.class_eval do end ActiveRecord::Migration.maintain_test_schema! + +Shoulda::Matchers.configure do |config| + config.integrate do |with| + with.test_framework :rspec + with.library :rails + end +end |