1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Compare commits

...

4 commits

Author SHA1 Message Date
Matt Jankowski
dff1d0753f
Merge db88595632 into 549ab089ee 2024-07-31 11:06:51 +00:00
Matt Jankowski
db88595632 Use validate_presence_of for Account.username spec 2024-07-19 09:22:18 -04:00
Matt Jankowski
9f758fe4b0 Configure shoulda matchers to integrate with rspec 2024-07-19 09:22:18 -04:00
Matt Jankowski
0f8ab46b62 Add shoulda-matchers gem 2024-07-19 09:22:18 -04:00
4 changed files with 14 additions and 5 deletions

View file

@ -155,6 +155,8 @@ group :test do
# Test harness fo rack components
gem 'rack-test', '~> 2.1'
gem 'shoulda-matchers'
# Coverage formatter for RSpec test if DISABLE_SIMPLECOV is false
gem 'simplecov', '~> 0.22', require: false
gem 'simplecov-lcov', '~> 0.8', require: false

View file

@ -790,6 +790,8 @@ GEM
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
semantic_range (3.0.0)
shoulda-matchers (6.2.0)
activesupport (>= 5.2.0)
sidekiq (6.5.12)
connection_pool (>= 2.2.5, < 3)
rack (~> 2.0)
@ -1038,6 +1040,7 @@ DEPENDENCIES
sanitize (~> 6.0)
scenic (~> 1.7)
selenium-webdriver
shoulda-matchers
sidekiq (~> 6.5)
sidekiq-bulk (~> 0.2.0)
sidekiq-scheduler (~> 5.0)

View file

@ -722,11 +722,7 @@ RSpec.describe Account do
end
describe 'validations' do
it 'is invalid without a username' do
account = Fabricate.build(:account, username: nil)
account.valid?
expect(account).to model_have_error_on_field(:username)
end
it { is_expected.to validate_presence_of(:username) }
it 'squishes the username before validation' do
account = Fabricate(:account, domain: nil, username: " \u3000bob \t \u00a0 \n ")

View file

@ -0,0 +1,8 @@
# frozen_string_literal: true
Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
with.library :rails
end
end