temporaries 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/Rakefile +8 -0
- data/features/mini_test_integration.feature +50 -0
- data/lib/temporaries.rb +7 -1
- data/lib/temporaries/adapters.rb +1 -0
- data/lib/temporaries/adapters/mini_test.rb +29 -0
- data/lib/temporaries/adapters/test_unit.rb +4 -2
- data/lib/temporaries/values.rb +1 -1
- data/lib/temporaries/version.rb +1 -1
- data/spec/unit/temporaries/directory_spec.rb +1 -1
- data/spec/unit/temporaries/values_spec.rb +1 -1
- metadata +70 -77
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -0,0 +1,50 @@
|
|
1
|
+
@1.9
|
2
|
+
Feature: MiniTest Integration
|
3
|
+
|
4
|
+
As a developer using MiniTest
|
5
|
+
I want to define temporary values
|
6
|
+
So I can run my tests in isolation
|
7
|
+
|
8
|
+
Scenario: Using temporary values with MiniTest::Unit
|
9
|
+
Given I have a file "mini_test_unit.rb" containing:
|
10
|
+
"""
|
11
|
+
require 'minitest/unit'
|
12
|
+
require 'minitest/autorun'
|
13
|
+
require 'temporaries'
|
14
|
+
|
15
|
+
module Mod
|
16
|
+
X = 2
|
17
|
+
end
|
18
|
+
|
19
|
+
class MyTest < MiniTest::Unit::TestCase
|
20
|
+
use_constant_value Mod, :X, 5
|
21
|
+
|
22
|
+
def test_should_have_x_set_to_5_in_each_test
|
23
|
+
assert_equal 5, Mod::X
|
24
|
+
end
|
25
|
+
end
|
26
|
+
"""
|
27
|
+
When I run "ruby mini_test_unit.rb"
|
28
|
+
Then I should see "1 tests, 1 assertions, 0 failures, 0 errors"
|
29
|
+
|
30
|
+
Scenario: Using temporary values with MiniTest::Spec
|
31
|
+
Given I have a file "mini_test_spec.rb" containing:
|
32
|
+
"""
|
33
|
+
require 'minitest/spec'
|
34
|
+
require 'minitest/autorun'
|
35
|
+
require 'temporaries'
|
36
|
+
|
37
|
+
module Mod
|
38
|
+
X = 2
|
39
|
+
end
|
40
|
+
|
41
|
+
describe Mod do
|
42
|
+
use_constant_value Mod, :X, 5
|
43
|
+
|
44
|
+
it "should have x set to 5 in each test" do
|
45
|
+
Mod::X.must_equal(5)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
"""
|
49
|
+
When I run "ruby mini_test_spec.rb"
|
50
|
+
Then I should see "1 tests, 1 assertions, 0 failures, 0 errors"
|
data/lib/temporaries.rb
CHANGED
@@ -9,6 +9,12 @@ if defined?($TEMPORARIES_TEST)
|
|
9
9
|
# Testing this library. Don't install anything.
|
10
10
|
elsif defined?(RSpec)
|
11
11
|
Temporaries::Adapters::RSpec.install
|
12
|
+
elsif defined?(MiniTest::Unit::TestCase)
|
13
|
+
if RUBY_VERSION >= '1.9.3'
|
14
|
+
Temporaries::Adapters::MiniTest.install
|
15
|
+
else
|
16
|
+
Temporaries::Adapters::TestUnit.install(MiniTest::Unit)
|
17
|
+
end
|
12
18
|
elsif defined?(Test::Unit)
|
13
|
-
Temporaries::Adapters::TestUnit.install
|
19
|
+
Temporaries::Adapters::TestUnit.install(Test::Unit)
|
14
20
|
end
|
data/lib/temporaries/adapters.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
module Temporaries
|
2
|
+
module Adapters
|
3
|
+
class MiniTest < Base
|
4
|
+
# For ruby <= 1.9.2, MiniTest is actually adapted via the
|
5
|
+
# Test::Unit adapter.
|
6
|
+
def self.install
|
7
|
+
::MiniTest::Unit::TestCase.class_eval do
|
8
|
+
extend Extension
|
9
|
+
include Values
|
10
|
+
include Directory
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def before(&block)
|
15
|
+
context.add_setup_hook {|tc| tc.instance_eval(&block) }
|
16
|
+
end
|
17
|
+
|
18
|
+
def after(&block)
|
19
|
+
context.add_teardown_hook {|tc| tc.instance_eval(&block) }
|
20
|
+
end
|
21
|
+
|
22
|
+
module Extension
|
23
|
+
def temporaries_adapter
|
24
|
+
MiniTest.new(self)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module Temporaries
|
2
2
|
module Adapters
|
3
3
|
class TestUnit < Base
|
4
|
-
|
5
|
-
|
4
|
+
# This is used for both Test::Unit <= 1.9 and MiniTest::Unit
|
5
|
+
# <= 1.9.2.
|
6
|
+
def self.install(mod)
|
7
|
+
mod::TestCase.class_eval do
|
6
8
|
extend Extension
|
7
9
|
include Values
|
8
10
|
include Directory
|
data/lib/temporaries/values.rb
CHANGED
data/lib/temporaries/version.rb
CHANGED
metadata
CHANGED
@@ -1,83 +1,76 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: temporaries
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 3
|
10
|
-
version: 0.0.3
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- George Ogata
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-06-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: ritual
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 3
|
32
|
-
- 0
|
33
|
-
version: 0.3.0
|
18
|
+
requirements:
|
19
|
+
- - '='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.4.1
|
34
22
|
type: :development
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: rspec
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
25
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
26
|
+
requirements:
|
27
|
+
- - '='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.4.1
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - '='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 2.10.0
|
50
38
|
type: :development
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: cucumber
|
54
39
|
prerelease: false
|
55
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
56
41
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
42
|
+
requirements:
|
43
|
+
- - '='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.10.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: cucumber
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - '='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.2.0
|
66
54
|
type: :development
|
67
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.2.0
|
68
62
|
description:
|
69
|
-
email:
|
63
|
+
email:
|
70
64
|
- george.ogata@gmail.com
|
71
65
|
executables: []
|
72
|
-
|
73
66
|
extensions: []
|
74
|
-
|
75
|
-
extra_rdoc_files:
|
67
|
+
extra_rdoc_files:
|
76
68
|
- CHANGELOG
|
77
69
|
- LICENSE
|
78
70
|
- README.markdown
|
79
|
-
files:
|
71
|
+
files:
|
80
72
|
- lib/temporaries/adapters/base.rb
|
73
|
+
- lib/temporaries/adapters/mini_test.rb
|
81
74
|
- lib/temporaries/adapters/rspec.rb
|
82
75
|
- lib/temporaries/adapters/test_unit.rb
|
83
76
|
- lib/temporaries/adapters.rb
|
@@ -94,48 +87,48 @@ files:
|
|
94
87
|
- spec/support/test_context.rb
|
95
88
|
- spec/unit/temporaries/directory_spec.rb
|
96
89
|
- spec/unit/temporaries/values_spec.rb
|
90
|
+
- features/mini_test_integration.feature
|
97
91
|
- features/rspec_integration.feature
|
98
92
|
- features/test_unit_integration.feature
|
99
93
|
- features/step_definitions/command_steps.rb
|
100
94
|
- features/support/env.rb
|
101
95
|
homepage: http://github.com/oggy/temporaries
|
102
|
-
licenses:
|
103
|
-
|
96
|
+
licenses:
|
97
|
+
- MIT
|
104
98
|
post_install_message:
|
105
99
|
rdoc_options: []
|
106
|
-
|
107
|
-
require_paths:
|
100
|
+
require_paths:
|
108
101
|
- lib
|
109
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
103
|
none: false
|
111
|
-
requirements:
|
112
|
-
- -
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
|
115
|
-
segments:
|
104
|
+
requirements:
|
105
|
+
- - ! '>='
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
segments:
|
116
109
|
- 0
|
117
|
-
|
118
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
hash: 2522047447244818612
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
112
|
none: false
|
120
|
-
requirements:
|
121
|
-
- -
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
|
124
|
-
segments:
|
113
|
+
requirements:
|
114
|
+
- - ! '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
segments:
|
125
118
|
- 0
|
126
|
-
|
119
|
+
hash: 2522047447244818612
|
127
120
|
requirements: []
|
128
|
-
|
129
121
|
rubyforge_project:
|
130
|
-
rubygems_version: 1.8.
|
122
|
+
rubygems_version: 1.8.24
|
131
123
|
signing_key:
|
132
124
|
specification_version: 3
|
133
125
|
summary: Set temporary values declaratively.
|
134
|
-
test_files:
|
126
|
+
test_files:
|
135
127
|
- spec/spec_helper.rb
|
136
128
|
- spec/support/test_context.rb
|
137
129
|
- spec/unit/temporaries/directory_spec.rb
|
138
130
|
- spec/unit/temporaries/values_spec.rb
|
131
|
+
- features/mini_test_integration.feature
|
139
132
|
- features/rspec_integration.feature
|
140
133
|
- features/test_unit_integration.feature
|
141
134
|
- features/step_definitions/command_steps.rb
|