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 CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.3.0 2012-06-26
2
+
3
+ * Fix support for gem distributions of MiniTest.
4
+ * MiniTest < 2.3.0 is no longer supported.
5
+
1
6
  == 0.2.0 2012-06-08
2
7
 
3
8
  * Methods to set temporary method definitions.
data/Rakefile CHANGED
@@ -1,9 +1,20 @@
1
1
  require 'ritual'
2
2
 
3
3
  task :ci do
4
- if RUBY_VERSION >= '1.9'
5
- sh 'bundle exec rspec spec && bundle exec cucumber'
6
- else
7
- sh 'bundle exec rspec spec && bundle exec cucumber --tags=~@1.9'
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."
@@ -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
@@ -7,14 +7,20 @@ end
7
7
 
8
8
  if defined?($TEMPORARIES_TEST)
9
9
  # Testing this library. Don't install anything.
10
- elsif defined?(RSpec)
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
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
- end
18
- elsif defined?(Test::Unit)
19
- Temporaries::Adapters::TestUnit.install(Test::Unit)
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::Unit::TestCase.class_eval do
5
+ ::MiniTest::Spec.class_eval do
8
6
  extend Extension
9
7
  include Values
10
8
  include Directory
@@ -1,8 +1,6 @@
1
1
  module Temporaries
2
2
  module Adapters
3
3
  class TestUnit < Base
4
- # This is used for both Test::Unit <= 1.9 and MiniTest::Unit
5
- # <= 1.9.2.
6
4
  def self.install(mod)
7
5
  mod::TestCase.class_eval do
8
6
  extend Extension
@@ -1,5 +1,5 @@
1
1
  module Temporaries
2
- VERSION = [0, 2, 0]
2
+ VERSION = [0, 3, 0]
3
3
 
4
4
  class << VERSION
5
5
  include Comparable
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.2.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-08 00:00:00.000000000 Z
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: -3674253645093316834
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: -3674253645093316834
119
+ hash: -1732108296292991121
120
120
  requirements: []
121
121
  rubyforge_project:
122
122
  rubygems_version: 1.8.24