temporaries 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/Rakefile +15 -4
- data/features/mini_test_integration.feature +13 -1
- data/features/support/env.rb +2 -1
- data/lib/temporaries.rb +15 -9
- data/lib/temporaries/adapters/mini_test.rb +1 -3
- data/lib/temporaries/adapters/test_unit.rb +0 -2
- data/lib/temporaries/version.rb +1 -1
- metadata +4 -4
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -1,9 +1,20 @@
|
|
1
1
|
require 'ritual'
|
2
2
|
|
3
3
|
task :ci do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
sh 'rspec'
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'minitest/unit'
|
8
|
+
if (MiniTest::Unit::VERSION.scan(/\d+/).map { |s| s.to_i } <=> [2, 3, 0]) < 0
|
9
|
+
sh 'cucumber --tags=@minitest-2.2.2 features/mini_test_integration.feature'
|
10
|
+
else
|
11
|
+
sh 'cucumber --tags=@minitest --tags=~@minitest-2.2.2 features/mini_test_integration.feature'
|
12
|
+
end
|
13
|
+
rescue LoadError
|
14
|
+
# MiniTest may not be present on Ruby 1.8.
|
15
|
+
end
|
16
|
+
|
17
|
+
if $:.find { |dir| File.exist?("#{dir}/rspec.rb") }
|
18
|
+
sh 'cucumber features/rspec_integration.feature'
|
8
19
|
end
|
9
20
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
@1.9
|
2
1
|
Feature: MiniTest Integration
|
3
2
|
|
4
3
|
As a developer using MiniTest
|
5
4
|
I want to define temporary values
|
6
5
|
So I can run my tests in isolation
|
7
6
|
|
7
|
+
@minitest
|
8
8
|
Scenario: Using temporary values with MiniTest::Unit
|
9
9
|
Given I have a file "mini_test_unit.rb" containing:
|
10
10
|
"""
|
@@ -27,6 +27,7 @@ Feature: MiniTest Integration
|
|
27
27
|
When I run "ruby mini_test_unit.rb"
|
28
28
|
Then I should see "1 tests, 1 assertions, 0 failures, 0 errors"
|
29
29
|
|
30
|
+
@minitest
|
30
31
|
Scenario: Using temporary values with MiniTest::Spec
|
31
32
|
Given I have a file "mini_test_spec.rb" containing:
|
32
33
|
"""
|
@@ -48,3 +49,14 @@ Feature: MiniTest Integration
|
|
48
49
|
"""
|
49
50
|
When I run "ruby mini_test_spec.rb"
|
50
51
|
Then I should see "1 tests, 1 assertions, 0 failures, 0 errors"
|
52
|
+
|
53
|
+
@minitest @minitest-2.2.2
|
54
|
+
Scenario: Temporaries raises a compatibility error
|
55
|
+
Given I have a file "mini_test_spec.rb" containing:
|
56
|
+
"""
|
57
|
+
require 'minitest/spec'
|
58
|
+
require 'temporaries'
|
59
|
+
puts MiniTest::Unit::VERSION
|
60
|
+
"""
|
61
|
+
When I run "ruby mini_test_spec.rb"
|
62
|
+
Then I should see "Temporaries requires minitest 2.3.0 or higher."
|
data/features/support/env.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
ROOT = File.expand_path('../..', File.dirname(__FILE__))
|
2
2
|
$:.unshift File.expand_path('../../lib', File.dirname(__FILE__))
|
3
|
-
ENV['BUNDLE_GEMFILE'] = "#{ROOT}/Gemfile"
|
3
|
+
ENV['BUNDLE_GEMFILE'] = File.expand_path(ENV['BUNDLE_GEMFILE'] || "#{ROOT}/Gemfile")
|
4
4
|
|
5
5
|
$TEMPORARIES_TEST = true
|
6
6
|
require 'temporaries'
|
@@ -14,6 +14,7 @@ original_pwd = nil
|
|
14
14
|
|
15
15
|
Before do
|
16
16
|
FileUtils.mkdir_p TMP
|
17
|
+
FileUtils.cp "#{ROOT}/Gemfile", "#{TMP}/Gemfile"
|
17
18
|
original_pwd = Dir.pwd
|
18
19
|
Dir.chdir TMP
|
19
20
|
end
|
data/lib/temporaries.rb
CHANGED
@@ -7,14 +7,20 @@ end
|
|
7
7
|
|
8
8
|
if defined?($TEMPORARIES_TEST)
|
9
9
|
# Testing this library. Don't install anything.
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
else
|
11
|
+
defined?(RSpec) and
|
12
|
+
Temporaries::Adapters::RSpec.install
|
13
|
+
|
14
|
+
defined?(MiniTest::Spec) and
|
15
|
+
if (MiniTest::Unit::VERSION.scan(/\d+/).map { |s| s.to_i } <=> [2, 3, 0]) < 0
|
16
|
+
raise "Temporaries requires minitest 2.3.0 or higher. If you're using the version shipped with ruby, note that newer versions are available via gems."
|
17
|
+
else
|
18
|
+
Temporaries::Adapters::MiniTest.install
|
19
|
+
end
|
20
|
+
|
21
|
+
defined?(MiniTest::Unit) and
|
16
22
|
Temporaries::Adapters::TestUnit.install(MiniTest::Unit)
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
|
24
|
+
defined?(Test::Unit) and
|
25
|
+
Temporaries::Adapters::TestUnit.install(Test::Unit)
|
20
26
|
end
|
@@ -1,10 +1,8 @@
|
|
1
1
|
module Temporaries
|
2
2
|
module Adapters
|
3
3
|
class MiniTest < Base
|
4
|
-
# For ruby <= 1.9.2, MiniTest is actually adapted via the
|
5
|
-
# Test::Unit adapter.
|
6
4
|
def self.install
|
7
|
-
::MiniTest::
|
5
|
+
::MiniTest::Spec.class_eval do
|
8
6
|
extend Extension
|
9
7
|
include Values
|
10
8
|
include Directory
|
data/lib/temporaries/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: temporaries
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ritual
|
@@ -107,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
segments:
|
109
109
|
- 0
|
110
|
-
hash: -
|
110
|
+
hash: -1732108296292991121
|
111
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
112
|
none: false
|
113
113
|
requirements:
|
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
116
|
version: '0'
|
117
117
|
segments:
|
118
118
|
- 0
|
119
|
-
hash: -
|
119
|
+
hash: -1732108296292991121
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
122
|
rubygems_version: 1.8.24
|