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 +4 -4
- data/lib/rspec-console/config_cache.rb +13 -20
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 752fe7471ee891b4da31c34035572b6425d3434f
|
4
|
+
data.tar.gz: 7256739bc1707e7cb998a0269e73c58be63d9864
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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, :
|
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
|
-
|
73
|
-
|
74
|
-
|
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
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
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
|
-
|
95
|
-
|
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
|