cuprum-collections 0.5.1 → 0.6.0.rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +47 -0
  3. data/lib/cuprum/collections/adaptable/collection.rb +18 -0
  4. data/lib/cuprum/collections/adaptable/command.rb +22 -0
  5. data/lib/cuprum/collections/adaptable/commands/abstract_assign_one.rb +27 -0
  6. data/lib/cuprum/collections/adaptable/commands/abstract_build_one.rb +25 -0
  7. data/lib/cuprum/collections/adaptable/commands/abstract_validate_one.rb +35 -0
  8. data/lib/cuprum/collections/adaptable/commands.rb +15 -0
  9. data/lib/cuprum/collections/adaptable/query.rb +64 -0
  10. data/lib/cuprum/collections/adaptable.rb +13 -0
  11. data/lib/cuprum/collections/adapter.rb +300 -0
  12. data/lib/cuprum/collections/adapters/data_adapter.rb +82 -0
  13. data/lib/cuprum/collections/adapters/entity_adapter.rb +76 -0
  14. data/lib/cuprum/collections/adapters/hash_adapter.rb +48 -0
  15. data/lib/cuprum/collections/adapters.rb +14 -0
  16. data/lib/cuprum/collections/basic/collection.rb +2 -20
  17. data/lib/cuprum/collections/basic/commands/destroy_one.rb +1 -1
  18. data/lib/cuprum/collections/basic/commands/find_many.rb +0 -31
  19. data/lib/cuprum/collections/basic/commands/find_matching.rb +0 -94
  20. data/lib/cuprum/collections/basic/commands/find_one.rb +0 -18
  21. data/lib/cuprum/collections/basic/commands/insert_one.rb +1 -1
  22. data/lib/cuprum/collections/basic/commands/update_one.rb +1 -1
  23. data/lib/cuprum/collections/basic/scopes/criteria_scope.rb +36 -21
  24. data/lib/cuprum/collections/basic.rb +6 -5
  25. data/lib/cuprum/collections/collection.rb +6 -0
  26. data/lib/cuprum/collections/collection_command.rb +1 -1
  27. data/lib/cuprum/collections/commands/abstract_find_many.rb +40 -3
  28. data/lib/cuprum/collections/commands/abstract_find_matching.rb +102 -0
  29. data/lib/cuprum/collections/commands/abstract_find_one.rb +23 -1
  30. data/lib/cuprum/collections/commands/associations/find_many.rb +1 -3
  31. data/lib/cuprum/collections/commands/associations/require_many.rb +1 -1
  32. data/lib/cuprum/collections/commands/find_one_matching.rb +10 -10
  33. data/lib/cuprum/collections/commands/query_command.rb +6 -4
  34. data/lib/cuprum/collections/commands/upsert.rb +0 -2
  35. data/lib/cuprum/collections/constraints/order/attributes_array.rb +5 -4
  36. data/lib/cuprum/collections/constraints/order/attributes_hash.rb +5 -4
  37. data/lib/cuprum/collections/constraints/order/sort_direction.rb +2 -2
  38. data/lib/cuprum/collections/constraints/ordering.rb +11 -9
  39. data/lib/cuprum/collections/constraints/query_hash.rb +2 -2
  40. data/lib/cuprum/collections/errors/abstract_find_error.rb +101 -23
  41. data/lib/cuprum/collections/errors/extra_attributes.rb +3 -3
  42. data/lib/cuprum/collections/errors/failed_validation.rb +3 -3
  43. data/lib/cuprum/collections/errors/missing_default_contract.rb +12 -4
  44. data/lib/cuprum/collections/queries.rb +4 -0
  45. data/lib/cuprum/collections/relation.rb +0 -2
  46. data/lib/cuprum/collections/relations/parameters.rb +120 -68
  47. data/lib/cuprum/collections/repository.rb +71 -6
  48. data/lib/cuprum/collections/rspec/contracts/query_contracts.rb +23 -4
  49. data/lib/cuprum/collections/rspec/contracts/repository_contracts.rb +18 -0
  50. data/lib/cuprum/collections/rspec/contracts/scope_contracts.rb +51 -0
  51. data/lib/cuprum/collections/rspec/contracts/scopes/builder_contracts.rb +10 -0
  52. data/lib/cuprum/collections/rspec/contracts/scopes/composition_contracts.rb +8 -0
  53. data/lib/cuprum/collections/rspec/contracts/scopes/criteria_contracts.rb +18 -366
  54. data/lib/cuprum/collections/rspec/contracts/scopes/logical_contracts.rb +30 -0
  55. data/lib/cuprum/collections/rspec/contracts/scopes.rb +2 -0
  56. data/lib/cuprum/collections/rspec/contracts.rb +2 -10
  57. data/lib/cuprum/collections/rspec/deferred/adapter_examples.rb +1077 -0
  58. data/lib/cuprum/collections/rspec/deferred/collection_examples.rb +27 -7
  59. data/lib/cuprum/collections/rspec/deferred/commands/assign_one_examples.rb +4 -4
  60. data/lib/cuprum/collections/rspec/deferred/commands/build_one_examples.rb +2 -2
  61. data/lib/cuprum/collections/rspec/deferred/commands/destroy_one_examples.rb +2 -2
  62. data/lib/cuprum/collections/rspec/deferred/commands/find_many_examples.rb +5 -5
  63. data/lib/cuprum/collections/rspec/deferred/commands/find_matching_examples.rb +45 -12
  64. data/lib/cuprum/collections/rspec/deferred/commands/find_one_examples.rb +2 -2
  65. data/lib/cuprum/collections/rspec/deferred/commands/insert_one_examples.rb +1 -1
  66. data/lib/cuprum/collections/rspec/deferred/commands/update_one_examples.rb +1 -1
  67. data/lib/cuprum/collections/rspec/deferred/query_examples.rb +930 -0
  68. data/lib/cuprum/collections/rspec/deferred/relation_examples.rb +48 -17
  69. data/lib/cuprum/collections/rspec/deferred/repository_examples.rb +961 -0
  70. data/lib/cuprum/collections/rspec/deferred/scope_examples.rb +598 -0
  71. data/lib/cuprum/collections/rspec/deferred/scopes/all_examples.rb +391 -0
  72. data/lib/cuprum/collections/rspec/deferred/scopes/builder_examples.rb +857 -0
  73. data/lib/cuprum/collections/rspec/deferred/scopes/composition_examples.rb +93 -0
  74. data/lib/cuprum/collections/rspec/deferred/scopes/conjunction_examples.rb +438 -0
  75. data/lib/cuprum/collections/rspec/deferred/scopes/criteria_examples.rb +1941 -0
  76. data/lib/cuprum/collections/rspec/deferred/scopes/disjunction_examples.rb +415 -0
  77. data/lib/cuprum/collections/rspec/deferred/scopes/none_examples.rb +385 -0
  78. data/lib/cuprum/collections/rspec/deferred/scopes/parser_examples.rb +740 -0
  79. data/lib/cuprum/collections/rspec/deferred/scopes.rb +8 -0
  80. data/lib/cuprum/collections/scope.rb +2 -2
  81. data/lib/cuprum/collections/scopes/container.rb +5 -4
  82. data/lib/cuprum/collections/scopes/criteria/parser.rb +24 -48
  83. data/lib/cuprum/collections/scopes/criteria.rb +7 -6
  84. data/lib/cuprum/collections/version.rb +4 -4
  85. data/lib/cuprum/collections.rb +5 -1
  86. metadata +47 -11
  87. data/lib/cuprum/collections/rspec/contracts/association_contracts.rb +0 -2127
  88. data/lib/cuprum/collections/rspec/contracts/basic.rb +0 -11
  89. data/lib/cuprum/collections/rspec/contracts/collection_contracts.rb +0 -387
  90. data/lib/cuprum/collections/rspec/contracts/command_contracts.rb +0 -169
  91. data/lib/cuprum/collections/rspec/contracts/relation_contracts.rb +0 -1264
