matest 1.6.3 → 1.6.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 +4 -4
- data/lib/matest/example_block.rb +3 -1
- data/lib/matest/example_group.rb +6 -6
- data/lib/matest/skip_me.rb +14 -1
- data/lib/matest/skipped_example_group.rb +1 -1
- data/lib/matest/spec_printer.rb +1 -1
- data/lib/matest/version.rb +1 -1
- data/spec/matest_specs/skip_spec.rb +26 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc5e86300096a6ca0547c40b070f248c80fc96f6
|
4
|
+
data.tar.gz: 41808bf9b7fef44040c2aeec06c042944ed511d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 228a61e509a3f3bd31a7a442f26eeb0c8c4bc1870bf1ff348107e27a981815ee7123c2313c125e82e37115b14498f83e245aa8bafb204b8a65e3126c72c89e28
|
7
|
+
data.tar.gz: 9361c7f168c71f3bb22cb1a267909b40873b09fc373118f8e631531e821fb258e989a99fcf4af3d1c28d82bb56ddefb70b852f0babb12675dbe006bc8f6c2481
|
data/lib/matest/example_block.rb
CHANGED
@@ -11,7 +11,7 @@ class ExampleBlock
|
|
11
11
|
def initialize(block)
|
12
12
|
@block = block
|
13
13
|
|
14
|
-
@code =
|
14
|
+
@code = generate_code
|
15
15
|
|
16
16
|
@sexp = Ripper::SexpBuilder.new(code).parse.last
|
17
17
|
@assertion_sexp = @sexp.last
|
@@ -46,6 +46,8 @@ class ExampleBlock
|
|
46
46
|
valid_lines = [lines[lineno-1]].join
|
47
47
|
code = Ripper::SexpBuilder.new(valid_lines).parse.last.last.last.last
|
48
48
|
Sorcerer.source(code)
|
49
|
+
rescue Sorcerer::Resource::NotSexpError => e
|
50
|
+
"Matest::SkipMe.new"
|
49
51
|
end
|
50
52
|
|
51
53
|
def lines
|
data/lib/matest/example_group.rb
CHANGED
@@ -15,10 +15,15 @@ module Matest
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def spec(description=nil, &block)
|
18
|
-
current_example = block_given? ? block :
|
18
|
+
current_example = block_given? ? block : Matest::SkipMe.new(caller)
|
19
19
|
specs << Example.new(current_example, description, lets)
|
20
20
|
end
|
21
21
|
|
22
|
+
def xspec(description=nil, &block)
|
23
|
+
current_example = Matest::SkipMe.new(caller)
|
24
|
+
specs << Example.new(current_example, description, [])
|
25
|
+
end
|
26
|
+
|
22
27
|
def execute!
|
23
28
|
instance_eval(&scope_block)
|
24
29
|
specs.shuffle.each do |spec, desc|
|
@@ -28,10 +33,6 @@ module Matest
|
|
28
33
|
|
29
34
|
end
|
30
35
|
|
31
|
-
def xspec(description=nil, &block)
|
32
|
-
spec(description)
|
33
|
-
end
|
34
|
-
|
35
36
|
alias :it :spec
|
36
37
|
alias :xit :xspec
|
37
38
|
|
@@ -41,7 +42,6 @@ module Matest
|
|
41
42
|
alias :example :spec
|
42
43
|
alias :xexample :xspec
|
43
44
|
|
44
|
-
|
45
45
|
def self.let(var_name, &block)
|
46
46
|
define_method(var_name) do
|
47
47
|
instance_variable_set(:"@#{var_name}", block.call)
|
data/lib/matest/skip_me.rb
CHANGED
@@ -1,3 +1,16 @@
|
|
1
1
|
module Matest
|
2
|
-
class SkipMe
|
2
|
+
class SkipMe
|
3
|
+
attr_reader :source_location
|
4
|
+
def initialize(the_caller=nil)
|
5
|
+
if the_caller
|
6
|
+
@the_caller = the_caller
|
7
|
+
file, lineno = the_caller.first.split(":")
|
8
|
+
@source_location = [file, lineno.to_i]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_proc
|
13
|
+
proc { SkipMe.new }
|
14
|
+
end
|
15
|
+
end
|
3
16
|
end
|
@@ -46,7 +46,7 @@ module Matest
|
|
46
46
|
alias :xgroup :xscope
|
47
47
|
|
48
48
|
def spec(description=nil, &block)
|
49
|
-
current_example =
|
49
|
+
current_example = Matest::SkipMe.new(caller)
|
50
50
|
specs << Example.new(current_example, description, [])
|
51
51
|
end
|
52
52
|
alias :xspec :spec
|
data/lib/matest/spec_printer.rb
CHANGED
data/lib/matest/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Federico Iachetti
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- spec/matest_specs/printing_assertion_spec.rb
|
108
108
|
- spec/matest_specs/scope_spec.rb
|
109
109
|
- spec/matest_specs/scoping_stuff_spec.rb
|
110
|
+
- spec/matest_specs/skip_spec.rb
|
110
111
|
- spec/matest_specs/slow_spec.rb
|
111
112
|
- spec/spec_helper.rb
|
112
113
|
homepage: ''
|
@@ -143,5 +144,6 @@ test_files:
|
|
143
144
|
- spec/matest_specs/printing_assertion_spec.rb
|
144
145
|
- spec/matest_specs/scope_spec.rb
|
145
146
|
- spec/matest_specs/scoping_stuff_spec.rb
|
147
|
+
- spec/matest_specs/skip_spec.rb
|
146
148
|
- spec/matest_specs/slow_spec.rb
|
147
149
|
- spec/spec_helper.rb
|