unencumbered 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/.rspec +2 -0
- data/Rakefile +17 -0
- data/VERSION +1 -1
- data/lib/unencumbered.rb +21 -17
- data/spec/lib/unencumbered_spec.rb +59 -90
- data/spec/spec_helper.rb +13 -0
- data/unencumbered.gemspec +11 -6
- metadata +39 -8
- data/spec/spec.opts +0 -4
data/.gitignore
CHANGED
data/.rspec
ADDED
data/Rakefile
CHANGED
@@ -10,7 +10,24 @@ begin
|
|
10
10
|
gem.email = "info@hashrocket.com"
|
11
11
|
gem.homepage = "http://github.com/hashrocket/unencumbered"
|
12
12
|
gem.authors = ["Hashrocket"]
|
13
|
+
|
14
|
+
gem.add_dependency 'rspec', '>= 2.0.0.beta.19'
|
13
15
|
end
|
14
16
|
rescue LoadError
|
15
17
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
16
18
|
end
|
19
|
+
|
20
|
+
require 'rake/testtask'
|
21
|
+
Rake::TestTask.new(:test) do |test|
|
22
|
+
test.libs << 'lib' << 'test'
|
23
|
+
test.pattern = 'test/**/test_*.rb'
|
24
|
+
test.verbose = true
|
25
|
+
end
|
26
|
+
|
27
|
+
require 'rspec'
|
28
|
+
require 'rspec/core/rake_task'
|
29
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
30
|
+
spec.pattern = "spec/**/*_spec.rb"
|
31
|
+
end
|
32
|
+
|
33
|
+
task :default => [:spec]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/unencumbered.rb
CHANGED
@@ -1,24 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
@description_args.push("\n#{description}\n")
|
1
|
+
if defined?(RSpec)
|
2
|
+
module Rspec::Core::ObjectExtensions
|
3
|
+
alias_method :Feature, :describe
|
5
4
|
end
|
6
|
-
end
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
class RSpec::Core::ExampleGroup
|
7
|
+
def self.executes(scope=:all, &block)
|
8
|
+
before(scope, &block)
|
9
|
+
end
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
%w(Scenario: Given When Background).each do |group|
|
12
|
+
method_name = group.sub(":", "")
|
13
|
+
module_eval(<<-END_RUBY, __FILE__, __LINE__)
|
14
|
+
def self.#{method_name}(*args, &example_group_block)
|
15
|
+
describe(#{group.inspect}, *args, &example_group_block)
|
16
|
+
end
|
17
|
+
END_RUBY
|
18
|
+
end
|
16
19
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
%w(Then And But).each do |type|
|
21
|
+
module_eval(<<-END_RUBY, __FILE__, __LINE__)
|
22
|
+
def self.#{type}(desc=nil, options={}, &block)
|
23
|
+
example("#{type} \#{desc}", options, &block)
|
24
|
+
end
|
25
|
+
END_RUBY
|
22
26
|
end
|
23
27
|
end
|
24
28
|
end
|
@@ -1,126 +1,95 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
|
5
|
-
include Spec::DSL::Main
|
6
|
-
def initialize
|
7
|
-
@description_args = []
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'responds to Feature' do
|
12
|
-
Spec::DSL::Main.should respond_to(:Feature)
|
13
|
-
end
|
14
|
-
|
15
|
-
describe '#narrative' do
|
16
|
-
it '#narrative appends the description to description_args' do
|
17
|
-
dsl_main = TestBed.new
|
18
|
-
dsl_main.instance_variable_get(:@description_args).should_receive(:push).with("\nfoo\n")
|
19
|
-
dsl_main.narrative('foo'){}
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
3
|
+
describe RSpec::Core::ExampleGroup do
|
4
|
+
subject { RSpec::Core::ExampleGroup.describe }
|
23
5
|
|
24
|
-
|
25
|
-
|
26
|
-
include Spec::Example::ExampleGroupMethods
|
6
|
+
it "responds to Feature" do
|
7
|
+
RSpec::Core::ExampleGroup.should respond_to(:Feature)
|
27
8
|
end
|
28
9
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
let(:spec_method){ spec_type.gsub(/\:/,'') }
|
33
|
-
|
10
|
+
shared_examples_for 'a describe method' do
|
11
|
+
let(:spec_method) { spec_type.sub(":", "") }
|
12
|
+
let(:description) { 'description' }
|
34
13
|
it 'calls describe' do
|
35
|
-
|
36
|
-
|
14
|
+
subject.should_receive(:describe)
|
15
|
+
subject.send(spec_method)
|
37
16
|
end
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
example_group.send(spec_method,'foo'){}
|
17
|
+
it 'calls describe with prefix' do
|
18
|
+
subject.should_receive(:describe).with(spec_type, description)
|
19
|
+
subject.send(spec_method, description)
|
42
20
|
end
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
example_group.send(spec_method,'foo',&impl)
|
21
|
+
it 'calls describe with implementation' do
|
22
|
+
impl = lambda { |*args| }
|
23
|
+
subject.should_receive(:describe).with(spec_type, description, &impl)
|
24
|
+
subject.send(spec_method, description, &impl)
|
48
25
|
end
|
49
26
|
end
|
50
27
|
|
51
|
-
shared_examples_for '
|
28
|
+
shared_examples_for 'an example method' do
|
29
|
+
let(:description) { 'description' }
|
52
30
|
it 'calls example' do
|
53
|
-
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'prefaces the description' do
|
58
|
-
example_group.should_receive(:example).with("#{spec_method} foo")
|
59
|
-
example_group.send(spec_method,'foo'){}
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'passes along the implementation block' do
|
63
|
-
impl = lambda{ 'foo' }
|
64
|
-
example_group.should_receive(:example).with(anything,&impl)
|
65
|
-
example_group.send(spec_method,'foo',&impl)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe '#executes' do
|
70
|
-
it 'calls before' do
|
71
|
-
example_group.should_receive(:before)
|
72
|
-
example_group.send(:executes){}
|
31
|
+
subject.should_receive(:example)
|
32
|
+
subject.send(spec_type)
|
73
33
|
end
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
example_group.send(:executes){}
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'allows you to override the scope' do
|
81
|
-
example_group.should_receive(:before).with(:each)
|
82
|
-
example_group.send(:executes,:each){}
|
34
|
+
it 'calls example with prefix' do
|
35
|
+
subject.should_receive(:example).with("#{spec_type} #{description}", {})
|
36
|
+
subject.send(spec_type, description)
|
83
37
|
end
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
example_group.send(:executes,&impl)
|
38
|
+
it 'calls example with implementation' do
|
39
|
+
impl = lambda { |*args| }
|
40
|
+
subject.should_receive(:example).with("#{spec_type} #{description}", {}, &impl)
|
41
|
+
subject.send(spec_type, description, &impl)
|
89
42
|
end
|
90
43
|
end
|
91
44
|
|
92
45
|
describe "#Scenario" do
|
93
|
-
let(:spec_type){ 'Scenario:' }
|
94
|
-
it_should_behave_like 'a
|
46
|
+
let(:spec_type) { 'Scenario:' }
|
47
|
+
it_should_behave_like 'a describe method'
|
95
48
|
end
|
96
49
|
|
97
50
|
describe "#Given" do
|
98
|
-
let(:spec_type){ 'Given' }
|
99
|
-
it_should_behave_like 'a
|
51
|
+
let(:spec_type) { 'Given' }
|
52
|
+
it_should_behave_like 'a describe method'
|
100
53
|
end
|
101
54
|
|
102
55
|
describe "#When" do
|
103
|
-
let(:spec_type){ 'When' }
|
104
|
-
it_should_behave_like 'a
|
56
|
+
let(:spec_type) { 'When' }
|
57
|
+
it_should_behave_like 'a describe method'
|
105
58
|
end
|
106
59
|
|
107
60
|
describe "#Background" do
|
108
|
-
let(:spec_type){ 'Background' }
|
109
|
-
it_should_behave_like 'a
|
61
|
+
let(:spec_type) { 'Background' }
|
62
|
+
it_should_behave_like 'a describe method'
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "#Then" do
|
66
|
+
let(:spec_type) { 'Then' }
|
67
|
+
it_should_behave_like 'an example method'
|
110
68
|
end
|
111
69
|
|
112
70
|
describe "#And" do
|
113
|
-
let(:
|
114
|
-
it_should_behave_like '
|
71
|
+
let(:spec_type) { 'And' }
|
72
|
+
it_should_behave_like 'an example method'
|
115
73
|
end
|
116
74
|
|
117
75
|
describe "#But" do
|
118
|
-
let(:
|
119
|
-
it_should_behave_like '
|
76
|
+
let(:spec_type) { 'But' }
|
77
|
+
it_should_behave_like 'an example method'
|
120
78
|
end
|
121
79
|
|
122
|
-
describe "#
|
123
|
-
|
124
|
-
|
80
|
+
describe "#executes" do
|
81
|
+
it "calls before with :all scope by default" do
|
82
|
+
subject.should_receive(:before).with(:all)
|
83
|
+
subject.executes
|
84
|
+
end
|
85
|
+
it "calls before with scope" do
|
86
|
+
subject.should_receive(:before).with(:each)
|
87
|
+
subject.executes(:each)
|
88
|
+
end
|
89
|
+
it "calls before with scope and block" do
|
90
|
+
impl = lambda { |*args| }
|
91
|
+
subject.should_receive(:before).with(:all, &impl)
|
92
|
+
subject.executes &impl
|
93
|
+
end
|
125
94
|
end
|
126
95
|
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rspec'
|
3
|
+
require File.expand_path('../../lib/unencumbered', __FILE__)
|
4
|
+
|
5
|
+
RSpec.configure do |c|
|
6
|
+
c.before(:each) do
|
7
|
+
@real_world = RSpec.world
|
8
|
+
RSpec.instance_variable_set(:@world, RSpec::Core::World.new)
|
9
|
+
end
|
10
|
+
c.after(:each) do
|
11
|
+
RSpec.instance_variable_set(:@world, @real_world)
|
12
|
+
end
|
13
|
+
end
|
data/unencumbered.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{unencumbered}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Hashrocket"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-08-12}
|
13
13
|
s.description = %q{You got Cucumber in my RSpec!}
|
14
14
|
s.email = %q{info@hashrocket.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -19,32 +19,37 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
21
|
".gitignore",
|
22
|
+
".rspec",
|
22
23
|
"LICENSE",
|
23
24
|
"README.textile",
|
24
25
|
"Rakefile",
|
25
26
|
"VERSION",
|
26
27
|
"lib/unencumbered.rb",
|
27
28
|
"spec/lib/unencumbered_spec.rb",
|
28
|
-
"spec/
|
29
|
+
"spec/spec_helper.rb",
|
29
30
|
"unencumbered.gemspec"
|
30
31
|
]
|
31
32
|
s.homepage = %q{http://github.com/hashrocket/unencumbered}
|
32
33
|
s.rdoc_options = ["--charset=UTF-8"]
|
33
34
|
s.require_paths = ["lib"]
|
34
|
-
s.rubygems_version = %q{1.3.
|
35
|
+
s.rubygems_version = %q{1.3.7}
|
35
36
|
s.summary = %q{Just enough Cucumber in RSpec.}
|
36
37
|
s.test_files = [
|
37
|
-
"spec/lib/unencumbered_spec.rb"
|
38
|
+
"spec/lib/unencumbered_spec.rb",
|
39
|
+
"spec/spec_helper.rb"
|
38
40
|
]
|
39
41
|
|
40
42
|
if s.respond_to? :specification_version then
|
41
43
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
42
44
|
s.specification_version = 3
|
43
45
|
|
44
|
-
if Gem::Version.new(Gem::
|
46
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
|
+
s.add_runtime_dependency(%q<rspec>, [">= 2.0.0.beta.19"])
|
45
48
|
else
|
49
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0.beta.19"])
|
46
50
|
end
|
47
51
|
else
|
52
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0.beta.19"])
|
48
53
|
end
|
49
54
|
end
|
50
55
|
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unencumbered
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Hashrocket
|
@@ -9,10 +15,27 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-
|
18
|
+
date: 2010-08-12 00:00:00 -05:00
|
13
19
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rspec
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 62196421
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 0
|
33
|
+
- 0
|
34
|
+
- beta
|
35
|
+
- 19
|
36
|
+
version: 2.0.0.beta.19
|
37
|
+
type: :runtime
|
38
|
+
version_requirements: *id001
|
16
39
|
description: You got Cucumber in my RSpec!
|
17
40
|
email: info@hashrocket.com
|
18
41
|
executables: []
|
@@ -25,13 +48,14 @@ extra_rdoc_files:
|
|
25
48
|
files:
|
26
49
|
- .document
|
27
50
|
- .gitignore
|
51
|
+
- .rspec
|
28
52
|
- LICENSE
|
29
53
|
- README.textile
|
30
54
|
- Rakefile
|
31
55
|
- VERSION
|
32
56
|
- lib/unencumbered.rb
|
33
57
|
- spec/lib/unencumbered_spec.rb
|
34
|
-
- spec/
|
58
|
+
- spec/spec_helper.rb
|
35
59
|
- unencumbered.gemspec
|
36
60
|
has_rdoc: true
|
37
61
|
homepage: http://github.com/hashrocket/unencumbered
|
@@ -43,23 +67,30 @@ rdoc_options:
|
|
43
67
|
require_paths:
|
44
68
|
- lib
|
45
69
|
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
46
71
|
requirements:
|
47
72
|
- - ">="
|
48
73
|
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
49
77
|
version: "0"
|
50
|
-
version:
|
51
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
52
80
|
requirements:
|
53
81
|
- - ">="
|
54
82
|
- !ruby/object:Gem::Version
|
83
|
+
hash: 3
|
84
|
+
segments:
|
85
|
+
- 0
|
55
86
|
version: "0"
|
56
|
-
version:
|
57
87
|
requirements: []
|
58
88
|
|
59
89
|
rubyforge_project:
|
60
|
-
rubygems_version: 1.3.
|
90
|
+
rubygems_version: 1.3.7
|
61
91
|
signing_key:
|
62
92
|
specification_version: 3
|
63
93
|
summary: Just enough Cucumber in RSpec.
|
64
94
|
test_files:
|
65
95
|
- spec/lib/unencumbered_spec.rb
|
96
|
+
- spec/spec_helper.rb
|
data/spec/spec.opts
DELETED