@@ -13,6 +13,8 @@ module Cuprum::Collections::RSpec::Contracts::Scopes
13
13
  # Contracts for validating the behavior of scope composition.
14
14
  module CompositionContracts
15
15
  # Contract validating the fluent interface for scope composition.
16
+ #
17
+ # @deprecated 0.6.0
16
18
  module ShouldComposeScopesContract
17
19
  extend RSpec::SleepingKingStudios::Contract
18
20
 
@@ -372,6 +374,8 @@ module Cuprum::Collections::RSpec::Contracts::Scopes
372
374
  end
373
375
 
374
376
  # Contract validating scope composition for conjunction scopes.
377
+ #
378
+ # @deprecated 0.6.0
375
379
  module ShouldComposeScopesForConjunctionContract
376
380
  extend RSpec::SleepingKingStudios::Contract
377
381
  include Cuprum::Collections::RSpec::Contracts::Scopes::CompositionContracts # rubocop:disable Layout/LineLength
@@ -593,6 +597,8 @@ module Cuprum::Collections::RSpec::Contracts::Scopes
593
597
  end
594
598
 
595
599
  # Contract validating scope composition for criteria scopes.
600
+ #
601
+ # @deprecated 0.6.0
596
602
  module ShouldComposeScopesForCriteriaContract
597
603
  extend RSpec::SleepingKingStudios::Contract
598
604
  include Cuprum::Collections::RSpec::Contracts::Scopes::CompositionContracts # rubocop:disable Layout/LineLength
@@ -1319,6 +1325,8 @@ module Cuprum::Collections::RSpec::Contracts::Scopes
1319
1325
  end
1320
1326
 
1321
1327
  # Contract validating scope composition for disjunction scopes.
1328
+ #
1329
+ # @deprecated 0.6.0
1322
1330
  module ShouldComposeScopesForDisjunctionContract
1323
1331
  extend RSpec::SleepingKingStudios::Contract
1324
1332
  include Cuprum::Collections::RSpec::Contracts::Scopes::CompositionContracts # rubocop:disable Layout/LineLength
@@ -11,6 +11,8 @@ module Cuprum::Collections::RSpec::Contracts::Scopes
11
11
  include Cuprum::Collections::RSpec::Contracts::Scopes::CompositionContracts
12
12
 
13
13
  # Contract validating the behavior of a Criteria scope implementation.
14
+ #
15
+ # @deprecated 0.6.0
14
16
  module ShouldBeACriteriaScopeContract
15
17
  extend RSpec::SleepingKingStudios::Contract
16
18
 
@@ -31,6 +33,16 @@ module Cuprum::Collections::RSpec::Contracts::Scopes
31
33
  constructor: true,
32
34
  ignore_uninvertible: false
33
35
  |
36
+ message =
37
+ 'Use deferred examples "should implement the CriteriaScope methods"'
38
+ SleepingKingStudios::Tools::Toolbelt
39
+ .instance
40
+ .core_tools
41
+ .deprecate(
42
+ 'ShouldBeACriteriaScopeContract',
43
+ message:
44
+ )
45
+
34
46
  shared_context 'when initialized with inverted: true' do
35
47
  let(:constructor_options) { super().merge(inverted: true) }
36
48
  end
@@ -837,6 +849,8 @@ module Cuprum::Collections::RSpec::Contracts::Scopes
837
849
  end
838
850
 
839
851
  # Contract validating the scope filters data based on the criteria.
852
+ #
853
+ # @deprecated 0.6.0
840
854
  module ShouldFilterDataByCriteriaContract
841
855
  extend RSpec::SleepingKingStudios::Contract
842
856
 
@@ -1196,6 +1210,8 @@ module Cuprum::Collections::RSpec::Contracts::Scopes
1196
1210
  end
1197
1211
 
1198
1212
  # Contract validating the parsing of criteria.
1213
+ #
1214
+ # @deprecated 0.6.0
1199
1215
  module ShouldParseCriteriaContract
1200
1216
  extend RSpec::SleepingKingStudios::Contract
1201
1217
 
@@ -1246,6 +1262,8 @@ module Cuprum::Collections::RSpec::Contracts::Scopes
1246
1262
  end
1247
1263
 
1248
1264
  # Contract validating the parsing of criteria from a Hash.
1265
+ #
1266
+ # @deprecated 0.6.0
1249
1267
  module ShouldParseCriteriaFromABlockContract
1250
1268
  extend RSpec::SleepingKingStudios::Contract
1251
1269
 
@@ -1741,372 +1759,6 @@ module Cuprum::Collections::RSpec::Contracts::Scopes
1741
1759
  expect(parse_criteria(&block)).to be == expected
1742
1760
  end
1743
1761
  end
