Skip to content

Commit

Permalink
Merge pull request #87 from sleepingkingstudios/chore/migrate-relatio…
Browse files Browse the repository at this point in the history
…n-contracts

Chore/Migrate Relation contracts to deferred examples.
  • Loading branch information
sleepingkingstudios authored Nov 13, 2024
2 parents fa99485 + 61c8788 commit 85d4822
Show file tree
Hide file tree
Showing 20 changed files with 3,755 additions and 56 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ group :development, :test do
git: 'https://github.com/sleepingkingstudios/rspec-sleeping_king_studios.git',
branch: 'main'

gem 'rubocop', '~> 1.66'
gem 'rubocop-rspec', '~> 3.0'
gem 'rubocop', '~> 1.68'
gem 'rubocop-rspec', '~> 3.2'

gem 'simplecov', '~> 0.22'
end
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

module Cuprum::Collections::RSpec::Contracts
# Contracts for asserting on Association objects.
#
# @deprecated 0.5.0 Association contracts are deprecated. Use
# Deferred::AssociationExamples instead.
module AssociationContracts
# Contract validating the behavior of an Association.
module ShouldBeAnAssociationContract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

module Cuprum::Collections::RSpec::Contracts
# Contracts for asserting on Collection objects.
#
# @deprecated 0.5.0 Collection contracts are deprecated. Use
# Deferred::CollectionExamples instead.
module CollectionContracts
include Cuprum::Collections::RSpec::Contracts::RelationContracts

Expand Down
3 changes: 3 additions & 0 deletions lib/cuprum/collections/rspec/contracts/relation_contracts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

module Cuprum::Collections::RSpec::Contracts
# Contracts for asserting on Relation objects.
#
# @deprecated 0.5.0 Relation contracts are deprecated. Use
# Deferred::RelationExamples instead.
module RelationContracts
# Contract asserting that the method validates the required parameters.
module ShouldValidateTheParametersContract
Expand Down
8 changes: 0 additions & 8 deletions lib/cuprum/collections/rspec/contracts/scope_contracts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ module ShouldBeAScopeContract
describe 'with a scope of different type' do
let(:other) { Spec::OtherScope.new }

# rubocop:disable Style/RedundantLineContinuation
example_class 'Spec::OtherScope',
Cuprum::Collections::Scopes::Base \
do |klass|
klass.define_method(:type) { :invalid }
end
# rubocop:enable Style/RedundantLineContinuation

it { expect(subject == other).to be false }
end
Expand Down Expand Up @@ -156,13 +154,11 @@ module ShouldBeAContainerScopeContract
describe 'with a scope with the same type' do
let(:other) { Spec::CustomScope.new(scopes: other_scopes) }

# rubocop:disable Style/RedundantLineContinuation
example_class 'Spec::CustomScope',
Cuprum::Collections::Scopes::Base \
do |klass|
klass.include Cuprum::Collections::Scopes::Container
end
# rubocop:enable Style/RedundantLineContinuation

before(:example) do
allow(other).to receive(:type).and_return(scope.type)
Expand Down Expand Up @@ -299,13 +295,11 @@ module ShouldBeAnAllScopeContract
describe 'with a scope with the same type' do
let(:other) { Spec::CustomScope.new }

# rubocop:disable Style/RedundantLineContinuation
example_class 'Spec::CustomScope',
Cuprum::Collections::Scopes::Base \
do |klass|
klass.define_method(:type) { :all }
end
# rubocop:enable Style/RedundantLineContinuation

it { expect(subject == other).to be true }
end
Expand Down Expand Up @@ -682,13 +676,11 @@ module ShouldBeANoneScopeContract
describe 'with a scope with the same type' do
let(:other) { Spec::CustomScope.new }

# rubocop:disable Style/RedundantLineContinuation
example_class 'Spec::CustomScope',
Cuprum::Collections::Scopes::Base \
do |klass|
klass.define_method(:type) { :none }
end
# rubocop:enable Style/RedundantLineContinuation

it { expect(subject == other).to be true }
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,11 @@ def parse_criteria(*args, &block)
)
end

# rubocop:disable Style/RedundantLineContinuation
example_class 'Spec::CustomScope',
Cuprum::Collections::Scopes::Base \
do |klass|
klass.include Cuprum::Collections::Scopes::Criteria
end
# rubocop:enable Style/RedundantLineContinuation

describe 'with empty criteria' do
let(:other_criteria) { [] }
Expand Down Expand Up @@ -1169,7 +1167,6 @@ module ShouldFilterDataByCriteriaContract
describe 'with empty data' do
let(:data) { [] }

# rubocop:disable Style/RedundantLineContinuation
it 'should return an empty result or raise an exception',
:aggregate_failures \
do
Expand All @@ -1186,7 +1183,6 @@ module ShouldFilterDataByCriteriaContract
expect(actual).to be == []
# :nocov:
end
# rubocop:enable Style/RedundantLineContinuation
end

wrap_context 'with data' do
Expand Down
Loading

0 comments on commit 85d4822

Please sign in to comment.