rspec-console 0.6 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e63502234311fe86e7f6313f2330e06727d401e
4
- data.tar.gz: b39390aed9d22566014802cd0e2a29b1d99bf0c6
3
+ metadata.gz: 752fe7471ee891b4da31c34035572b6425d3434f
4
+ data.tar.gz: 7256739bc1707e7cb998a0269e73c58be63d9864
5
5
  SHA512:
6
- metadata.gz: 6cc98cfed58de7e6d9b7e56bb90a5a3ff3908a6f0022367cbab1a1934041395320237f28be5b90d5b33b130987dd3d5d661bad9c6cf96bd69d26e3a3ee028c6b
7
- data.tar.gz: 548488ee091260bf4cd09c8a16c31ba6b3796d945da8f2a66cf24382cdb4c3b84b8c34dc724ef89cf0a9f54c1ecaf02572b8799cacf5407c75adcb1d42d33438
6
+ metadata.gz: 9280074c3161e077cdccd1ee60a893dc050040c8a2fa238964172c07b8c5c8fd9d2f4c3b667026dd2523b791ca65c845dc7e0d290cc31d0c67d776c4a43bdc24
7
+ data.tar.gz: 086ce0f97f0fb55f8ef2a2c8f625a57adfe7435891aef3a7741711493ea1c4a1179e07c583ed8007305287987acf095f819b8eb3e52126be338424a1af590f15
@@ -11,7 +11,7 @@ class RSpecConsole::ConfigCache
11
11
  # Instead, we proxy and record whatever is done to RSpec.configuration during
12
12
  # the first invocation of require('spec_helper'). This is done by interposing
13
13
  # the RecordingProxy class on of RSpec.configuration.
14
- attr_accessor :config_proxy, :shared_examples_copy
14
+ attr_accessor :config_proxy, :root_shared_examples
15
15
 
16
16
  class RecordingProxy < Struct.new(:target, :recorded_messages)
17
17
  [:include, :extend].each do |method|
@@ -69,30 +69,27 @@ class RSpecConsole::ConfigCache
69
69
  end
70
70
 
71
71
  def stash_shared_examples
72
- if rspec2?
73
- self.shared_examples_copy = ::RSpec.world.shared_example_groups.dup
74
- else
75
- self.shared_examples_copy = ::RSpec.world.shared_example_group_registry
76
- .send(:shared_example_groups).dup
72
+ self.root_shared_examples = case shared_example_api
73
+ when :v1 then ::RSpec.world.shared_example_groups.dup
74
+ when :v2 then ::RSpec.world.shared_example_group_registry.send(:shared_example_groups).dup
77
75
  end
78
- rescue Exception => e
79
- STDERR.puts "[rspec-console] WARN: #{e.class} #{e}"
80
76
  end
81
77
 
82
78
  def restore_shared_examples
83
- return if self.shared_examples_copy.nil?
84
-
85
- if rspec2?
86
- ::RSpec.world.shared_example_groups.merge!(self.shared_examples_copy)
87
- else
88
- self.shared_examples_copy.each do |context, name_blocks|
79
+ case shared_example_api
80
+ when :v1 then ::RSpec.world.shared_example_groups.merge!(self.root_shared_examples)
81
+ when :v2
82
+ self.root_shared_examples.each do |context, name_blocks|
89
83
  name_blocks.each do |name, block|
90
84
  ::RSpec.world.shared_example_group_registry.add(context, name, &block)
91
85
  end
92
86
  end
93
87
  end
94
- rescue Exception => e
95
- STDERR.puts "[rspec-console] WARN: #{e.class} #{e}"
88
+ end
89
+
90
+ def shared_example_api
91
+ return :v1 if ::RSpec.world.respond_to?(:shared_example_groups)
92
+ return :v2 if ::RSpec.world.respond_to?(:shared_example_group_registry)
96
93
  end
97
94
 
98
95
  def ensure_configuration_setter!
@@ -104,8 +101,4 @@ class RSpecConsole::ConfigCache
104
101
  end
105
102
  end
106
103
  end
107
-
108
- def rspec2?
109
- Gem.loaded_specs['rspec-core'].version < Gem::Version.new('3')
110
- end
111
104
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-console
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.6'
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Viennot