rspec-sleeping_king_studios 2.2.0.rc.1 → 2.2.0.rc.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c81d97b3ebb552157fcc3249abff241357da9c27
4
- data.tar.gz: c1352fafecc6381179dabec958ac2942c9feadee
3
+ metadata.gz: 35c3429a5963ce2ef369603423096f476b4387b2
4
+ data.tar.gz: f5437ed959abeb0c55616891bd13b7d229e963f8
5
5
  SHA512:
6
- metadata.gz: 51ba62b4f06c179719d702fc2b77adfea0b20dcfe7296a3e2224c4a2bc2e0d5d9d9cda5690f4fc58faa3e4900ce99ece1b9e2db51709eba8478dbfefe7446126
7
- data.tar.gz: 85072590a4cd2c1ed1073c8b603e46b2777036b5eb3de551804af7eb89213eb09e384448cd70eaeb7069527e077fbb68c2429a39a181851e221a37e9c25e48a9
6
+ metadata.gz: 1baedcdb400230782b88b660fa77dc946f3843dc5831501263358b99c681b3108121e36f48fc6237ebb17a02a4da4218caab6f1b1ffcae105e81a73ae032604c
7
+ data.tar.gz: a2a15b5b5afb836fad2c5c5838371aa7ef5590f93a24ec1ce900553f56561c3892229d8ab7a657cb1519853d0da700fc146714dbf338efd6cf5130cc2a7209e5
data/DEVELOPMENT.md CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  ### Features
6
6
 
7
+ - Alias `have_constant` as `define_constant`.
7
8
  - Implement RespondToMatcher#with_at_least(N).arguments, equivalent to with(N).arguments.and_unlimited_arguments.
8
9
  - Revisit failure messages for #respond_to, #be_constructible - see #received/#have_received for example?
9
10
  - Enhance RSpec matcher examples to display the #failure_message on a failed "should pass/fail with" example.
@@ -16,6 +17,8 @@
16
17
  ### Features
17
18
 
18
19
  - Add spy+matcher for expect(my_object, :my_method).to have_changed ?
20
+ - Add 'should have class reader/writer/property' shared examples.
21
+ - Add 'should have private reader/writer/property' shared examples.
19
22
 
20
23
  ### Maintenance
21
24
 
@@ -28,6 +31,14 @@
28
31
 
29
32
  ## Icebox
30
33
 
34
+ - Implement Matchers::define_negated_matcher.
35
+ - Implement negated compound matchers, e.g. expect().to match().and_not other_match()
36
+ - Alias as "but_not"?
37
+ - Implement benchmarking specs:
38
+ - Generate benchmarks for each test, save as file.
39
+ - Each time the benchmark specs are run, compare the results to the expected values.
40
+ - If the result is out of the expected range, fail the tests.
41
+ - Configure to run on first test, expected/permitted range.
31
42
  - Extract ActiveModel/Rails functionality to sub-gem?
32
43
  - Add shared examples for #belongs_to, #has_one, #has_many, #embedded_in, #embeds_one, #embeds_many.
33
44
  - Add shared examples for core ActiveModel validations.
@@ -35,11 +35,12 @@ module RSpec::SleepingKingStudios::Concerns
35
35
  # @raise ArgumentError If the referenced shared example group does not
36
36
  # exist.
37
37
  def alias_shared_examples new_name, old_name
38
- proc = shared_example_groups[self][old_name]
38
+ example_group = shared_example_groups[self][old_name]
39
+ definition = example_group_definition(example_group)
39
40
 
40
- raise ArgumentError.new(%{Could not find shared examples "#{old_name}"}) if proc.nil?
41
+ raise ArgumentError.new(%{Could not find shared examples "#{old_name}"}) if definition.nil?
41
42
 
42
- self.shared_examples new_name, &proc
43
+ self.shared_examples new_name, &definition
43
44
  end # method alias_shared_examples
44
45
  alias_method :alias_shared_context, :alias_shared_examples
45
46
 
@@ -73,14 +74,27 @@ module RSpec::SleepingKingStudios::Concerns
73
74
 
74
75
  private
75
76
 
77
+ def example_group_definition example_group
78
+ if example_group.is_a?(Proc)
79
+ example_group
80
+ elsif defined?(RSpec::Core::SharedExampleGroupModule) && example_group.is_a?(RSpec::Core::SharedExampleGroupModule)
81
+ example_group.definition
82
+ else
83
+ nil
84
+ end # if-elsif-else
85
+ end # method example_group_definition
86
+
76
87
  # @api private
77
88
  def merge_shared_example_groups other
78
- shared_example_groups[self].each do |name, proc|
89
+ shared_example_groups[self].each do |name, example_group|
90
+ definition = example_group_definition(example_group)
91
+
79
92
  # Skip the warning if the shared example group is already defined with the
80
93
  # same definition.
81
- next if shared_example_groups[other][name] == proc
94
+ existing_group = shared_example_groups[other][name]
95
+ next if existing_group == example_group || example_group_definition(existing_group) == definition
82
96
 
83
- RSpec.world.shared_example_group_registry.add(other, name, &proc)
97
+ RSpec.world.shared_example_group_registry.add(other, name, &definition)
84
98
  end # each
85
99
  end # method merge_shared_example_groups
86
100
 
@@ -86,9 +86,11 @@ module RSpec::SleepingKingStudios::Matchers::BuiltIn
86
86
  end # method comparing_proc?
87
87
 
88
88
  def excluded_from_actual
89
+ items = defined?(expecteds) ? expecteds : expected
90
+
89
91
  return [] unless @actual.respond_to?(:include?)
90
92
 
91
- expected.inject([]) do |memo, expected_item|
93
+ items.inject([]) do |memo, expected_item|
92
94
  if comparing_proc?(expected_item)
93
95
  memo << :__block_comparison__ unless yield actual_matches_proc?(expected_item)
94
96
  elsif comparing_hash_to_a_subset?(expected_item)
@@ -106,8 +108,10 @@ module RSpec::SleepingKingStudios::Matchers::BuiltIn
106
108
  end # method excluded_from_actual
107
109
 
108
110
  def expected_items_for_description
111
+ items = defined?(expecteds) ? expecteds : @expected
112
+
109
113
  # Preprocess items to stub out block expectations.
110
- @expected.map { |item| item.is_a?(Proc) ? :__block_comparison__ : item }
114
+ items.map { |item| item.is_a?(Proc) ? :__block_comparison__ : item }
111
115
  end # method expected_items_for_description
112
116
 
113
117
  def perform_match(actual, &block)
@@ -17,7 +17,7 @@ module RSpec
17
17
  # Prerelease version.
18
18
  PRERELEASE = 'rc'
19
19
  # Build metadata.
20
- BUILD = 1
20
+ BUILD = 2
21
21
 
22
22
  # Generates the gem version string from the Version constants.
23
23
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-sleeping_king_studios
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0.rc.1
4
+ version: 2.2.0.rc.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob "Merlin" Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-23 00:00:00.000000000 Z
11
+ date: 2016-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec