remarkable 3.0.9 → 3.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/lib/remarkable/macros.rb +8 -2
- data/lib/remarkable/matchers.rb +3 -2
- data/lib/remarkable/pending.rb +56 -36
- data/lib/remarkable/version.rb +1 -1
- data/spec/pending_spec.rb +27 -6
- metadata +2 -2
data/CHANGELOG
CHANGED
data/lib/remarkable/macros.rb
CHANGED
@@ -16,8 +16,14 @@ module Remarkable
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def should_or_should_not_method_missing(should_or_should_not, method, calltrace, *args, &block) #:nodoc:
|
20
|
-
|
19
|
+
def should_or_should_not_method_missing(should_or_should_not, method, calltrace, *args, &block) #:nodoc:
|
20
|
+
description = if @_pending_group
|
21
|
+
get_description_from_matcher(should_or_should_not, method, *args, &block)
|
22
|
+
else
|
23
|
+
nil
|
24
|
+
end
|
25
|
+
|
26
|
+
example(description){
|
21
27
|
begin
|
22
28
|
send(should_or_should_not, send(method, *args, &block))
|
23
29
|
rescue Exception => e
|
data/lib/remarkable/matchers.rb
CHANGED
@@ -9,8 +9,9 @@ module Remarkable
|
|
9
9
|
# If the module to be included responds to :after_include, it's called with the
|
10
10
|
# target as argument.
|
11
11
|
#
|
12
|
-
def self.include_matchers!(base, target)
|
13
|
-
target.send :extend, Remarkable::
|
12
|
+
def self.include_matchers!(base, target)
|
13
|
+
target.send :extend, Remarkable::Pending
|
14
|
+
target.send :extend, Remarkable::Macros
|
14
15
|
|
15
16
|
if defined?(base::Matchers)
|
16
17
|
target.send :include, base::Matchers
|
data/lib/remarkable/pending.rb
CHANGED
@@ -1,42 +1,62 @@
|
|
1
1
|
module Remarkable
|
2
|
-
module
|
3
|
-
|
4
|
-
protected
|
2
|
+
module Pending
|
5
3
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
4
|
+
# We cannot put the alias method in the module because it's a Ruby 1.8 bug
|
5
|
+
# http://coderrr.wordpress.com/2008/03/28/alias_methodmodule-bug-in-ruby-18/
|
6
|
+
#
|
7
|
+
def self.extended(base) #:nodoc:
|
8
|
+
class << base
|
9
|
+
alias :it :example
|
10
|
+
alias :specify :example
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# Adds a pending block to your specs.
|
15
|
+
#
|
16
|
+
# == Examples
|
17
|
+
#
|
18
|
+
# pending 'create manager resource' do
|
19
|
+
# should_have_one :manager
|
20
|
+
# should_validate_associated :manager
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# By default, it executes the examples inside the pending block. So as soon
|
24
|
+
# as you add the has_one :manager relationship to your model, your specs
|
25
|
+
# will say that this was already fixed and there is no need to be treated
|
26
|
+
# as pending. To disable this behavior, you can give :execute => false:
|
27
|
+
#
|
28
|
+
# pending 'create manager resource', :execute => false
|
29
|
+
#
|
30
|
+
def pending(*args, &block)
|
31
|
+
options = { :execute => true }.merge(args.extract_options!)
|
32
|
+
|
33
|
+
@_pending_group = true
|
34
|
+
@_pending_group_description = args.first || "TODO"
|
35
|
+
@_pending_group_execute = options.delete(:execute)
|
36
|
+
|
37
|
+
self.instance_eval(&block)
|
38
|
+
|
39
|
+
@_pending_group = false
|
40
|
+
@_pending_group_description = nil
|
41
|
+
@_pending_group_execute = nil
|
42
|
+
end
|
35
43
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
44
|
+
def example(description=nil, options={}, backtrace=nil, &implementation) #:nodoc:
|
45
|
+
if block_given? && @_pending_group
|
46
|
+
pending_caller = caller.detect{ |c| c !~ /method_missing'/ }
|
47
|
+
pending_description = @_pending_group_description
|
48
|
+
|
49
|
+
pending_block = if @_pending_group_execute
|
50
|
+
proc{ pending(pending_description, &implementation) }
|
51
|
+
else
|
52
|
+
proc{ pending(pending_description) }
|
53
|
+
end
|
54
|
+
|
55
|
+
super(description, options, backtrace || pending_caller, &pending_block)
|
56
|
+
else
|
57
|
+
super(description, options, backtrace || caller(0)[1], &implementation)
|
58
|
+
end
|
59
|
+
end
|
40
60
|
|
41
61
|
end
|
42
62
|
end
|
data/lib/remarkable/version.rb
CHANGED
data/spec/pending_spec.rb
CHANGED
@@ -1,12 +1,33 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
|
-
describe Remarkable::
|
3
|
+
describe Remarkable::Pending do
|
4
|
+
|
5
|
+
it "should create pending groups" do
|
6
|
+
spec = self
|
7
|
+
|
8
|
+
self.class.pending "pending examples" do
|
9
|
+
self.instance_variable_get("@_pending_group").should spec.be_true
|
10
|
+
self.instance_variable_get("@_pending_group_description").should spec.eql("pending examples")
|
11
|
+
self.instance_variable_get("@_pending_group_execute").should spec.be_true
|
12
|
+
end
|
13
|
+
|
14
|
+
self.instance_variable_get("@_pending_group").should be_nil
|
15
|
+
self.instance_variable_get("@_pending_group_description").should be_nil
|
16
|
+
self.instance_variable_get("@_pending_group_execute").should be_nil
|
17
|
+
end
|
4
18
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
19
|
+
pending "pending examples" do
|
20
|
+
# example "should show as not implemented"
|
21
|
+
#
|
22
|
+
# specify "should show as pending" do
|
23
|
+
# raise "oops"
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# it "should show as fixed" do
|
27
|
+
# # success ...
|
28
|
+
# end
|
29
|
+
|
30
|
+
should_contain(5)
|
10
31
|
end
|
11
32
|
|
12
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remarkable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Brando
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-04-
|
13
|
+
date: 2009-04-27 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|