1744
-
1745
- # @deprecated v0.5.0 Implicit receivers are deprecated.
1746
- describe 'with a block with legacy implicit receiver' do
1747
- shared_examples 'should print a deprecation warning for' \
1748
- do |operator_name|
1749
- let(:deprecation_warning) do
1750
- '#parse with implicit receiver'
1751
- end
1752
- let(:deprecation_message) do
1753
- 'Pass a block with one parameter to #parse: { |scope| { scope' \
1754
- ".#{operator_name}: value } }"
1755
- end
1756
-
1757
- it 'should print a deprecation warning' do
1758
- parse_criteria(&block)
1759
-
1760
- expect(tools.core_tools)
1761
- .to have_received(:deprecate)
1762
- .with(deprecation_warning, message: deprecation_message)
1763
- end
1764
- end
1765
-
1766
- def tools
1767
- SleepingKingStudios::Tools::Toolbelt.instance
1768
- end
1769
-
1770
- before(:example) do
1771
- allow(tools.core_tools).to receive(:deprecate)
1772
- end
1773
-
1774
- describe 'with a Hash with an "eq" operator' do
1775
- let(:block) do
1776
- -> { { 'title' => eq('A Wizard of Earthsea') } }
1777
- end
1778
- let(:expected) do
1779
- [['title', operators::EQUAL, 'A Wizard of Earthsea']]
1780
- end
1781
-
1782
- it 'should parse the criteria' do
1783
- expect(parse_criteria(&block)).to be == expected
1784
- end
1785
-
1786
- include_examples 'should print a deprecation warning for', 'eq'
1787
- end
1788
-
1789
- describe 'with a Hash with an "equal" operator' do
1790
- let(:block) do
1791
- -> { { 'title' => equal('A Wizard of Earthsea') } }
1792
- end
1793
- let(:expected) do
1794
- [['title', operators::EQUAL, 'A Wizard of Earthsea']]
1795
- end
1796
-
1797
- it 'should parse the criteria' do
1798
- expect(parse_criteria(&block)).to be == expected
1799
- end
1800
-
1801
- include_examples 'should print a deprecation warning for', 'equal'
1802
- end
1803
-
1804
- describe 'with a Hash with an "equals" operator' do
1805
- let(:block) do
1806
- -> { { 'title' => equals('A Wizard of Earthsea') } }
1807
- end
1808
- let(:expected) do
1809
- [['title', operators::EQUAL, 'A Wizard of Earthsea']]
1810
- end
1811
-
1812
- it 'should parse the criteria' do
1813
- expect(parse_criteria(&block)).to be == expected
1814
- end
1815
-
1816
- include_examples 'should print a deprecation warning for', 'equals'
1817
- end
1818
-
1819
- describe 'with a Hash with a "greater_than" operator' do
1820
- let(:block) do
1821
- -> { { 'published_at' => greater_than('1970-01-01') } }
1822
- end
1823
- let(:expected) do
1824
- [['published_at', operators::GREATER_THAN, '1970-01-01']]
1825
- end
1826
-
1827
- it 'should parse the criteria' do
1828
- expect(parse_criteria(&block)).to be == expected
1829
- end
1830
-
1831
- include_examples 'should print a deprecation warning for',
1832
- 'greater_than'
1833
- end
1834
-
1835
- describe 'with a Hash with a "greater_than_or_equal_to" operator' do
1836
- let(:block) do
1837
- lambda do
1838
- { 'published_at' => greater_than_or_equal_to('1970-01-01') }
1839
- end
1840
- end
1841
- let(:expected) do
1842
- [
1843
- [
1844
- 'published_at',
1845
- operators::GREATER_THAN_OR_EQUAL_TO,
1846
- '1970-01-01'
1847
- ]
1848
- ]
1849
- end
1850
-
1851
- it 'should parse the criteria' do
1852
- expect(parse_criteria(&block)).to be == expected
1853
- end
1854
-
1855
- include_examples 'should print a deprecation warning for',
1856
- 'greater_than_or_equal_to'
1857
- end
1858
-
1859
- describe 'with a Hash with a "gt" operator' do
1860
- let(:block) do
1861
- -> { { 'published_at' => gt('1970-01-01') } }
1862
- end
1863
- let(:expected) do
1864
- [['published_at', operators::GREATER_THAN, '1970-01-01']]
1865
- end
1866
-
1867
- it 'should parse the criteria' do
1868
- expect(parse_criteria(&block)).to be == expected
1869
- end
1870
-
1871
- include_examples 'should print a deprecation warning for', 'gt'
1872
- end
1873
-
1874
- describe 'with a Hash with a "gte" operator' do
1875
- let(:block) do
1876
- -> { { 'published_at' => gte('1970-01-01') } }
1877
- end
1878
- let(:expected) do
1879
- [
1880
- [
1881
- 'published_at',
1882
- operators::GREATER_THAN_OR_EQUAL_TO,
1883
- '1970-01-01'
1884
- ]
1885
- ]
1886
- end
1887
-
1888
- it 'should parse the criteria' do
1889
- expect(parse_criteria(&block)).to be == expected
1890
- end
1891
-
1892
- include_examples 'should print a deprecation warning for', 'gte'
1893
- end
1894
-
1895
- describe 'with a Hash with a "less_than" operator' do
1896
- let(:block) do
1897
- -> { { 'published_at' => less_than('1970-01-01') } }
1898
- end
1899
- let(:expected) do
1900
- [['published_at', operators::LESS_THAN, '1970-01-01']]
1901
- end
1902
-
1903
- it 'should parse the criteria' do
1904
- expect(parse_criteria(&block)).to be == expected
1905
- end
1906
-
1907
- include_examples 'should print a deprecation warning for',
1908
- 'less_than'
1909
- end
1910
-
1911
- describe 'with a Hash with a "less_than_or_equal_to" operator' do
1912
- let(:block) do
1913
- -> { { 'published_at' => less_than_or_equal_to('1970-01-01') } }
1914
- end
1915
- let(:expected) do
1916
- [['published_at', operators::LESS_THAN_OR_EQUAL_TO, '1970-01-01']]
1917
- end
1918
-
1919
- it 'should parse the criteria' do
1920
- expect(parse_criteria(&block)).to be == expected
1921
- end
1922
-
1923
- include_examples 'should print a deprecation warning for',
1924
- 'less_than_or_equal_to'
1925
- end
1926
-
1927
- describe 'with a Hash with a "lt" operator' do
1928
- let(:block) do
1929
- -> { { 'published_at' => lt('1970-01-01') } }
1930
- end
1931
- let(:expected) do
1932
- [['published_at', operators::LESS_THAN, '1970-01-01']]
1933
- end
1934
-
1935
- it 'should parse the criteria' do
1936
- expect(parse_criteria(&block)).to be == expected
1937
- end
1938
-
1939
- include_examples 'should print a deprecation warning for', 'lt'
1940
- end
1941
-
1942
- describe 'with a Hash with a "lte" operator' do
1943
- let(:block) do
1944
- -> { { 'published_at' => lte('1970-01-01') } }
1945
- end
1946
- let(:expected) do
1947
- [['published_at', operators::LESS_THAN_OR_EQUAL_TO, '1970-01-01']]
1948
- end
1949
-
1950
- it 'should parse the criteria' do
1951
- expect(parse_criteria(&block)).to be == expected
1952
- end
1953
-
1954
- include_examples 'should print a deprecation warning for', 'lte'
1955
- end
1956
-
1957
- describe 'with a Hash with a "ne" operator' do
1958
- let(:block) do
1959
- -> { { 'series' => ne('Earthsea') } }
1960
- end
1961
- let(:expected) do
1962
- [['series', operators::NOT_EQUAL, 'Earthsea']]
1963
- end
1964
-
1965
- it 'should parse the criteria' do
1966
- expect(parse_criteria(&block)).to be == expected
1967
- end
1968
-
1969
- include_examples 'should print a deprecation warning for', 'ne'
1970
- end
1971
-
1972
- describe 'with a Hash with a "not_equal" operator' do
1973
- let(:block) do
1974
- -> { { 'series' => not_equal('Earthsea') } }
1975
- end
1976
- let(:expected) do
1977
- [['series', operators::NOT_EQUAL, 'Earthsea']]
1978
- end
1979
-
1980
- it 'should parse the criteria' do
1981
- expect(parse_criteria(&block)).to be == expected
1982
- end
1983
-
1984
- include_examples 'should print a deprecation warning for',
1985
- 'not_equal'
1986
- end
1987
-
1988
- describe 'with a Hash with a "not_one_of" operator and an Array' do
1989
- let(:block) do
1990
- lambda do
1991
- {
1992
- 'series' => not_one_of(
1993
- ['Earthsea', 'The Lord of the Rings']
1994
- )
1995
- }
1996
- end
1997
- end
1998
- let(:expected) do
1999
- [
2000
- [
2001
- 'series',
2002
- operators::NOT_ONE_OF,
2003
- ['Earthsea', 'The Lord of the Rings']
2004
- ]
2005
- ]
2006
- end
2007
-
2008
- it 'should parse the criteria' do
2009
- expect(parse_criteria(&block)).to be == expected
2010
- end
2011
-
2012
- include_examples 'should print a deprecation warning for',
2013
- 'not_one_of'
2014
- end
2015
-
2016
- describe 'with a Hash with a "not_one_of" operator and values' do
2017
- let(:block) do
2018
- lambda do
2019
- { 'series' => not_one_of('Earthsea', 'The Lord of the Rings') }
2020
- end
2021
- end
2022
- let(:expected) do
2023
- [
2024
- [
2025
- 'series',
2026
- operators::NOT_ONE_OF,
2027
- ['Earthsea', 'The Lord of the Rings']
2028
- ]
2029
- ]
2030
- end
2031
-
2032
- it 'should parse the criteria' do
2033
- expect(parse_criteria(&block)).to be == expected
2034
- end
2035
-
2036
- include_examples 'should print a deprecation warning for',
2037
- 'not_one_of'
2038
- end
2039
-
2040
- describe 'with a Hash with a "one_of" operator and an Array' do
2041
- let(:block) do
2042
- lambda do
2043
- { 'series' => one_of(['Earthsea', 'The Lord of the Rings']) }
2044
- end
2045
- end
2046
- let(:expected) do
2047
- [
2048
- [
2049
- 'series',
2050
- operators::ONE_OF,
2051
- ['Earthsea', 'The Lord of the Rings']
2052
- ]
2053
- ]
2054
- end
2055
-
2056
- it 'should parse the criteria' do
2057
- expect(parse_criteria(&block)).to be == expected
2058
- end
2059
-
2060
- include_examples 'should print a deprecation warning for', 'one_of'
2061
- end
2062
-
2063
- describe 'with a Hash with a "one_of" operator and values' do
2064
- let(:block) do
2065
- lambda do
2066
- { 'series' => one_of('Earthsea', 'The Lord of the Rings') }
2067
- end
2068
- end
2069
- let(:expected) do
2070
- [
2071
- [
2072
- 'series',
2073
- operators::ONE_OF,
2074
- ['Earthsea', 'The Lord of the Rings']
2075
- ]
2076
- ]
2077
- end
2078
-
2079
- it 'should parse the criteria' do
2080
- expect(parse_criteria(&block)).to be == expected
2081
- end
2082
-
2083
- include_examples 'should print a deprecation warning for', 'one_of'
2084
- end
2085
-
2086
- describe 'with a Hash with an unknown operator' do
2087
- let(:error_class) do
2088
- Cuprum::Collections::Queries::UnknownOperatorException
2089
- end
2090
- let(:error_message) do
2091
- 'unknown operator "random"'
2092
- end
2093
- let(:block) do
2094
- -> { { 'genre' => random('Science Fiction', 'Fantasy') } }
2095
- end
2096
-
2097
- it 'should raise an exception' do
2098
- expect { parse_criteria(&block) }
2099
- .to raise_error error_class, error_message
2100
- end
2101
-
2102
- it 'should preserve the original exception', :aggregate_failures do
2103
- parse_criteria(&block)
2104
- rescue error_class => exception
2105
- expect(exception.cause).to be_a NameError
2106
- expect(exception.name).to be == :random
2107
- end
2108
- end
2109
- end
2110
1762
  end
