assert_value 1.1 → 1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -121,6 +121,7 @@ In Ruby 1.9:
121
121
 
122
122
  ## Changelog
123
123
 
124
+ - 1.2: Rails 4.1 and minitest gem support
124
125
  - 1.1: RSpec support
125
126
  - 1.0: Rename to assert_value
126
127
  - 0.7: Support Ruby 1.9's MiniTest
data/assert_value.gemspec CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  SPEC = Gem::Specification.new do |s|
4
4
  s.name = "assert_value"
5
- s.version = "1.1"
5
+ s.version = "1.2"
6
6
  s.author = "Pluron, Inc."
7
7
  s.email = "support@pluron.com"
8
8
  s.homepage = "http://github.com/acunote/assert_value"
data/lib/assert_value.rb CHANGED
@@ -1,11 +1,17 @@
1
1
  # Copyright (c) 2010-2011 Pluron, Inc.
2
- require 'test/unit/testcase'
2
+
3
+ if defined?(Minitest)
4
+ # nothing to require, minitest gem is already loaded
5
+ # it's the only way we can detect Minitest presence
6
+ else
7
+ require 'test/unit/testcase'
8
+ end
3
9
  require 'text_diff'
4
10
  require 'pathname'
5
11
 
6
12
  $assert_value_options = []
7
13
 
8
- if RUBY_VERSION >= "1.9.0"
14
+ if RUBY_VERSION >= "1.9.0" and !defined?(Minitest) # minitest options are handled by minitest/assert_value_plugin.rb
9
15
 
10
16
  # Test/Unit from Ruby 1.9 can't accept additional options like it did in 1.8:
11
17
  # ruby test.rb -- --foo
@@ -406,8 +412,14 @@ private
406
412
  end
407
413
 
408
414
  if RUBY_VERSION >= "1.9.0"
409
- class MiniTest::Unit::TestCase
410
- include AssertValueAssertion
415
+ if defined? Minitest::Test
416
+ class Minitest::Test
417
+ include AssertValueAssertion
418
+ end
419
+ else
420
+ class MiniTest::Unit::TestCase
421
+ include AssertValueAssertion
422
+ end
411
423
  end
412
424
  else
413
425
  class Test::Unit::TestCase
@@ -0,0 +1,13 @@
1
+ module Minitest
2
+ def self.plugin_assert_value_options(opts, options)
3
+ opts.on '--no-interactive', 'assert_value: non-interactive mode' do |flag|
4
+ $assert_value_options << "--no-interactive"
5
+ end
6
+ opts.on '--no-canonicalize', 'assert_value: turn off canonicalization' do |flag|
7
+ $assert_value_options << "--no-canonicalize"
8
+ end
9
+ opts.on '--autoaccept', 'assert_value: automatically accept new actual values' do |flag|
10
+ $assert_value_options << "--autoaccept"
11
+ end
12
+ end
13
+ end
@@ -1,9 +1,14 @@
1
1
  # Copyright (c) 2011 Pluron, Inc.
2
2
 
3
- require 'test/unit'
3
+ begin
4
+ require 'minitest/autorun'
5
+ rescue LoadError
6
+ require 'test/unit'
7
+ end
8
+
4
9
  require 'assert_value'
5
10
 
6
- class AssertValueTest < Test::Unit::TestCase
11
+ class AssertValueTest < ( defined?(Minitest) ? Minitest::Test : Test::Unit::TestCase )
7
12
 
8
13
  def test_basic_assert_value
9
14
  assert_value "foo", <<-END
@@ -88,7 +93,7 @@ end
88
93
 
89
94
  if RUBY_VERSION >= "1.9.0"
90
95
 
91
- class AssertValueMiniTest < MiniTest::Unit::TestCase
96
+ class AssertValueMiniTest < (defined?(Minitest) ? Minitest::Test : MiniTest::Unit::TestCase)
92
97
 
93
98
  def test_basic_assert_value
94
99
  assert_value "foo", <<-END
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assert_value
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: '1.2'
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: 2013-10-28 00:00:00.000000000 Z
12
+ date: 2014-04-17 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: assert_value assertion
15
15
  email: support@pluron.com
@@ -26,6 +26,7 @@ files:
26
26
  - assert_value.kdev4
27
27
  - lib/array_diff.rb
28
28
  - lib/assert_value.rb
29
+ - lib/minitest/assert_value_plugin.rb
29
30
  - lib/text_diff.rb
30
31
  - test/assert_value_spec.rb
31
32
  - test/assert_value_test.rb