rspec-sleeping_king_studios 2.3.0.rc.0 → 2.3.0.rc.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc3757cf1c7a1c26436641db25ee091cbb1b96ae
|
4
|
+
data.tar.gz: e52526bacbc334d696667ac3d03bb14c3b628e8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b1124ce6d58c0dc927cdea62f702f60b53281b53946a7009740fc282d68462f13946b7e619114d11414c656a16879257280611ca17ee9ee8ae7aca7140aba37
|
7
|
+
data.tar.gz: 1268bc2fbd74f83dc83062e7c36d89c769b805eb291911dcb10b99c2dc1b3e9e86d3b4e22d79fdf0404e62d07e3ca3e029df954d7b6876a18cd6bb1f72351045
|
data/README.md
CHANGED
@@ -108,15 +108,23 @@ RSpec::SleepingKingStudios defines a few concerns that can be included in or ext
|
|
108
108
|
example_constant 'THE_ANSWER', 42
|
109
109
|
|
110
110
|
example_class 'Spec::Examples::Question' do |klass|
|
111
|
-
|
111
|
+
value = help_string
|
112
|
+
|
113
|
+
klass.send(:define_method, :answer) { THE_ANSWER }
|
114
|
+
klass.send(:define_method, :help) { value }
|
112
115
|
end # example_class
|
113
116
|
|
114
117
|
let(:described_class) { Spec::Examples::Question }
|
115
118
|
let(:instance) { described_class.new }
|
119
|
+
let(:help_string) do
|
120
|
+
"It looks like you're defining a class. Would you like help?"
|
121
|
+
end # let
|
116
122
|
|
117
123
|
it { expect(described_class.name).to be == 'Spec::Examples::Question' }
|
118
124
|
|
119
125
|
it { expect(instance.answer).to be THE_ANSWER }
|
126
|
+
|
127
|
+
it { expect(instance.help).to be == help_string }
|
120
128
|
end # describe
|
121
129
|
|
122
130
|
Provides a programmatic way to define temporary constants and classes scoped to the current example.
|
@@ -137,7 +145,7 @@ Sets the value of the named constant to the specified value within the context o
|
|
137
145
|
|
138
146
|
`option base_class [Class]` Defaults to Object. The base class of the generated class.
|
139
147
|
|
140
|
-
`yield klass [Class]` If a block is given, it is executed in the context of the
|
148
|
+
`yield klass [Class]` If a block is given, it is executed in the context of the example (so previously-set constants will be available, as well as example features such as the values of `let` blocks) and yielded the class.
|
141
149
|
|
142
150
|
Creates a new class with the specified base class and sets the value of the named constant to the created class within the context of the current example.
|
143
151
|
|
@@ -63,14 +63,16 @@ module RSpec::SleepingKingStudios::Concerns
|
|
63
63
|
klass.singleton_class.send(:alias_method, :inspect, :name)
|
64
64
|
klass.singleton_class.send(:alias_method, :to_s, :name)
|
65
65
|
|
66
|
-
|
66
|
+
instance_exec(klass, &block) if block_given?
|
67
67
|
|
68
68
|
klass
|
69
69
|
end # example_constant
|
70
70
|
end # method example_class
|
71
71
|
|
72
72
|
def example_constant qualified_name, constant_value = DEFAULT_VALUE, force: false, &block
|
73
|
-
around(:example) do |
|
73
|
+
around(:example) do |wrapped_example|
|
74
|
+
example = wrapped_example.example
|
75
|
+
|
74
76
|
resolved_value =
|
75
77
|
if constant_value == DEFAULT_VALUE
|
76
78
|
block ? example.instance_exec(&block) : nil
|
@@ -85,7 +87,7 @@ module RSpec::SleepingKingStudios::Concerns
|
|
85
87
|
ExampleConstants.guard_existing_constant!(namespace, constant_name) unless force
|
86
88
|
|
87
89
|
ExampleConstants.assign_constant(namespace, constant_name, resolved_value) do
|
88
|
-
|
90
|
+
wrapped_example.call
|
89
91
|
end # assign_constant
|
90
92
|
end # resolve_namespace
|
91
93
|
end # before example
|
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.3.0.rc.
|
4
|
+
version: 2.3.0.rc.1
|
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: 2017-06-
|
11
|
+
date: 2017-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: sleeping_king_studios-tools
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: '0.7'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: '0.7'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: appraisal
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,16 +96,22 @@ dependencies:
|
|
96
96
|
name: thor
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
|
+
- - "~>"
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0.19'
|
99
102
|
- - ">="
|
100
103
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
104
|
+
version: 0.19.4
|
102
105
|
type: :development
|
103
106
|
prerelease: false
|
104
107
|
version_requirements: !ruby/object:Gem::Requirement
|
105
108
|
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0.19'
|
106
112
|
- - ">="
|
107
113
|
- !ruby/object:Gem::Version
|
108
|
-
version:
|
114
|
+
version: 0.19.4
|
109
115
|
- !ruby/object:Gem::Dependency
|
110
116
|
name: sleeping_king_studios-tasks
|
111
117
|
requirement: !ruby/object:Gem::Requirement
|