Commit e43bda0e authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'dz-update-shoulda' into 'master'

Update shoulda-matchers gem to 3.1.2

See merge request !13040
parents 1897aafd 3a0b9e06
...@@ -353,7 +353,7 @@ group :development, :test do ...@@ -353,7 +353,7 @@ group :development, :test do
end end
group :test do 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 'email_spec', '~> 1.6.0'
gem 'json-schema', '~> 2.6.2' gem 'json-schema', '~> 2.6.2'
gem 'webmock', '~> 2.3.2' gem 'webmock', '~> 2.3.2'
......
...@@ -774,8 +774,8 @@ GEM ...@@ -774,8 +774,8 @@ GEM
sexp_processor (4.9.0) sexp_processor (4.9.0)
sham_rack (1.3.6) sham_rack (1.3.6)
rack rack
shoulda-matchers (2.8.0) shoulda-matchers (3.1.2)
activesupport (>= 3.0.0) activesupport (>= 4.0.0)
sidekiq (5.0.4) sidekiq (5.0.4)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0) connection_pool (~> 2.2, >= 2.2.0)
...@@ -1084,7 +1084,7 @@ DEPENDENCIES ...@@ -1084,7 +1084,7 @@ DEPENDENCIES
sentry-raven (~> 2.5.3) sentry-raven (~> 2.5.3)
settingslogic (~> 2.0.9) settingslogic (~> 2.0.9)
sham_rack (~> 1.3.6) sham_rack (~> 1.3.6)
shoulda-matchers (~> 2.8.0) shoulda-matchers (~> 3.1.2)
sidekiq (~> 5.0) sidekiq (~> 5.0)
sidekiq-cron (~> 0.6.0) sidekiq-cron (~> 0.6.0)
sidekiq-limit_fetch (~> 3.4) sidekiq-limit_fetch (~> 3.4)
......
...@@ -827,7 +827,7 @@ describe Projects::IssuesController do ...@@ -827,7 +827,7 @@ describe Projects::IssuesController do
delete :destroy, namespace_id: project.namespace, project_id: project, id: issue.iid delete :destroy, namespace_id: project.namespace, project_id: project, id: issue.iid
expect(response).to have_http_status(302) 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 end
it 'delegates the update of the todos count cache to TodoService' do it 'delegates the update of the todos count cache to TodoService' do
......
...@@ -439,7 +439,7 @@ describe Projects::MergeRequestsController do ...@@ -439,7 +439,7 @@ describe Projects::MergeRequestsController do
delete :destroy, namespace_id: project.namespace, project_id: project, id: merge_request.iid delete :destroy, namespace_id: project.namespace, project_id: project, id: merge_request.iid
expect(response).to have_http_status(302) 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 end
it 'delegates the update of the todos count cache to TodoService' do it 'delegates the update of the todos count cache to TodoService' do
......
...@@ -23,7 +23,7 @@ describe SentNotificationsController, type: :controller do ...@@ -23,7 +23,7 @@ describe SentNotificationsController, type: :controller do
end end
it 'sets the flash message' do it 'sets the flash message' do
expect(controller).to set_flash[:notice].to(/unsubscribed/).now expect(controller).to set_flash[:notice].to(/unsubscribed/)
end end
it 'redirects to the login page' do it 'redirects to the login page' do
...@@ -83,7 +83,7 @@ describe SentNotificationsController, type: :controller do ...@@ -83,7 +83,7 @@ describe SentNotificationsController, type: :controller do
end end
it 'sets the flash message' do it 'sets the flash message' do
expect(controller).to set_flash[:notice].to(/unsubscribed/).now expect(controller).to set_flash[:notice].to(/unsubscribed/)
end end
it 'redirects to the issue page' do it 'redirects to the issue page' do
...@@ -109,7 +109,7 @@ describe SentNotificationsController, type: :controller do ...@@ -109,7 +109,7 @@ describe SentNotificationsController, type: :controller do
end end
it 'sets the flash message' do it 'sets the flash message' do
expect(controller).to set_flash[:notice].to(/unsubscribed/).now expect(controller).to set_flash[:notice].to(/unsubscribed/)
end end
it 'redirects to the merge request page' do it 'redirects to the merge request page' do
......
...@@ -13,12 +13,6 @@ describe List do ...@@ -13,12 +13,6 @@ describe List do
it { is_expected.to validate_presence_of(:position) } 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 { 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 context 'when list_type is set to closed' do
subject { described_class.new(list_type: :closed) } subject { described_class.new(list_type: :closed) }
......
...@@ -11,7 +11,14 @@ RSpec.describe NotificationSetting, type: :model do ...@@ -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(:user) }
it { is_expected.to validate_presence_of(:level) } 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 context "events" do
let(:user) { create(:user) } let(:user) { create(:user) }
......
...@@ -11,7 +11,7 @@ describe PagesDomain, models: true do ...@@ -11,7 +11,7 @@ describe PagesDomain, models: true do
context 'is unique' do context 'is unique' do
let(:domain) { 'my.domain.com' } let(:domain) { 'my.domain.com' }
it { is_expected.to validate_uniqueness_of(:domain) } it { is_expected.to validate_uniqueness_of(:domain).case_insensitive }
end end
{ {
......
...@@ -11,7 +11,7 @@ describe RedirectRoute, models: true do ...@@ -11,7 +11,7 @@ describe RedirectRoute, models: true do
describe 'validations' do describe 'validations' do
it { is_expected.to validate_presence_of(:source) } it { is_expected.to validate_presence_of(:source) }
it { is_expected.to validate_presence_of(:path) } 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 end
describe '.matching_path_and_descendants' do describe '.matching_path_and_descendants' do
......
...@@ -15,7 +15,7 @@ describe Route, models: true do ...@@ -15,7 +15,7 @@ describe Route, models: true do
it { is_expected.to validate_presence_of(:source) } it { is_expected.to validate_presence_of(:source) }
it { is_expected.to validate_presence_of(:path) } 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 end
describe 'callbacks' do describe 'callbacks' do
......
...@@ -114,7 +114,9 @@ describe User, models: true do ...@@ -114,7 +114,9 @@ describe User, models: true do
end end
it 'validates uniqueness' do 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
end end
......
...@@ -148,3 +148,10 @@ FactoryGirl::SyntaxRunner.class_eval do ...@@ -148,3 +148,10 @@ FactoryGirl::SyntaxRunner.class_eval do
end end
ActiveRecord::Migration.maintain_test_schema! ActiveRecord::Migration.maintain_test_schema!
Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
with.library :rails
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment