eetee 0.0.1
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.
- data/.gitignore +6 -0
- data/.travis.yml +5 -0
- data/Gemfile +14 -0
- data/Guardfile +8 -0
- data/LICENSE +22 -0
- data/README.md +101 -0
- data/Rakefile +27 -0
- data/eetee.gemspec +19 -0
- data/examples/extensions/extension.rb +17 -0
- data/examples/extensions/test.rb +13 -0
- data/examples/focus/focus.rb +38 -0
- data/examples/shared/shared.rb +34 -0
- data/examples/simple/simple.rb +36 -0
- data/lib/eetee/assertion_wrapper.rb +107 -0
- data/lib/eetee/context.rb +67 -0
- data/lib/eetee/errors.rb +17 -0
- data/lib/eetee/ext/mocha.rb +47 -0
- data/lib/eetee/ext/rack.rb +78 -0
- data/lib/eetee/ext/time.rb +25 -0
- data/lib/eetee/reporter.rb +62 -0
- data/lib/eetee/reporters/console.rb +123 -0
- data/lib/eetee/reporters/text.rb +80 -0
- data/lib/eetee/runner.rb +62 -0
- data/lib/eetee/shared.rb +27 -0
- data/lib/eetee/test.rb +40 -0
- data/lib/eetee/version.rb +3 -0
- data/lib/eetee.rb +65 -0
- data/lib/guard/eetee.rb +77 -0
- data/specs/spec_helper.rb +11 -0
- data/specs/unit/assertion_wrapper_spec.rb +134 -0
- data/specs/unit/context_spec.rb +91 -0
- data/specs/unit/shared_spec.rb +35 -0
- data/specs/unit/test_spec.rb +78 -0
- data/tests/multi/file1.rb +28 -0
- data/tests/multi/file2.rb +14 -0
- data/tests/multi/run.rb +10 -0
- data/tests/simple/simple.rb +36 -0
- metadata +104 -0
@@ -0,0 +1,91 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe 'Context' do
|
4
|
+
before do
|
5
|
+
@reporter = stub('Reporter')
|
6
|
+
@reporter.stubs(:around_context).yields
|
7
|
+
@reporter.stubs(:around_test).yields
|
8
|
+
end
|
9
|
+
|
10
|
+
should 'run block in context' do
|
11
|
+
a = nil
|
12
|
+
Thread.new do
|
13
|
+
EEtee::Context.new("a context", 0, @reporter, :@a => 34) do
|
14
|
+
a = @a
|
15
|
+
end
|
16
|
+
end.join
|
17
|
+
a.should == 34
|
18
|
+
end
|
19
|
+
|
20
|
+
should 'run before block in same context' do
|
21
|
+
a = nil
|
22
|
+
Thread.new do
|
23
|
+
ctx = EEtee::Context.new("a context", 0, @reporter, :@a => 234){ }
|
24
|
+
ctx.before{ a = @a }
|
25
|
+
end.join
|
26
|
+
a.should == 234
|
27
|
+
end
|
28
|
+
|
29
|
+
should 'copy instance variables in nested contexts' do
|
30
|
+
a = b = nil
|
31
|
+
Thread.new do
|
32
|
+
ctx = EEtee::Context.new("a context", 0, @reporter, :@a => 98, :@b => "string"){ }
|
33
|
+
ctx.describe("nested context"){ a = @a; b = @b }
|
34
|
+
end.join
|
35
|
+
a.should == 98
|
36
|
+
b.should == "string"
|
37
|
+
end
|
38
|
+
|
39
|
+
should 'create a test' do
|
40
|
+
err = nil
|
41
|
+
EEtee::Test.expects(:new).with("should test something", @reporter)
|
42
|
+
Thread.new do
|
43
|
+
begin
|
44
|
+
ctx = EEtee::Context.new("a context", 0, @reporter, :@a => 98, :@b => "string"){ }
|
45
|
+
ctx.should("test something"){ 1.should == 1 }
|
46
|
+
rescue Exception => ex
|
47
|
+
err = ex
|
48
|
+
end
|
49
|
+
end.join
|
50
|
+
|
51
|
+
err.should == nil
|
52
|
+
end
|
53
|
+
|
54
|
+
should 'only run focused test' do
|
55
|
+
err = nil
|
56
|
+
n = 0
|
57
|
+
|
58
|
+
Thread.new do
|
59
|
+
begin
|
60
|
+
ctx = EEtee::Context.new("a context", 0, @reporter, {:@a => 98, :@b => "string"}, true){ }
|
61
|
+
ctx.should("test something", :focus => true){ n = 1 }
|
62
|
+
ctx.should("test something"){ n = 2 }
|
63
|
+
rescue Exception => ex
|
64
|
+
err = ex
|
65
|
+
end
|
66
|
+
end.join
|
67
|
+
|
68
|
+
n.should == 1
|
69
|
+
err.should == nil
|
70
|
+
end
|
71
|
+
|
72
|
+
should 'only run focused test (nested context)' do
|
73
|
+
err = nil
|
74
|
+
n = 0
|
75
|
+
|
76
|
+
Thread.new do
|
77
|
+
begin
|
78
|
+
ctx = EEtee::Context.new("a context", 0, @reporter, {:@a => 98, :@b => "string"}, true){ }
|
79
|
+
ctx2 = ctx.describe("nested"){}
|
80
|
+
ctx2.should("test something", :focus => true){ n = 1 }
|
81
|
+
ctx2.should("test something"){ n = 2 }
|
82
|
+
rescue Exception => ex
|
83
|
+
err = ex
|
84
|
+
end
|
85
|
+
end.join
|
86
|
+
|
87
|
+
n.should == 1
|
88
|
+
err.should == nil
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe 'Shared' do
|
4
|
+
before do
|
5
|
+
@reporter = stub('Reporter')
|
6
|
+
@reporter.stubs(:around_context).yields
|
7
|
+
@reporter.stubs(:around_test).yields
|
8
|
+
end
|
9
|
+
|
10
|
+
should 'run block in context' do
|
11
|
+
a = nil
|
12
|
+
|
13
|
+
shared = EEtee::Shared.new(:shared1) do |opts|
|
14
|
+
a = opts[:arg1]
|
15
|
+
end
|
16
|
+
|
17
|
+
shared.run(:arg1 => 54)
|
18
|
+
|
19
|
+
a.should == 54
|
20
|
+
end
|
21
|
+
|
22
|
+
should 'run block in context (with class)' do
|
23
|
+
a = nil
|
24
|
+
|
25
|
+
shared = EEtee::Shared.new(:shared1) do |opts|
|
26
|
+
a = opts[:arg1]
|
27
|
+
end
|
28
|
+
|
29
|
+
EEtee::Shared.run(:shared1, @reporter, 0, :arg1 => 54)
|
30
|
+
|
31
|
+
a.should == 54
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe 'Test' do
|
4
|
+
before do
|
5
|
+
@reporter = stub('Reporter')
|
6
|
+
@reporter.stubs(:around_test).yields
|
7
|
+
end
|
8
|
+
|
9
|
+
should 'execute given block in context' do
|
10
|
+
a = 4
|
11
|
+
|
12
|
+
# do not contaminate current thread variables
|
13
|
+
# required because we are running a test inside a test which
|
14
|
+
# should never happen in normal conditions
|
15
|
+
Thread.new do
|
16
|
+
tt = EEtee::Test.new("a test", @reporter) do
|
17
|
+
a = 5
|
18
|
+
end
|
19
|
+
end.join
|
20
|
+
|
21
|
+
a.should == 5
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
should 'wrap errors in EEtee::Error' do
|
26
|
+
|
27
|
+
err = nil
|
28
|
+
Thread.new do
|
29
|
+
begin
|
30
|
+
EEtee::Test.new("a test", @reporter) do
|
31
|
+
raise "error"
|
32
|
+
end
|
33
|
+
rescue => ex
|
34
|
+
err = ex
|
35
|
+
end
|
36
|
+
end.join
|
37
|
+
|
38
|
+
err.should.be_a EEtee::Error
|
39
|
+
|
40
|
+
err.error.should.be_a RuntimeError
|
41
|
+
err.error.message.should == "error"
|
42
|
+
err.test.should.be_a EEtee::Test
|
43
|
+
end
|
44
|
+
|
45
|
+
should 'associate current test to raised assertions' do
|
46
|
+
err = nil
|
47
|
+
Thread.new do
|
48
|
+
begin
|
49
|
+
EEtee::Test.new("a test", @reporter) do
|
50
|
+
1.should == 2
|
51
|
+
end
|
52
|
+
rescue => ex
|
53
|
+
err = ex
|
54
|
+
end
|
55
|
+
end.join
|
56
|
+
|
57
|
+
err.should.be_a EEtee::AssertionFailed
|
58
|
+
err.test.should.be_a EEtee::Test
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
should 'be extensible' do
|
63
|
+
NewTest = Class.new(EEtee::Test) do
|
64
|
+
include SimpleExtension
|
65
|
+
end
|
66
|
+
|
67
|
+
tmp = nil
|
68
|
+
a = nil
|
69
|
+
|
70
|
+
th = Thread.new do
|
71
|
+
NewTest.new("a test", @reporter){ a = 7 }
|
72
|
+
end.join
|
73
|
+
|
74
|
+
a.should == 7
|
75
|
+
th[:eetee_simple_extension].should == [1, 2]
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require "eetee"
|
5
|
+
|
6
|
+
describe 'Tests' do
|
7
|
+
before do
|
8
|
+
@a = 3
|
9
|
+
end
|
10
|
+
|
11
|
+
should 'have access to instance variables' do
|
12
|
+
@a.should == 3
|
13
|
+
end
|
14
|
+
|
15
|
+
should 'works 2' do
|
16
|
+
(40 + 5).should == 45
|
17
|
+
end
|
18
|
+
|
19
|
+
should 'fails' do
|
20
|
+
"toto".should == 4
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'nested context' do
|
24
|
+
should 'also have access to instance variables' do
|
25
|
+
@a.should == 3
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/tests/multi/run.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require "eetee"
|
5
|
+
|
6
|
+
include EEtee
|
7
|
+
|
8
|
+
|
9
|
+
describe 'Tests' do
|
10
|
+
before do
|
11
|
+
@a = 3
|
12
|
+
end
|
13
|
+
|
14
|
+
should 'have access to instance variables' do
|
15
|
+
@a.should == 3
|
16
|
+
end
|
17
|
+
|
18
|
+
should 'wait 1s' do
|
19
|
+
sleep 1
|
20
|
+
1.should == 1
|
21
|
+
end
|
22
|
+
|
23
|
+
should 'works 2' do
|
24
|
+
(40 + 5).should == 45
|
25
|
+
end
|
26
|
+
|
27
|
+
should 'fails' do
|
28
|
+
"toto".should == 4
|
29
|
+
end
|
30
|
+
|
31
|
+
describe 'nested context' do
|
32
|
+
should 'also have access to instance variables' do
|
33
|
+
@a.should == 3
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eetee
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Julien Ammous
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: term-ansicolor
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.7
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.7
|
30
|
+
description: Test framework inspired by Bacon
|
31
|
+
email:
|
32
|
+
- schmurfy@gmail.com
|
33
|
+
executables: []
|
34
|
+
extensions: []
|
35
|
+
extra_rdoc_files: []
|
36
|
+
files:
|
37
|
+
- .gitignore
|
38
|
+
- .travis.yml
|
39
|
+
- Gemfile
|
40
|
+
- Guardfile
|
41
|
+
- LICENSE
|
42
|
+
- README.md
|
43
|
+
- Rakefile
|
44
|
+
- eetee.gemspec
|
45
|
+
- examples/extensions/extension.rb
|
46
|
+
- examples/extensions/test.rb
|
47
|
+
- examples/focus/focus.rb
|
48
|
+
- examples/shared/shared.rb
|
49
|
+
- examples/simple/simple.rb
|
50
|
+
- lib/eetee.rb
|
51
|
+
- lib/eetee/assertion_wrapper.rb
|
52
|
+
- lib/eetee/context.rb
|
53
|
+
- lib/eetee/errors.rb
|
54
|
+
- lib/eetee/ext/mocha.rb
|
55
|
+
- lib/eetee/ext/rack.rb
|
56
|
+
- lib/eetee/ext/time.rb
|
57
|
+
- lib/eetee/reporter.rb
|
58
|
+
- lib/eetee/reporters/console.rb
|
59
|
+
- lib/eetee/reporters/text.rb
|
60
|
+
- lib/eetee/runner.rb
|
61
|
+
- lib/eetee/shared.rb
|
62
|
+
- lib/eetee/test.rb
|
63
|
+
- lib/eetee/version.rb
|
64
|
+
- lib/guard/eetee.rb
|
65
|
+
- specs/spec_helper.rb
|
66
|
+
- specs/unit/assertion_wrapper_spec.rb
|
67
|
+
- specs/unit/context_spec.rb
|
68
|
+
- specs/unit/shared_spec.rb
|
69
|
+
- specs/unit/test_spec.rb
|
70
|
+
- tests/multi/file1.rb
|
71
|
+
- tests/multi/file2.rb
|
72
|
+
- tests/multi/run.rb
|
73
|
+
- tests/simple/simple.rb
|
74
|
+
homepage: ''
|
75
|
+
licenses: []
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
hash: 496812950380161431
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
segments:
|
96
|
+
- 0
|
97
|
+
hash: 496812950380161431
|
98
|
+
requirements: []
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 1.8.24
|
101
|
+
signing_key:
|
102
|
+
specification_version: 3
|
103
|
+
summary: Another test framework
|
104
|
+
test_files: []
|