Add shoulda-matchers and begin using

This commit is contained in:
Eric Schultz 2021-07-22 11:30:14 -05:00 committed by Eric Schultz
parent b7967fc5f6
commit dea870772d
5 changed files with 44 additions and 0 deletions

View file

@ -70,6 +70,7 @@ group :development, :ci, :test do
gem 'rubocop-rails', '~> 2.9' gem 'rubocop-rails', '~> 2.9'
gem 'rubocop-rake', '~> 0.5.1' gem 'rubocop-rake', '~> 0.5.1'
gem 'rubocop-rspec', '~> 2.2' gem 'rubocop-rspec', '~> 2.2'
gem 'shoulda-matchers', '~> 5.0.0'
end end
group :ci, :test do group :ci, :test do

View file

@ -364,6 +364,8 @@ GEM
sprockets-rails sprockets-rails
tilt tilt
semantic_range (3.0.0) semantic_range (3.0.0)
shoulda-matchers (5.0.0)
activesupport (>= 5.2.0)
sixarm_ruby_unaccent (1.2.0) sixarm_ruby_unaccent (1.2.0)
sprockets (3.7.2) sprockets (3.7.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
@ -465,6 +467,7 @@ DEPENDENCIES
rubocop-rspec (~> 2.2) rubocop-rspec (~> 2.2)
sassc (~> 2.0, >= 2.0.1) sassc (~> 2.0, >= 2.0.1)
sassc-rails (~> 2.1, >= 2.1.2) sassc-rails (~> 2.1, >= 2.1.2)
shoulda-matchers (~> 5.0.0)
sprockets (~> 3.7) sprockets (~> 3.7)
stripe (~> 1.58) stripe (~> 1.58)
stripe-ruby-mock (~> 2.4.1)! stripe-ruby-mock (~> 2.4.1)!

View file

@ -2591,6 +2591,35 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
------
** shoulda-matchers; version 5.0.0 --
Copyright/License ( copyright-license) About
Copyright (c) 2006-2021 Tammer Saleh and thoughtbot, inc.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
------ ------
** rack-proxy; version 0.6.5 -- ** rack-proxy; version 0.6.5 --

View file

@ -7,6 +7,10 @@ require 'rails_helper'
RSpec.describe Transaction, type: :model do RSpec.describe Transaction, type: :model do
include_context :shared_donation_charge_context include_context :shared_donation_charge_context
describe 'validation' do
it {is_expected.to validate_presence_of(:supporter)}
end
describe 'to_builder' do describe 'to_builder' do
subject { supporter.transactions.create( subject { supporter.transactions.create(
amount: 1000, amount: 1000,

View file

@ -74,4 +74,11 @@ RSpec.configure do |config|
config.include Devise::Test::ControllerHelpers, type: :controller config.include Devise::Test::ControllerHelpers, type: :controller
config.include Devise::Test::IntegrationHelpers, type: :request config.include Devise::Test::IntegrationHelpers, type: :request
config.include RSpec::Rails::RequestExampleGroup, type: :request, file_path: %r{spec/api} config.include RSpec::Rails::RequestExampleGroup, type: :request, file_path: %r{spec/api}
Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
with.library :rails
end
end
end end