assert_value 1.5.3 → 1.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7201eba13f6309417d94784e31a974d8f3842d12
4
+ data.tar.gz: 0c52bdc71d9173a6140d5b82c6db7260fb1f2f3e
5
+ SHA512:
6
+ metadata.gz: 3550049d50439d6a52d5ad069ec7c81b17d957c936dede0b44506440da52baf11ebf75f94cc466809638ce14760335b8bf1ee34c608664c9c1a2082df9f4a524
7
+ data.tar.gz: 21eac2d89f497afacb6ee62e202283a0938e58498ed0abc41cb865a55ebbfb4021812b48533a888ae8db6cd6cbcd690787106fb9865b2178991bce262167b248
data/.gitignore CHANGED
@@ -2,5 +2,7 @@
2
2
  *.gem
3
3
  pkg
4
4
  .kdev4
5
+ Gemfile
5
6
  Gemfile.lock
6
7
  .bundle
8
+ .ruby-version
data/.travis.yml CHANGED
@@ -9,73 +9,59 @@ language: ruby
9
9
  rvm:
10
10
  - 1.8.7
11
11
  - 1.9.3
12
- - 2.2.2
13
- - 2.2.3
14
- - 2.3.0
12
+ - 2.2.6
13
+ - 2.3.3
14
+ - 2.4.1
15
15
 
16
- gemfile: Gemfile
17
-
18
- # Test for various gem versions we currently support
19
16
  matrix:
17
+ # Do not run tests with default Gemfile. We don't have it
18
+ exclude:
19
+ - rvm: 1.8.7
20
+ - rvm: 1.9.3
21
+ - rvm: 2.2.6
22
+ - rvm: 2.3.3
23
+ - rvm: 2.4.1
20
24
  include:
21
25
  - rvm: 1.8.7
22
- gemfile: gemfiles/old-rubies.gemfile
23
- script:
24
- - bundle exec rake test
25
- - bundle exec rspec test
26
+ gemfile: gemfiles/test-unit.bundled.gemfile
26
27
  - rvm: 1.8.7
27
28
  gemfile: gemfiles/rspec.2.99.gemfile
28
29
  script: bundle exec rspec test
30
+ - rvm: 1.8.7
31
+ gemfile: gemfiles/rspec.latest.gemfile
32
+ script: bundle exec rake spec
29
33
  - rvm: 1.9.3
30
- gemfile: gemfiles/old-rubies.gemfile
31
- script:
32
- - bundle exec rake test
33
- - bundle exec rspec test
34
+ gemfile: gemfiles/minitest.bundled.gemfile
34
35
  - rvm: 1.9.3
35
36
  gemfile: gemfiles/rspec.2.99.gemfile
36
37
  script: bundle exec rspec test
37
- - rvm: 2.2.2
38
- gemfile: gemfiles/rspec.2.99.gemfile
39
- script: bundle exec rspec test
40
- - rvm: 2.2.2
41
- gemfile: gemfiles/minitest.4.7.5.gemfile
42
- script: bundle exec rake test
43
- - rvm: 2.2.2
44
- gemfile: gemfiles/minitest.gemfile
38
+ - rvm: 1.9.3
39
+ gemfile: gemfiles/rspec.latest.gemfile
40
+ script: bundle exec rake spec
41
+ - rvm: 2.2.6
42
+ gemfile: gemfiles/test-unit.latest.gemfile
45
43
  script: bundle exec rake test
46
- - rvm: 2.2.2
47
- gemfile: gemfiles/test-unit.gemfile
44
+ - rvm: 2.2.6
45
+ gemfile: gemfiles/minitest.latest.gemfile
48
46
  script: bundle exec rake test
49
- - rvm: 2.2.2
50
- gemfile: gemfiles/rspec.gemfile
47
+ - rvm: 2.2.6
48
+ gemfile: gemfiles/rspec.latest.gemfile
51
49
  script: bundle exec rake spec
52
- - rvm: 2.2.3
53
- gemfile: gemfiles/rspec.2.99.gemfile
54
- script: bundle exec rspec test
55
- - rvm: 2.2.3
56
- gemfile: gemfiles/minitest.4.7.5.gemfile
50
+ - rvm: 2.3.3
51
+ gemfile: gemfiles/test-unit.latest.gemfile
57
52
  script: bundle exec rake test
58
- - rvm: 2.2.3
59
- gemfile: gemfiles/minitest.gemfile
53
+ - rvm: 2.3.3
54
+ gemfile: gemfiles/minitest.latest.gemfile
60
55
  script: bundle exec rake test
