schmurfy-bacon 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +7 -0
- data/Rakefile +1 -1
- data/lib/bacon.rb +22 -18
- data/lib/bacon/version.rb +1 -1
- metadata +11 -5
data/.gitignore
CHANGED
data/Gemfile
ADDED
data/Rakefile
CHANGED
data/lib/bacon.rb
CHANGED
@@ -71,10 +71,31 @@ module Bacon
|
|
71
71
|
super message
|
72
72
|
end
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
|
+
module ContextAssertions
|
76
|
+
def it(description, &block)
|
77
|
+
return unless description =~ RestrictName
|
78
|
+
block ||= lambda { should.flunk "not implemented" }
|
79
|
+
Counter[:specifications] += 1
|
80
|
+
run_requirement description, block
|
81
|
+
end
|
82
|
+
|
83
|
+
def describe(*args, &block)
|
84
|
+
context = Bacon::Context.new(args.join(' '), &block)
|
85
|
+
(parent_context = self).methods(false).each {|e|
|
86
|
+
class<<context; self end.send(:define_method, e) {|*args| parent_context.send(e, *args)}
|
87
|
+
}
|
88
|
+
@before.each { |b| context.before(&b) }
|
89
|
+
@after.each { |b| context.after(&b) }
|
90
|
+
context.run
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
75
94
|
class Context
|
76
95
|
attr_reader :name, :block
|
77
96
|
|
97
|
+
include ContextAssertions
|
98
|
+
|
78
99
|
def initialize(name, &block)
|
79
100
|
@name = name
|
80
101
|
@before, @after = [], []
|
@@ -95,13 +116,6 @@ module Bacon
|
|
95
116
|
def behaves_like(*names)
|
96
117
|
names.each { |name| instance_eval(&Shared[name]) }
|
97
118
|
end
|
98
|
-
|
99
|
-
def it(description, &block)
|
100
|
-
return unless description =~ RestrictName
|
101
|
-
block ||= lambda { should.flunk "not implemented" }
|
102
|
-
Counter[:specifications] += 1
|
103
|
-
run_requirement description, block
|
104
|
-
end
|
105
119
|
|
106
120
|
def should(*args, &block)
|
107
121
|
if Counter[:depth]==0
|
@@ -162,16 +176,6 @@ module Bacon
|
|
162
176
|
end
|
163
177
|
end
|
164
178
|
|
165
|
-
def describe(*args, &block)
|
166
|
-
context = Bacon::Context.new(args.join(' '), &block)
|
167
|
-
(parent_context = self).methods(false).each {|e|
|
168
|
-
class<<context; self end.send(:define_method, e) {|*args| parent_context.send(e, *args)}
|
169
|
-
}
|
170
|
-
@before.each { |b| context.before(&b) }
|
171
|
-
@after.each { |b| context.after(&b) }
|
172
|
-
context.run
|
173
|
-
end
|
174
|
-
|
175
179
|
def raise?(*args, &block); block.raise?(*args); end
|
176
180
|
def throw?(*args, &block); block.throw?(*args); end
|
177
181
|
def change?(*args, &block); block.change?(*args); end
|
data/lib/bacon/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schmurfy-bacon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-03-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: term-ansicolor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70355136826660 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70355136826660
|
25
25
|
description: ! 'Bacon is a small RSpec clone weighing less than 350 LoC but
|
26
26
|
|
27
27
|
nevertheless providing all essential features.
|
@@ -39,6 +39,7 @@ extra_rdoc_files:
|
|
39
39
|
files:
|
40
40
|
- .gitignore
|
41
41
|
- COPYING
|
42
|
+
- Gemfile
|
42
43
|
- README
|
43
44
|
- Rakefile
|
44
45
|
- bacon.gemspec
|
@@ -68,12 +69,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
69
|
- - ! '>='
|
69
70
|
- !ruby/object:Gem::Version
|
70
71
|
version: '0'
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
hash: -2533530908022743327
|
71
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
76
|
none: false
|
73
77
|
requirements:
|
74
78
|
- - ! '>='
|
75
79
|
- !ruby/object:Gem::Version
|
76
80
|
version: '0'
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
hash: -2533530908022743327
|
77
84
|
requirements: []
|
78
85
|
rubyforge_project:
|
79
86
|
rubygems_version: 1.8.11
|
@@ -81,4 +88,3 @@ signing_key:
|
|
81
88
|
specification_version: 3
|
82
89
|
summary: a small RSpec clone
|
83
90
|
test_files: []
|
84
|
-
has_rdoc:
|