matest 1.6.3 → 1.6.4

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: 757f28ddf171609ce80b736adeb1f5accd410436
4
- data.tar.gz: ae5cbf1f29b8a645562602bcc1f6a5745e7b4703
3
+ metadata.gz: cc5e86300096a6ca0547c40b070f248c80fc96f6
4
+ data.tar.gz: 41808bf9b7fef44040c2aeec06c042944ed511d4
5
5
  SHA512:
6
- metadata.gz: 875366326b041e3112a33032f02efefd1f7ba823ce85ec776a205deb00e26dd35633e47f55c8a56cfcadefb25fff7b50a289eee2c0e613b43617a2d7cb48e981
7
- data.tar.gz: a03d705697f14ca9298290183d1c6343a566b111bcd69ca8457b1478ff7c5d966ae15b7b948530cc55e715200140910cef5b2aea651583b723f349d64ed42adc
6
+ metadata.gz: 228a61e509a3f3bd31a7a442f26eeb0c8c4bc1870bf1ff348107e27a981815ee7123c2313c125e82e37115b14498f83e245aa8bafb204b8a65e3126c72c89e28
7
+ data.tar.gz: 9361c7f168c71f3bb22cb1a267909b40873b09fc373118f8e631531e821fb258e989a99fcf4af3d1c28d82bb56ddefb70b852f0babb12675dbe006bc8f6c2481
@@ -11,7 +11,7 @@ class ExampleBlock
11
11
  def initialize(block)
12
12
  @block = block
13
13
 
14
- @code = generate_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
@@ -15,10 +15,15 @@ module Matest
15
15
  end
16
16
 
17
17
  def spec(description=nil, &block)
18
- current_example = block_given? ? block : ->(*args) { Matest::SkipMe.new }
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)
@@ -1,3 +1,16 @@
1
1
  module Matest
2
- class SkipMe; end
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 = ->(*args) { Matest::SkipMe.new }
49
+ current_example = Matest::SkipMe.new(caller)
50
50
  specs << Example.new(current_example, description, [])
51
51
  end
52
52
  alias :xspec :spec
@@ -5,7 +5,7 @@ module Matest
5
5
  include Color
6
6
 
7
7
  def print(res)
8
- super send(colors[res.class], res.to_s)
8
+ send(colors[res.class], res.to_s)
9
9
  end
10
10
 
11
11
  def print_messages(runner)
@@ -1,3 +1,3 @@
1
1
  module Matest
2
- VERSION = "1.6.3"
2
+ VERSION = "1.6.4"
3
3
  end
@@ -0,0 +1,26 @@
1
+ require "spec_helper"
2
+
3
+ scope do
4
+ spec do
5
+ true
6
+ end
7
+
8
+ xspec do
9
+ true
10
+ end
11
+
12
+ spec "Skip!!"
13
+ end
14
+
15
+ xscope do
16
+ spec do
17
+ true
18
+ end
19
+
20
+ xspec do
21
+ true
22
+ end
23
+
24
+ spec "Skip!!"
25
+ end
26
+
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.3
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