61
- - rvm: 2.2.3
62
- gemfile: gemfiles/test-unit.gemfile
63
- script: bundle exec rake test
64
- - rvm: 2.2.3
65
- gemfile: gemfiles/rspec.gemfile
56
+ - rvm: 2.3.3
57
+ gemfile: gemfiles/rspec.latest.gemfile
66
58
  script: bundle exec rake spec
67
- - rvm: 2.3.0
68
- gemfile: gemfiles/rspec.2.99.gemfile
69
- script: bundle exec rspec test
70
- - rvm: 2.3.0
71
- gemfile: gemfiles/minitest.4.7.5.gemfile
72
- script: bundle exec rake test
73
- - rvm: 2.3.0
74
- gemfile: gemfiles/minitest.gemfile
59
+ - rvm: 2.4.1
60
+ gemfile: gemfiles/test-unit.latest.gemfile
75
61
  script: bundle exec rake test
76
- - rvm: 2.3.0
77
- gemfile: gemfiles/test-unit.gemfile
62
+ - rvm: 2.4.1
63
+ gemfile: gemfiles/minitest.latest.gemfile
78
64
  script: bundle exec rake test
79
- - rvm: 2.3.0
80
- gemfile: gemfiles/rspec.gemfile
65
+ - rvm: 2.4.1
66
+ gemfile: gemfiles/rspec.latest.gemfile
81
67
  script: bundle exec rake spec
data/README.md CHANGED
@@ -122,6 +122,75 @@ In Ruby 1.9:
122
122
  rake test TESTOPTS="--no-canonicalize --autoaccept"
123
123
 
124
124
 
125
+ ## Supported Rubies and Test Frameworks
126
+
127
+ | Framework / Ruby | 1.8.7 | 1.9.3 | 2.0+ |
128
+ |---------------------|-------|-------|------|
129
+ | Test-Unit (bundled) | Yes | No | No |
130
+ | Minitest (bundled) | No | Yes | No |
131
+ | Test-Unit (latest) | No | No | Yes |
132
+ | Minitest (latest) | No | No | Yes |
133
+ | Rspec 2.99 | Yes | Yes | No |
134
+ | Rspec (latest) | Yes | Yes | Yes |
135
+
136
+ - ruby 1,8.7 came with bundled Test-unit 1.2.3 and cannot run latest Test-Unit
137
+ and Minitest frameworks
138
+ - ruby 1.9.3 came with bundled Minitest 2.5.1 and cannot run other Test-Unit
139
+ and MInitest frameworks
140
+ - RSpec 2.99 is the latest RSpec framework compatible with Rails 2.3
141
+
142
+ ## Development
143
+
144
+
145
+ One way to setup development environment using rbenv:
146
+
147
+ ```bash
148
+ # compile ruby
149
+ rbenv install 2.3.0
150
+
151
+ # set local version of ruby under rbenv
152
+ rbenv local 2.3.0
153
+
154
+ # install bundler
155
+ gem install bundle
156
+
157
+ # configure bundler
158
+ bundle config --local path .bundle/gems
159
+ bundle config --local bin .bundle/bin # binstubs
160
+ bundle config # to see current settings
161
+
162
+ # below seems to be necessary, having a Gemfile in
163
+ # subdirectory like
164
+ # bundle config --local gemfile gemfiles/test-unit.bundled.gemfile
165
+ # breaks tests in old rubies
166
+ ln -s gemfiles/test-unit.bundled.gemfile Gemfile
167
+
168
+ # install gems
169
+ bundle install
170
+ ```
171
+ ## Run Tests
172
+
173
+ Test-Unit and Minitest
174
+ ```
175
+ bundle exec rake test
176
+ ```
177
+ RSpec 2.99
178
+ ```
179
+ bundle exec rspec test
180
+ ```
181
+
182
+ RSpec 3+
183
+ ```
184
+ bundle exec rake spec
185
+ ```
186
+
187
+ ## Building The Gem
188
+ ```
189
+ gem build assert_value.gemspec
190
+ ls assert_value-*.gem
191
+ gem push assert_value-*.gem
192
+ ```
193
+
125
194
  ## Changelog
126
195
 
127
196
  - 1.5: Improve support for various testing frameworks and Ruby versions:
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.5.3"
5
+ s.version = "1.5.4"
6
6
  s.author = "Pluron, Inc."
7
7
  s.email = "support@pluron.com"
8
8
  s.homepage = "http://github.com/acunote/assert_value"
@@ -1,8 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gemspec
3
+ # Minitest 2.5.1 is bundled with ruby 1.9.3
4
4
 
5
5
  group :development, :test do
6
6
  gem 'rake'
7
- gem 'rspec'
8
7
  end
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  group :development, :test do
4
- gem 'rake'
4
+ gem 'rake', '10.5.0'
5
5
  gem 'rspec', '~> 2.99.0'