2111
1763
  end
2112
1764
 
@@ -12,6 +12,8 @@ module Cuprum::Collections::RSpec::Contracts::Scopes
12
12
  include Cuprum::Collections::RSpec::Contracts::Scopes::CompositionContracts
13
13
 
14
14
  # Contract validating the behavior of a logical AND scope implementation.
15
+ #
16
+ # @deprecated 0.6.0
15
17
  module ShouldBeAConjunctionScopeContract
16
18
  extend RSpec::SleepingKingStudios::Contract
17
19
 
@@ -23,6 +25,17 @@ module Cuprum::Collections::RSpec::Contracts::Scopes
23
25
  # @param abstract [Boolean] if true, the scope is abstract and does not
24
26
  # define a #call implementation. Defaults to false.
25
27
  contract do |abstract: false|
28
+ message =
29
+ 'Use deferred examples "should implement the ConjunctionScope ' \
30
+ 'methods"'
31
+ SleepingKingStudios::Tools::Toolbelt
32
+ .instance
33
+ .core_tools
34
+ .deprecate(
35
+ 'ShouldBeAConjunctionScopeContract',
36
+ message:
37
+ )
38
+
26
39
  include_contract 'should be a container scope', invertible: true
27
40
 
28
41
  include_contract 'should compose scopes for conjunction'
