aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2023-12-20 20:57:41 +0000
committerMatthew Lemon <y@yulqen.org>2023-12-20 20:57:41 +0000
commit8152b66ea52909f634fb77092bf383d91017f05c (patch)
treea794d28636bc9baaf3a88120bb670d73974c6742
parent39248cd32ede354aec38e617415b432570f4f454 (diff)
Adds shoulda for rspec
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock3
-rw-r--r--spec/models/operation_spec.rb4
-rw-r--r--spec/rails_helper.rb7
4 files changed, 15 insertions, 0 deletions
diff --git a/Gemfile b/Gemfile
index 9638195..0bb0c51 100644
--- a/Gemfile
+++ b/Gemfile
@@ -53,6 +53,7 @@ group :development, :test do
gem 'rspec-rails', '~> 6.1.0'
gem 'factory_bot_rails'
gem 'faker'
+ gem 'shoulda-matchers', '~> 5.0'
end
group :development do
diff --git a/Gemfile.lock b/Gemfile.lock
index 0e3e61a..fd958c0 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -231,6 +231,8 @@ GEM
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
+ shoulda-matchers (5.3.0)
+ activesupport (>= 5.2.0)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
@@ -282,6 +284,7 @@ DEPENDENCIES
rails (~> 7.1.2)
rspec-rails (~> 6.1.0)
selenium-webdriver
+ shoulda-matchers (~> 5.0)
sprockets-rails
sqlite3 (~> 1.4)
stimulus-rails
diff --git a/spec/models/operation_spec.rb b/spec/models/operation_spec.rb
index 1293524..6c59f21 100644
--- a/spec/models/operation_spec.rb
+++ b/spec/models/operation_spec.rb
@@ -13,6 +13,10 @@ RSpec.describe Operation, type: :model do
# end
subject { described_class.new(name: "Spuds", organisation: organisation) }
+ describe "associations" do
+ it { should belong_to(:organisation).class_name('Organisation') }
+ end
+
describe "existence" do
it "exists!" do
expect(subject).to be_valid
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index b30b931..4ff79f4 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -36,6 +36,13 @@ RSpec.configure do |config|
Rails.root.join('spec/fixtures')
]
+ Shoulda::Matchers.configure do |config|
+ config.integrate do |with|
+ with.test_framework :rspec
+ with.library :rails
+ end
+ end
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.