6
6
  end
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Test-Unit 1.2.3 is bundled with ruby 1.8
4
+
5
+ group :development, :test do
6
+ # Latest rake compatible with ruby 1.8.7
7
+ gem 'rake', '10.5.0'
8
+ end
data/lib/array_diff.rb CHANGED
@@ -155,8 +155,6 @@ class ArrayDiff
155
155
  offset = 0
156
156
  @diffs.each { |b|
157
157
  first = b[0][1]
158
- length = b.length
159
- action = b[0][0]
160
158
  addcount = 0
161
159
  remcount = 0
162
160
  b.each { |l|
@@ -180,8 +178,8 @@ class ArrayDiff
180
178
  print "< "
181
179
  elsif l[0] == "+"
182
180
  offset += 1
183
- if lastdel
184
- lastdel = false
181
+ if lastdel
182
+ lastdel = false
185
183
  puts "---"
186
184
  end
187
185
  print "> "
data/lib/assert_value.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  # Copyright (c) 2010-2015 Pluron, Inc.
2
-
3
2
  # there're 4 types of test frameworks we support
4
3
  # 1) Test::Unit from Ruby <= 1.8.7 and Ruby >= 2.2.2
5
4
  # 2) Minitest 2.x-4.x, either bundled with Ruby 1.9 - 2.1 or installed via gem
@@ -71,7 +70,7 @@ end
71
70
 
72
71
  #Use this to raise internal error with a given message
73
72
  #You can define your own method for your application
74
- unless defined? internal_error
73
+ unless defined?(internal_error)
75
74
  def internal_error(message = 'internal error')
76
75
  raise message
77
76
  end
@@ -190,7 +189,7 @@ module AssertValueAssertion
190
189
  if block_given?
191
190
  # rspec passes block to the expect() function, not to the matcher
192
191
  # so string substitution should work as if assert_value is called with a string
193
- mode = @rspec_matcher ? :scalar : :block
192
+ mode = defined?(@rspec_matcher) ? :scalar : :block
194
193
  expected = args[0]
195
194
  actual = ""
196
195
  begin
@@ -212,7 +211,7 @@ module AssertValueAssertion
212
211
  elsif expected.class == Hash
213
212
  raise ":log key is missing" unless expected.has_key? :log
214
213
  log_file = expected[:log]
215
- if defined? RAILS_ROOT
214
+ if defined?(RAILS_ROOT)
216
215
  log_file = File.expand_path(log_file, RAILS_ROOT)
217
216
  else
218
217
  log_file = File.expand_path(log_file, Dir.pwd)
@@ -285,7 +284,7 @@ private
285
284
  end
286
285
 
287
286
  def increment_assertion_count
288
- return if @rspec_matcher or self.class.name =~ /RSpec/
287
+ return if defined?(@rspec_matcher) or self.class.name =~ /RSpec/
289
288
  case ASSERT_VALUE_TEST_FRAMEWORK
290
289
  when :new_minitest then self.assertions += 1
291
290
  when :old_minitest then self._assertions += 1
@@ -296,6 +295,8 @@ private
296
295
  def soft_fail(diff)
297
296
  if [:new_minitest, :old_minitest].include?(ASSERT_VALUE_TEST_FRAMEWORK)
298
297
  failure = MiniTest::Assertion.new(diff)
298
+ elsif [:rspec_only].include?(ASSERT_VALUE_TEST_FRAMEWORK)
299
+ failure = diff
299
300
  else
300
301
  failure = Test::Unit::Failure.new(name, filter_backtrace(caller(0)), diff)
301
302
  end
@@ -315,8 +316,8 @@ private
315
316
  # change - what to do with expected value (:create_expected_string or :update_expected_string)
316
317
  # mode - describes signature of assert_value call by type of main argument (:block or :scalar)
317
318
  def accept_string(actual, change, mode)
318
- depth = @rspec_matcher ? 6 : 3
319
- file, method, line = get_caller_location(:depth => depth)
319
+ depth = @rspec_matcher ? 8 : 3
320
+ file, _, line = get_caller_location(:depth => depth)
320
321
 
321
322
  # read source file, construct the new source, replacing everything
322
323
  # between "do" and "end" in assert_value's block
data/lib/text_diff.rb CHANGED
@@ -45,8 +45,6 @@ class TextDiff
45
45
  offset = 0
46
46
  diff.diffs.each do |tuple|
47
47
  first = tuple[0][1]
48
- length = tuple.length
49
- action = tuple[0][0]
50
48
  addcount = 0
51
49
  remcount = 0
52
50
  tuple.each do |l|
@@ -65,7 +63,6 @@ class TextDiff
65
63
  end
66
64
  result += self.chunk(a, from, to)
67
65
  from = nextfrom
68
- lastdel = (tuple[0][0] == "-")
69
66
  tuple.each do |l|
70
67
  if l[0] == "-"
71
68
  offset -= 1
@@ -80,7 +77,7 @@ class TextDiff
80
77
  elsif a.length > 0
81
78
  result += self.chunk(a, from, a.length-1)
82
79
  end
83
- linecount = addcount = remcount = offset = current_offset = 0
80
+ linecount = addcount = remcount = offset = 0
84
81
  info_index = nil
85
82
  result.each_with_index do |l, i|
86
83
  if l[0] == '@'
@@ -61,7 +61,7 @@ class AssertValueTest < test_case_class
61
61
  assert_value(<<-END) do
62
62
  All Ok!
63
63
  END
64
- a = "All Ok!"
64
+ "All" + " Ok!"
65
65
  end
66
66
  end
67
67
 
metadata CHANGED
@@ -1,47 +1,34 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: assert_value
3
- version: !ruby/object:Gem::Version
4
- hash: 5
5
- prerelease:
6
- segments:
7
- - 1
8
- - 5
9
- - 3
10
- version: 1.5.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.5.4
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Pluron, Inc.
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2016-01-18 00:00:00 -05:00
19
- default_executable:
11
+ date: 2017-05-10 00:00:00.000000000 Z
20
12
  dependencies: []
21
-
22
13
  description: assert_value assertion
23
14
  email: support@pluron.com
24
15
  executables: []
25
-
26
16
  extensions: []
27
-
28
17
  extra_rdoc_files: []
29
-
30
- files:
31
- - .gitignore
32
- - .travis.yml
33
- - Gemfile
18
+ files:
19
+ - ".gitignore"
20
+ - ".travis.yml"
34
21
  - LICENSE
35
22
  - README.md
36
23
  - Rakefile
37
24
  - assert_value.gemspec
38
25
  - assert_value.kdev4
39
- - gemfiles/minitest.4.7.5.gemfile
40
- - gemfiles/minitest.gemfile
41
- - gemfiles/old-rubies.gemfile
26
+ - gemfiles/minitest.bundled.gemfile
27
+ - gemfiles/minitest.latest.gemfile
42
28
  - gemfiles/rspec.2.99.gemfile
43
- - gemfiles/rspec.gemfile
44
- - gemfiles/test-unit.gemfile
29
+ - gemfiles/rspec.latest.gemfile
30
+ - gemfiles/test-unit.bundled.gemfile
31
+ - gemfiles/test-unit.latest.gemfile
45
32
  - lib/array_diff.rb
46
33
  - lib/assert_value.rb
47
34
  - lib/minitest/assert_value_plugin.rb
@@ -50,41 +37,33 @@ files:
50
37
  - test/assert_value_test.rb
51
38
  - test/logs/assert_value_exception_with_files.log.ref
52
39
  - test/logs/assert_value_with_files.log.ref
53
- has_rdoc: true
54
40
  homepage: http://github.com/acunote/assert_value
55
- licenses:
41
+ licenses:
56
42
  - MIT
43
+ metadata: {}
57
44
  post_install_message:
58
45
  rdoc_options: []
59
-
60
- require_paths:
46
+ require_paths:
61
47
  - lib
62
- required_ruby_version: !ruby/object:Gem::Requirement
63
- none: false
64
- requirements:
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
65
50
  - - ">="
66
- - !ruby/object:Gem::Version
67
- hash: 3
68
- segments:
69
- - 0
70
- version: "0"
71
- required_rubygems_version: !ruby/object:Gem::Requirement
72
- none: false
73
- requirements:
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
74
55
  - - ">="
75
- - !ruby/object:Gem::Version
76
- hash: 3
77
- segments:
78
- - 0
79
- version: "0"
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
80
58
  requirements: []
81
-
82
59
  rubyforge_project:
83
- rubygems_version: 1.6.2
60
+ rubygems_version: 2.5.1
84
61
  signing_key:
85
- specification_version: 3
86
- summary: Assert that checks that two values (strings, expected and actual) are same and which can magically replace expected value with the actual in case the new behavior (and new actual value) is correct
87
- test_files:
62
+ specification_version: 4
63
+ summary: Assert that checks that two values (strings, expected and actual) are same
64
+ and which can magically replace expected value with the actual in case the new behavior
65
+ (and new actual value) is correct
66
+ test_files:
88
67
  - test/assert_value_spec.rb
89
68
  - test/assert_value_test.rb
90
69
  - test/logs/assert_value_exception_with_files.log.ref
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- group :development, :test do
4
- gem 'rake'
5
- gem 'minitest', '4.7.5'
6
- gem 'test-unit-minitest'
7
- end
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- group :development, :test do
4
- gem 'rake'
5
- gem 'rspec'
6
- end