@@ -69,6 +82,8 @@ module Cuprum::Collections::RSpec::Contracts::Scopes
69
82
  end
70
83
 
71
84
  # Contract validating the behavior of a logical OR scope implementation.
85
+ #
86
+ # @deprecated 0.6.0
72
87
  module ShouldBeADisjunctionScopeContract
73
88
  extend RSpec::SleepingKingStudios::Contract
74
89
 
@@ -80,6 +95,17 @@ module Cuprum::Collections::RSpec::Contracts::Scopes
80
95
  # @param abstract [Boolean] if true, the scope is abstract and does not
81
96
  # define a #call implementation. Defaults to false.
82
97
  contract do |abstract: false|
98
+ message =
99
+ 'Use deferred examples "should implement the DisjunctionScope ' \
100
+ 'methods"'
101
+ SleepingKingStudios::Tools::Toolbelt
102
+ .instance
103
+ .core_tools
104
+ .deprecate(
105
+ 'ShouldBeADisjunctionScopeContract',
106
+ message:
107
+ )
108
+
83
109
  include_contract 'should be a container scope', invertible: true
84
110
 
85
111
  include_contract 'should compose scopes for disjunction'
@@ -126,6 +152,8 @@ module Cuprum::Collections::RSpec::Contracts::Scopes
126
152
  end
