assert_value 1.4.1 → 1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +59 -0
- data/Gemfile +1 -1
- data/LICENSE +1 -1
- data/README.md +2 -0
- data/Rakefile +30 -15
- data/assert_value.gemspec +1 -1
- data/gemfiles/minitest.4.7.5.gemfile +7 -0
- data/gemfiles/minitest.gemfile +6 -0
- data/gemfiles/old-rubies.gemfile +6 -0
- data/gemfiles/rspec.2.99.gemfile +6 -0
- data/gemfiles/rspec.gemfile +6 -0
- data/gemfiles/test-unit.gemfile +6 -0
- data/lib/assert_value.rb +23 -14
- data/test/assert_value_test.rb +10 -4
- metadata +17 -8
- checksums.yaml +0 -7
data/.travis.yml
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
rvm:
|
4
|
+
- 1.8.7
|
5
|
+
- 1.9.3
|
6
|
+
- 2.2.2
|
7
|
+
- 2.2.3
|
8
|
+
|
9
|
+
gemfile: Gemfile
|
10
|
+
|
11
|
+
# Test for various gem versions we currently support
|
12
|
+
matrix:
|
13
|
+
include:
|
14
|
+
- rvm: 1.8.7
|
15
|
+
gemfile: gemfiles/old-rubies.gemfile
|
16
|
+
script:
|
17
|
+
- bundle exec rake test
|
18
|
+
- bundle exec rspec test
|
19
|
+
- rvm: 1.8.7
|
20
|
+
gemfile: gemfiles/rspec.2.99.gemfile
|
21
|
+
script: bundle exec rspec test
|
22
|
+
- rvm: 1.9.3
|
23
|
+
gemfile: gemfiles/old-rubies.gemfile
|
24
|
+
script:
|
25
|
+
- bundle exec rake test
|
26
|
+
- bundle exec rspec test
|
27
|
+
- rvm: 1.9.3
|
28
|
+
gemfile: gemfiles/rspec.2.99.gemfile
|
29
|
+
script: bundle exec rspec test
|
30
|
+
- rvm: 2.2.2
|
31
|
+
gemfile: gemfiles/rspec.2.99.gemfile
|
32
|
+
script: bundle exec rspec test
|
33
|
+
- rvm: 2.2.2
|
34
|
+
gemfile: gemfiles/minitest.4.7.5.gemfile
|
35
|
+
script: bundle exec rake test
|
36
|
+
- rvm: 2.2.2
|
37
|
+
gemfile: gemfiles/minitest.gemfile
|
38
|
+
script: bundle exec rake test
|
39
|
+
- rvm: 2.2.2
|
40
|
+
gemfile: gemfiles/test-unit.gemfile
|
41
|
+
script: bundle exec rake test
|
42
|
+
- rvm: 2.2.2
|
43
|
+
gemfile: gemfiles/rspec.gemfile
|
44
|
+
script: bundle exec rake spec
|
45
|
+
- rvm: 2.2.3
|
46
|
+
gemfile: gemfiles/rspec.2.99.gemfile
|
47
|
+
script: bundle exec rspec test
|
48
|
+
- rvm: 2.2.3
|
49
|
+
gemfile: gemfiles/minitest.4.7.5.gemfile
|
50
|
+
script: bundle exec rake test
|
51
|
+
- rvm: 2.2.2
|
52
|
+
gemfile: gemfiles/minitest.gemfile
|
53
|
+
script: bundle exec rake test
|
54
|
+
- rvm: 2.2.3
|
55
|
+
gemfile: gemfiles/test-unit.gemfile
|
56
|
+
script: bundle exec rake test
|
57
|
+
- rvm: 2.2.3
|
58
|
+
gemfile: gemfiles/rspec.gemfile
|
59
|
+
script: bundle exec rake spec
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -121,6 +121,8 @@ In Ruby 1.9:
|
|
121
121
|
|
122
122
|
## Changelog
|
123
123
|
|
124
|
+
- 1.5: Improve support for various testing frameworks and Ruby versions:
|
125
|
+
Ruby 2.2.2, 2.2.3, RSpec 2.x, 3.x, Test::Unit 2.x, 3.x, Minitest 4.x, 5.x
|
124
126
|
- 1.4: Fix RSpec support
|
125
127
|
- 1.3: Improve support for various testing frameworks, fix assertion counters
|
126
128
|
- 1.2: Rails 4.1 and minitest gem support
|
data/Rakefile
CHANGED
@@ -1,14 +1,17 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/testtask'
|
3
|
-
|
3
|
+
begin
|
4
|
+
require 'rdoc/task'
|
5
|
+
rescue LoadError
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rspec/core/rake_task'
|
9
|
+
rescue LoadError
|
10
|
+
end
|
4
11
|
require 'bundler/setup'
|
5
|
-
require 'rspec/core/rake_task'
|
6
12
|
|
7
13
|
Bundler::GemHelper.install_tasks
|
8
14
|
|
9
|
-
desc 'Default: run unit tests.'
|
10
|
-
task :default => :test
|
11
|
-
|
12
15
|
desc 'Test assert_value.'
|
13
16
|
Rake::TestTask.new(:test) do |t|
|
14
17
|
t.libs << 'lib'
|
@@ -16,16 +19,28 @@ Rake::TestTask.new(:test) do |t|
|
|
16
19
|
t.verbose = true
|
17
20
|
end
|
18
21
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
+
if defined?(RSpec)
|
23
|
+
desc "Run the specs."
|
24
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
25
|
+
t.pattern = "test/**/*_spec.rb"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
if defined?(RSpec) and RUBY_VERSION > '1.9.3'
|
30
|
+
desc 'Default: run specs.'
|
31
|
+
task :default => :spec
|
32
|
+
else
|
33
|
+
desc 'Default: run unit tests.'
|
34
|
+
task :default => :test
|
22
35
|
end
|
23
36
|
|
24
|
-
|
25
|
-
|
26
|
-
rdoc
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
37
|
+
if defined?(Rake::RDocTask)
|
38
|
+
desc 'Generate documentation for assert_value.'
|
39
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
40
|
+
rdoc.rdoc_dir = 'rdoc'
|
41
|
+
rdoc.title = 'assert_value'
|
42
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
43
|
+
rdoc.rdoc_files.include('README')
|
44
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
+
end
|
31
46
|
end
|
data/assert_value.gemspec
CHANGED
data/lib/assert_value.rb
CHANGED
@@ -1,19 +1,24 @@
|
|
1
|
-
# Copyright (c) 2010-
|
1
|
+
# Copyright (c) 2010-2015 Pluron, Inc.
|
2
2
|
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# with .
|
3
|
+
# there're 4 types of test frameworks we support
|
4
|
+
# 1) Test::Unit from Ruby <= 1.8.7 and Ruby >= 2.2.2
|
5
|
+
# 2) Minitest 2.x-4.x, either bundled with Ruby 1.9 - 2.1 or installed via gem
|
6
|
+
# 3) Minitest > 5.0 bundles with Ruby >= 2.2.2 or installed via gem
|
7
|
+
# 4) RSpec
|
6
8
|
begin
|
7
|
-
require 'minitest/
|
9
|
+
require 'minitest/autorun' # Minitest 5.x
|
8
10
|
rescue LoadError
|
9
|
-
|
11
|
+
begin
|
12
|
+
require 'minitest/unit' # old Minitest
|
13
|
+
rescue LoadError
|
14
|
+
begin
|
15
|
+
require 'test/unit' # Test::Unit
|
16
|
+
rescue LoadError
|
17
|
+
# RSpec only
|
18
|
+
end
|
19
|
+
end
|
10
20
|
end
|
11
21
|
|
12
|
-
# there're 3 types of test frameworks we support
|
13
|
-
# 1) test/unit from Ruby 1.8
|
14
|
-
# 2) old minitest 2.x-4.x, either bundled with Ruby 1.9 - 2.1 or installed via gem
|
15
|
-
# 3) new minitest 5.x from minitest gem (required for example by Rails 4.1)
|
16
|
-
|
17
22
|
if defined?(Minitest) and Minitest.const_defined?("VERSION") and Minitest::VERSION >= "5.0.0"
|
18
23
|
ASSERT_VALUE_TEST_FRAMEWORK = :new_minitest
|
19
24
|
elsif defined?(MiniTest)
|
@@ -21,7 +26,7 @@ elsif defined?(MiniTest)
|
|
21
26
|
elsif defined?(Test)
|
22
27
|
ASSERT_VALUE_TEST_FRAMEWORK = :test_unit
|
23
28
|
else
|
24
|
-
|
29
|
+
ASSERT_VALUE_TEST_FRAMEWORK = :rspec_only
|
25
30
|
end
|
26
31
|
|
27
32
|
require 'text_diff'
|
@@ -469,13 +474,17 @@ class BeSameValueAs
|
|
469
474
|
end
|
470
475
|
end
|
471
476
|
|
472
|
-
def
|
477
|
+
def failure_message
|
473
478
|
"expected to be the same"
|
474
479
|
end
|
475
480
|
|
476
|
-
def
|
481
|
+
def failure_message_when_negated
|
477
482
|
"expected not to be the same"
|
478
483
|
end
|
484
|
+
|
485
|
+
def supports_block_expectations?
|
486
|
+
true
|
487
|
+
end
|
479
488
|
end
|
480
489
|
|
481
490
|
|
data/test/assert_value_test.rb
CHANGED
@@ -1,10 +1,16 @@
|
|
1
|
-
# Copyright (c) 2011 Pluron, Inc.
|
1
|
+
# Copyright (c) 2011-2015 Pluron, Inc.
|
2
2
|
|
3
|
-
require 'test/unit'
|
4
|
-
# require 'minitest/autorun' # uncomment to test with minitest 5.x gem (enable it in Gemfile too)
|
5
3
|
require 'assert_value'
|
6
4
|
|
7
|
-
|
5
|
+
test_case_class = case ASSERT_VALUE_TEST_FRAMEWORK
|
6
|
+
when :new_minitest then Minitest::Test
|
7
|
+
when :old_minitest then MiniTest::Unit::TestCase
|
8
|
+
when :test_unit then Test::Unit::TestCase
|
9
|
+
when :rspec_only then raise "This test case requires either Minitest or Test::Unit"
|
10
|
+
else raise "Unknown test framework"
|
11
|
+
end
|
12
|
+
|
13
|
+
class AssertValueTest < test_case_class
|
8
14
|
|
9
15
|
def test_basic_assert_value
|
10
16
|
assert_value "foo", <<-END
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assert_value
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.5'
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Pluron, Inc.
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2015-10-14 00:00:00.000000000 Z
|
12
13
|
dependencies: []
|
13
14
|
description: assert_value assertion
|
14
15
|
email: support@pluron.com
|
@@ -16,13 +17,20 @@ executables: []
|
|
16
17
|
extensions: []
|
17
18
|
extra_rdoc_files: []
|
18
19
|
files:
|
19
|
-
-
|
20
|
+
- .gitignore
|
21
|
+
- .travis.yml
|
20
22
|
- Gemfile
|
21
23
|
- LICENSE
|
22
24
|
- README.md
|
23
25
|
- Rakefile
|
24
26
|
- assert_value.gemspec
|
25
27
|
- assert_value.kdev4
|
28
|
+
- gemfiles/minitest.4.7.5.gemfile
|
29
|
+
- gemfiles/minitest.gemfile
|
30
|
+
- gemfiles/old-rubies.gemfile
|
31
|
+
- gemfiles/rspec.2.99.gemfile
|
32
|
+
- gemfiles/rspec.gemfile
|
33
|
+
- gemfiles/test-unit.gemfile
|
26
34
|
- lib/array_diff.rb
|
27
35
|
- lib/assert_value.rb
|
28
36
|
- lib/minitest/assert_value_plugin.rb
|
@@ -34,26 +42,27 @@ files:
|
|
34
42
|
homepage: http://github.com/acunote/assert_value
|
35
43
|
licenses:
|
36
44
|
- MIT
|
37
|
-
metadata: {}
|
38
45
|
post_install_message:
|
39
46
|
rdoc_options: []
|
40
47
|
require_paths:
|
41
48
|
- lib
|
42
49
|
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
43
51
|
requirements:
|
44
|
-
- -
|
52
|
+
- - ! '>='
|
45
53
|
- !ruby/object:Gem::Version
|
46
54
|
version: '0'
|
47
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
48
57
|
requirements:
|
49
|
-
- -
|
58
|
+
- - ! '>='
|
50
59
|
- !ruby/object:Gem::Version
|
51
60
|
version: '0'
|
52
61
|
requirements: []
|
53
62
|
rubyforge_project:
|
54
|
-
rubygems_version:
|
63
|
+
rubygems_version: 1.8.23.2
|
55
64
|
signing_key:
|
56
|
-
specification_version:
|
65
|
+
specification_version: 3
|
57
66
|
summary: Assert that checks that two values (strings, expected and actual) are same
|
58
67
|
and which can magically replace expected value with the actual in case the new behavior
|
59
68
|
(and new actual value) is correct
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: d4ee11a14d96bed2e62ba48a26b7f2824e3b1092
|
4
|
-
data.tar.gz: a7a8b98b575257c2e6bb514e47232fedaf98f8e9
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: f1d9b8185697c532c82f3d1b8dd50c7323b87759130a8a817c1e8e3ecd1ac718b6db78126125c08929e02d4795dd8b6c9bb57ef46e093619e6e67346c32945a7
|
7
|
-
data.tar.gz: a935f47a6ae4f8b3ad202c53b811ff9cd50fd162e2d49151063e691140a4c3e3efbe8489dd02ac900d56156465148bc02e9f4604f43913f3ed5c06463be1a9c2
|