rspec-versioned 1.0.3 → 1.0.4
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 +8 -8
- data/lib/rspec/versioned.rb +21 -44
- data/lib/rspec/versioned/version.rb +1 -1
- data/rspec-versioned.gemspec +2 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/versioned_spec.rb +9 -9
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzViYjliNWZlMjI1NjQyNTEwNzFmMjJkNzFiMTIyMmI3YWFkZDQ3MA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDFjMmE4NzRkMmI4YTYxZDYxNTdlY2U4ZjRhODE1ZjJhZWZhNjUzMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmVkNzYyNjgzMDhmMzM3YjgwZTc5ODhlYjM4ZmI5NzNkY2E3YTZiZTRiNmU5
|
10
|
+
M2FiZjk0Mzk5OTI2OTE0ZDU0YzYyMmU3OTY3ODRkNGZlYTFkMjhjMjIwYzhi
|
11
|
+
OTAyYjQ4YzQzN2NkN2VjOGI1YTE4N2M1M2QxYzFhMWJmYThlNzM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWJmZDE3MDVjMzAwMjVmZjhhZGI0MGUwNDdlYWFkYWU0NzY3ZDY2YTJlNTI5
|
14
|
+
YzkyMWY1NzdkNzJkMDNmNjUyMGRjZjQyMWNkNTZjMzQ5Mzg5MzA4ZjZjMjMw
|
15
|
+
ZmI3OGJkNzhhOGEyNTg0OWY1NTMwODc4ODM2YWY4YmZkNTA2Y2E=
|
data/lib/rspec/versioned.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require "rspec/versioned/version"
|
2
2
|
require 'rspec/core'
|
3
|
-
require 'rspec_ext/rspec_ext'
|
4
3
|
require 'versioned_blocks'
|
5
4
|
|
6
5
|
module RSpec
|
@@ -13,31 +12,29 @@ module RSpec
|
|
13
12
|
fetch_current_example = RSpec.respond_to?(:current_example) ?
|
14
13
|
proc { RSpec.current_example } : proc { |context| context.example }
|
15
14
|
|
16
|
-
config.around(:each) do |
|
17
|
-
notify_version_number =
|
18
|
-
|
19
|
-
example = fetch_current_example.call(self)
|
20
|
-
example.new_version_info
|
15
|
+
config.around(:each) do |p| # example is a Proc extended with Procsy
|
16
|
+
notify_version_number = p.metadata[:notify_version_number] || RSpec.configuration.notify_version_number
|
21
17
|
|
22
18
|
run_example = Proc.new do |v, uri|
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
current_example = fetch_current_example.call(self)
|
20
|
+
current_example.clear_exceptions
|
21
|
+
p.metadata[:versioned] = {number:v, uri:uri}
|
22
|
+
p.run
|
26
23
|
RSpec.configuration.reporter.message("RSpec::Versioned testing /v#{v}") if notify_version_number
|
27
24
|
end
|
28
25
|
|
29
|
-
if
|
30
|
-
if
|
31
|
-
versioned_block(
|
26
|
+
if p.metadata.has_key?(:versions)
|
27
|
+
if p.metadata[:versions][:base_uri] || (VersionedBlocks.base_uri && VersionedBlocks.base_uri!='') # we have a URI
|
28
|
+
versioned_block(p.metadata[:versions]) do |v, uri|
|
32
29
|
run_example.call v,uri
|
33
30
|
end
|
34
31
|
else # we don't have a URI
|
35
|
-
versioned_block(
|
32
|
+
versioned_block(p.metadata[:versions]) do |v|
|
36
33
|
run_example.call v
|
37
34
|
end
|
38
35
|
end
|
39
36
|
else # didn't specify any versions...just run the test!
|
40
|
-
|
37
|
+
p.run
|
41
38
|
end
|
42
39
|
self.clear_lets if clear_lets
|
43
40
|
end
|
@@ -46,41 +43,21 @@ module RSpec
|
|
46
43
|
end
|
47
44
|
end
|
48
45
|
|
49
|
-
module HasVersionInfo
|
50
|
-
def new_version_info
|
51
|
-
@version_info = VersionInfoHolder.new
|
52
|
-
end
|
53
|
-
|
54
|
-
def version
|
55
|
-
@version_info
|
56
|
-
end
|
57
|
-
|
58
|
-
def clear_exception
|
59
|
-
@exception = nil
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
46
|
module RSpec
|
64
47
|
module Core
|
65
48
|
class Example
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
class VersionInfoHolder
|
74
|
-
attr_reader :number
|
49
|
+
def clear_exceptions
|
50
|
+
@exceptions = nil
|
51
|
+
end
|
75
52
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
end
|
53
|
+
def version
|
54
|
+
@metadata[:versioned]
|
55
|
+
end
|
80
56
|
|
81
|
-
|
82
|
-
|
83
|
-
|
57
|
+
def clear_exceptions
|
58
|
+
@exceptions = nil
|
59
|
+
end
|
60
|
+
end
|
84
61
|
end
|
85
62
|
end
|
86
63
|
|
data/rspec-versioned.gemspec
CHANGED
@@ -20,7 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.6"
|
22
22
|
spec.add_development_dependency "rake"
|
23
|
+
spec.add_runtime_dependency "rspec"
|
23
24
|
spec.add_runtime_dependency "versioned_blocks"
|
24
25
|
spec.add_runtime_dependency "rspec-core"
|
25
|
-
spec.add_runtime_dependency
|
26
|
+
spec.add_runtime_dependency 'pry', '>= 0', '>= 0'
|
26
27
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/versioned_spec.rb
CHANGED
@@ -11,11 +11,11 @@ describe 'rspec/versioned' do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'can run an example and get a version number', versions:{only:1} do |ex|
|
14
|
-
expect(ex.version
|
14
|
+
expect(ex.version[:number]).to eq 1
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'can run an example and get version numbers for a range of versions', versions:{to:3} do |ex|
|
18
|
-
expect(ex.version
|
18
|
+
expect(ex.version[:number]).to eq(@count)
|
19
19
|
@count += 1
|
20
20
|
end
|
21
21
|
end
|
@@ -27,17 +27,17 @@ describe 'rspec/versioned' do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'can run an example and get a version number', versions:{only:1} do |ex|
|
30
|
-
expect(ex.version
|
30
|
+
expect(ex.version[:uri]).to include ex.version[:number].to_s
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'can override base_uri', versions:{only:1, base_uri:'http://api2.com', override:true} do |ex|
|
34
|
-
expect(ex.version
|
34
|
+
expect(ex.version[:uri]).to include 'http://api2.com'
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'can run an example and get version numbers and URIs for a range of versions', versions:{to:3} do |ex|
|
38
|
-
expect(ex.version
|
39
|
-
expect(ex.version
|
40
|
-
expect(ex.version
|
38
|
+
expect(ex.version[:uri]).to include('api.com')
|
39
|
+
expect(ex.version[:uri]).to include(ex.version[:number].to_s)
|
40
|
+
expect(ex.version[:number]).to eq(@count)
|
41
41
|
@count += 1
|
42
42
|
end
|
43
43
|
end
|
@@ -51,7 +51,7 @@ describe 'rspec/versioned' do
|
|
51
51
|
context 'nested', versions:{from:2, to:4} do
|
52
52
|
it 'runs the correct amount of times' do |ex|
|
53
53
|
@outer_count += 1
|
54
|
-
expect(@outer_count).to eq ex.version
|
54
|
+
expect(@outer_count).to eq ex.version[:number]
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'only runs once for this one', versions:{only:1} do
|
@@ -66,7 +66,7 @@ describe 'rspec/versioned' do
|
|
66
66
|
|
67
67
|
it 'runs the correct amount of times' do |ex|
|
68
68
|
@inner_count += 1
|
69
|
-
expect(@inner_count).to eq ex.version
|
69
|
+
expect(@inner_count).to eq ex.version[:number]
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-versioned
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- devend711
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: versioned_blocks
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +81,7 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: pry
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - ! '>='
|