127
153
 
128
154
  # Contract validating the behavior of a Conjunction scope implementation.
155
+ #
156
+ # @deprecated 0.6.0
129
157
  module ShouldFilterDataByLogicalAndContract
130
158
  extend RSpec::SleepingKingStudios::Contract
131
159
 
@@ -211,6 +239,8 @@ module Cuprum::Collections::RSpec::Contracts::Scopes
211
239
  end
212
240
 
213
241
  # Contract validating the behavior of a Disjunction scope implementation.
242
+ #
243
+ # @deprecated 0.6.0
214
244
  module ShouldFilterDataByLogicalOrContract
215
245
  extend RSpec::SleepingKingStudios::Contract
216
246
 
@@ -4,6 +4,8 @@ require 'cuprum/collections/rspec/contracts'
4
4
 
5
5
  module Cuprum::Collections::RSpec::Contracts
6
6
  # Namespace for RSpec contracts validating the behavior of scopes.
7
+ #
8
+ # @deprecated 0.6.0
7
9
  module Scopes
8
10
  autoload :CriteriaContracts,
9
11
  'cuprum/collections/rspec/contracts/scopes/criteria_contracts'
@@ -5,20 +5,12 @@ require 'cuprum/collections/rspec'
5
5
  module Cuprum::Collections::RSpec
6
6
  # Namespace for RSpec contract objects.
7
7
  module Contracts
8
- autoload :AssociationContracts,
9
- 'cuprum/collections/rspec/contracts/association_contracts'
10
- autoload :Basic,
11
- 'cuprum/collections/rspec/contracts/basic'
12
- autoload :CollectionContracts,
13
- 'cuprum/collections/rspec/contracts/collection_contracts'
14
- autoload :CommandContracts,
15
- 'cuprum/collections/rspec/contracts/command_contracts'
16
8
  autoload :QueryContracts,
17
9
  'cuprum/collections/rspec/contracts/query_contracts'
18
- autoload :RelationContracts,
19
- 'cuprum/collections/rspec/contracts/relation_contracts'
20
10
  autoload :RepositoryContracts,
21
11
  'cuprum/collections/rspec/contracts/repository_contracts'
12
+ autoload :ScopeContracts,
13
+ 'cuprum/collections/rspec/contracts/scope_contracts'
22
14
  autoload :Scopes,
23
15
  'cuprum/collections/rspec/contracts/scopes'
24
16
  end