wrong 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +12 -3
- data/lib/wrong.rb +17 -7
- data/lib/wrong/capturing.rb +56 -0
- data/lib/wrong/chunk.rb +20 -8
- data/lib/wrong/failure_message.rb +9 -9
- data/lib/wrong/helpers.rb +11 -63
- data/lib/wrong/rescuing.rb +15 -0
- data/lib/wrong/version.rb +1 -1
- data/test/adapters/rspec_test.rb +6 -5
- data/test/sexp_ext_test.rb +17 -4
- data/test/test_helper.rb +1 -1
- metadata +18 -52
- data/test/adapters/railsapp/app/controllers/application_controller.rb +0 -3
- data/test/adapters/railsapp/app/helpers/application_helper.rb +0 -2
- data/test/adapters/railsapp/autotest/discover.rb +0 -2
- data/test/adapters/railsapp/config/application.rb +0 -42
- data/test/adapters/railsapp/config/boot.rb +0 -13
- data/test/adapters/railsapp/config/environment.rb +0 -5
- data/test/adapters/railsapp/config/environments/development.rb +0 -26
- data/test/adapters/railsapp/config/environments/production.rb +0 -49
- data/test/adapters/railsapp/config/environments/test.rb +0 -35
- data/test/adapters/railsapp/config/initializers/backtrace_silencers.rb +0 -7
- data/test/adapters/railsapp/config/initializers/inflections.rb +0 -10
- data/test/adapters/railsapp/config/initializers/mime_types.rb +0 -5
- data/test/adapters/railsapp/config/initializers/secret_token.rb +0 -7
- data/test/adapters/railsapp/config/initializers/session_store.rb +0 -8
- data/test/adapters/railsapp/config/routes.rb +0 -58
- data/test/adapters/railsapp/db/seeds.rb +0 -7
- data/test/adapters/railsapp/spec/spec_helper.rb +0 -28
- data/test/adapters/railsapp/spec/wrong_spec.rb +0 -8
data/README.markdown
CHANGED
@@ -67,6 +67,8 @@ And don't miss the [slideshare presentation](http://www.slideshare.net/alexchaff
|
|
67
67
|
|
68
68
|
## Helper methods
|
69
69
|
|
70
|
+
All these helper methods are provided if you do `include Wrong`.
|
71
|
+
|
70
72
|
### rescuing
|
71
73
|
|
72
74
|
There's also a convenience method for catching errors:
|
@@ -248,7 +250,6 @@ Wrong is compatible with RSpec and MiniTest::Spec, and probably Cucumber too, so
|
|
248
250
|
|
249
251
|
Here's an RSpec example:
|
250
252
|
|
251
|
-
require "wrong"
|
252
253
|
require "wrong/adapters/rspec"
|
253
254
|
Wrong.config.alias_assert :expect_that
|
254
255
|
|
@@ -276,7 +277,7 @@ So wait a second. How do we do it? Doesn't Ruby have [poor support for AST intro
|
|
276
277
|
|
277
278
|
Before you get your knickers in a twist about how this is totally unacceptable because it doesn't support this or that use case, here are our caveats and excuses:
|
278
279
|
|
279
|
-
* It works! Tested in MRI 1.8.6, 1.8.7, 1.9.1, 1.9.2, and JRuby 1.5.3. (Thank you, [rvm](http://rvm.
|
280
|
+
* It works! Tested in MRI 1.8.6, 1.8.7, 1.9.1, 1.9.2, 1.9.3, and JRuby 1.5.3. (Thank you, [rvm](http://rvm.io/)!)
|
280
281
|
* Your code needs to be in a file.
|
281
282
|
* If you're developing Ruby code without saving it to a mounted disk, then sorry, Wrong is not right for you.
|
282
283
|
* We monkey-patch IRB so if you do `irb -rwrong` it'll save off your session in memory where Wrong can read it.
|
@@ -440,7 +441,7 @@ Wrong works inside frameworks like Test::Unit and RSpec, but sometimes you just
|
|
440
441
|
|
441
442
|
Wrong.config.verbose
|
442
443
|
assert("basic math") { 2 + 2 == 4}
|
443
|
-
|
444
|
+
|
444
445
|
prints
|
445
446
|
|
446
447
|
basic math: ((2 + 2) == 4)
|
@@ -459,6 +460,14 @@ If you're in Ruby 1.8, you **really** shouldn't do it! But if you do, you can us
|
|
459
460
|
* John Firebaugh
|
460
461
|
* Thierry Henrio
|
461
462
|
|
463
|
+
## Bugs ##
|
464
|
+
|
465
|
+
* assert doesn't work (can't find the source code) from inside a "Dir.chdir" block
|
466
|
+
|
467
|
+
## todo ##
|
468
|
+
|
469
|
+
* Use RubyParser 3.0 <http://www.ruby-forum.com/topic/4403549>
|
470
|
+
|
462
471
|
## Etc ##
|
463
472
|
|
464
473
|
* Mailing list: <http://groups.google.com/group/wrong-rb>
|
data/lib/wrong.rb
CHANGED
@@ -14,26 +14,36 @@ require "wrong/message/array_diff"
|
|
14
14
|
require "wrong/message/string_comparison"
|
15
15
|
require "wrong/eventually"
|
16
16
|
|
17
|
+
# After doing "require 'wrong'",
|
18
|
+
# if you `include Wrong` you will get all of Wrong's asserts and helpers,
|
19
|
+
# available from both instance and class methods of the object you included it in.
|
20
|
+
#
|
21
|
+
# If you only want some of them, then don't "require 'wrong'", and instead
|
22
|
+
# `require` and `include` just what you want separately.
|
23
|
+
#
|
24
|
+
# For example, if you only want `eventually`, then do
|
25
|
+
# require "wrong/eventually"
|
26
|
+
# include Wrong::Eventually
|
27
|
+
#
|
17
28
|
module Wrong
|
18
29
|
include Wrong::Assert
|
19
30
|
extend Wrong::Assert
|
20
31
|
include Wrong::Helpers
|
21
32
|
extend Wrong::Helpers
|
22
|
-
include Wrong::Eventually
|
23
|
-
extend Wrong::Eventually
|
24
33
|
end
|
25
34
|
|
26
|
-
#
|
27
|
-
|
28
|
-
#
|
35
|
+
# This `require "wrong/close_to"` adds close_to? to Numeric.
|
36
|
+
# If you don't like that, then
|
37
|
+
# `require 'wrong/assert'` et al. individually and don't `require 'wrong/close_to'` or `require 'wrong'`
|
29
38
|
require "wrong/close_to"
|
30
39
|
|
31
|
-
#
|
40
|
+
# This makes the `d` method available everywhere.
|
41
|
+
# If you don't like that, then
|
42
|
+
# don't `require 'wrong'`, and `include Wrong::D` only in the modules you want to call `d` from
|
32
43
|
class Object # should we add this to Kernel instead?
|
33
44
|
include Wrong::D
|
34
45
|
end
|
35
46
|
|
36
|
-
# ...don't `require 'wrong'`
|
37
47
|
# this part isn't working yet -- it's supposed to make 'assert' available at the top level but it breaks the minitest adapter
|
38
48
|
# include Wrong
|
39
49
|
# class Object
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Wrong
|
2
|
+
module Capturing
|
3
|
+
|
4
|
+
# Usage:
|
5
|
+
# capturing { puts "hi" } => "hi\n"
|
6
|
+
# capturing(:stderr) { $stderr.puts "hi" } => "hi\n"
|
7
|
+
# out, err = capturing(:stdout, :stderr) { ... }
|
8
|
+
#
|
9
|
+
# see http://www.justskins.com/forums/closing-stderr-105096.html for more explanation
|
10
|
+
def capturing(*streams)
|
11
|
+
streams = [:stdout] if streams.empty?
|
12
|
+
original = {}
|
13
|
+
captured = {}
|
14
|
+
|
15
|
+
# reassign the $ variable (which is used by well-behaved code e.g. puts)
|
16
|
+
streams.each do |stream|
|
17
|
+
original[stream] = (stream == :stdout ? $stdout : $stderr)
|
18
|
+
captured[stream] = StringIO.new
|
19
|
+
reassign_stream(stream, captured)
|
20
|
+
end
|
21
|
+
|
22
|
+
yield
|
23
|
+
|
24
|
+
# return either one string, or an array of two strings
|
25
|
+
if streams.size == 1
|
26
|
+
captured[streams.first].string
|
27
|
+
else
|
28
|
+
[captured[streams[0]].string, captured[streams[1]].string]
|
29
|
+
end
|
30
|
+
|
31
|
+
ensure
|
32
|
+
|
33
|
+
streams.each do |stream|
|
34
|
+
# bail if stream was reassigned inside the block
|
35
|
+
if (stream == :stdout ? $stdout : $stderr) != captured[stream]
|
36
|
+
raise "#{stream} was reassigned while being captured"
|
37
|
+
end
|
38
|
+
# support nested calls to capturing
|
39
|
+
original[stream] << captured[stream].string if original[stream].is_a? StringIO
|
40
|
+
reassign_stream(stream, original)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
def reassign_stream(which, streams)
|
46
|
+
case which
|
47
|
+
when :stdout
|
48
|
+
$stdout = streams[which]
|
49
|
+
when :stderr
|
50
|
+
$stderr = streams[which]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
data/lib/wrong/chunk.rb
CHANGED
@@ -16,6 +16,7 @@ require_optionally "sourcify"
|
|
16
16
|
|
17
17
|
require "wrong/config"
|
18
18
|
require "wrong/sexp_ext"
|
19
|
+
require "wrong/capturing"
|
19
20
|
|
20
21
|
module Wrong
|
21
22
|
class Chunk
|
@@ -35,6 +36,8 @@ module Wrong
|
|
35
36
|
new(file, line, &block)
|
36
37
|
end
|
37
38
|
|
39
|
+
include Capturing
|
40
|
+
|
38
41
|
attr_reader :file, :line_number, :block
|
39
42
|
|
40
43
|
# line parameter is 1-based
|
@@ -92,7 +95,10 @@ module Wrong
|
|
92
95
|
while sexp.nil? && line_index + c < lines.size
|
93
96
|
begin
|
94
97
|
@chunk = lines[line_index..line_index+c].join("\n")
|
95
|
-
|
98
|
+
|
99
|
+
capturing(:stderr) do # new RubyParser is too loud
|
100
|
+
sexp = @parser.parse(@chunk)
|
101
|
+
end
|
96
102
|
rescue Racc::ParseError => e
|
97
103
|
# loop and try again
|
98
104
|
c += 1
|
@@ -161,7 +167,7 @@ module Wrong
|
|
161
167
|
def details
|
162
168
|
@details ||= build_details
|
163
169
|
end
|
164
|
-
|
170
|
+
|
165
171
|
def pretty_value(value, starting_col = 0, indent_wrapped_lines = 6, width = Chunk.terminal_width)
|
166
172
|
# inspected = value.inspect
|
167
173
|
|
@@ -175,7 +181,7 @@ module Wrong
|
|
175
181
|
else
|
176
182
|
indented
|
177
183
|
end
|
178
|
-
end
|
184
|
+
end
|
179
185
|
|
180
186
|
private
|
181
187
|
|
@@ -241,7 +247,7 @@ public # don't know exactly why this needs to be public but eval'ed code can't f
|
|
241
247
|
def indent_all(amount, s)
|
242
248
|
s.gsub("\n", "\n#{indent(amount)}")
|
243
249
|
end
|
244
|
-
|
250
|
+
|
245
251
|
def wrap_and_indent(indented, starting_col, indent_wrapped_lines, full_width)
|
246
252
|
first_line = true
|
247
253
|
width = full_width - starting_col # the first line is essentially shorter
|
@@ -264,6 +270,12 @@ public # don't know exactly why this needs to be public but eval'ed code can't f
|
|
264
270
|
# Returns [width, height] of terminal when detected, nil if not detected.
|
265
271
|
# Think of this as a simpler version of Highline's Highline::SystemExtensions.terminal_size()
|
266
272
|
# Lifted from https://github.com/cldwalker/hirb/blob/master/lib/hirb/util.rb#L59
|
273
|
+
#
|
274
|
+
# See also http://stackoverflow.com/questions/2068859/how-to-get-the-width-of-terminal-window-in-ruby
|
275
|
+
# https://github.com/genki/ruby-terminfo/blob/master/lib/terminfo.rb
|
276
|
+
# http://www.mkssoftware.com/docs/man1/stty.1.asp
|
277
|
+
|
278
|
+
|
267
279
|
def self.terminal_size
|
268
280
|
@@terminal_size ||= begin
|
269
281
|
if (ENV['COLUMNS'] =~ /^\d+$/) && (ENV['LINES'] =~ /^\d+$/)
|
@@ -277,9 +289,9 @@ public # don't know exactly why this needs to be public but eval'ed code can't f
|
|
277
289
|
end
|
278
290
|
rescue
|
279
291
|
nil
|
280
|
-
end
|
292
|
+
end
|
281
293
|
end
|
282
|
-
|
294
|
+
|
283
295
|
def self.terminal_width
|
284
296
|
(@terminal_width ||= nil) || (terminal_size && terminal_size.first) || 80
|
285
297
|
end
|
@@ -287,12 +299,12 @@ public # don't know exactly why this needs to be public but eval'ed code can't f
|
|
287
299
|
def self.terminal_width= forced_with
|
288
300
|
@terminal_width = forced_with
|
289
301
|
end
|
290
|
-
|
302
|
+
|
291
303
|
# Determines if a shell command exists by searching for it in ENV['PATH'].
|
292
304
|
def self.command_exists?(command)
|
293
305
|
ENV['PATH'].split(File::PATH_SEPARATOR).any? {|d| File.exists? File.join(d, command) }
|
294
306
|
end
|
295
|
-
|
307
|
+
|
296
308
|
|
297
309
|
end
|
298
310
|
|
@@ -39,8 +39,8 @@ module Wrong
|
|
39
39
|
false
|
40
40
|
end
|
41
41
|
end
|
42
|
-
|
43
|
-
|
42
|
+
|
43
|
+
|
44
44
|
attr_accessor :chunk, :valence, :explanation
|
45
45
|
|
46
46
|
def initialize(chunk, valence, explanation)
|
@@ -50,32 +50,32 @@ module Wrong
|
|
50
50
|
def basic
|
51
51
|
"#{valence == :deny ? "Didn't expect" : "Expected"} #{colored(:blue, chunk.code)}"
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
def full
|
55
55
|
message = ""
|
56
56
|
message << "#{explanation}: " if explanation
|
57
57
|
message << basic
|
58
|
-
|
58
|
+
|
59
59
|
formatted_message = if predicate && !(predicate.is_a? Predicated::Conjunction)
|
60
60
|
if formatter = FailureMessage.formatter_for(predicate)
|
61
61
|
colored(:bold, formatter.describe)
|
62
62
|
end
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
unless chunk.details.empty? and formatted_message.nil?
|
66
66
|
message << ", but"
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
69
|
message << formatted_message if formatted_message
|
70
70
|
message << chunk.details unless chunk.details.empty?
|
71
71
|
message
|
72
72
|
end
|
73
73
|
|
74
|
-
protected
|
74
|
+
protected
|
75
75
|
def code
|
76
76
|
@code ||= chunk.code
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
def predicate
|
80
80
|
@predicate ||= begin
|
81
81
|
Predicated::Predicate.from_ruby_code_string(code, chunk.block.binding)
|
@@ -85,7 +85,7 @@ module Wrong
|
|
85
85
|
nil
|
86
86
|
end
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
def colored(color, text)
|
90
90
|
if Wrong.config[:color]
|
91
91
|
if color == :bold
|
data/lib/wrong/helpers.rb
CHANGED
@@ -1,67 +1,15 @@
|
|
1
|
+
require "wrong/capturing"
|
2
|
+
require "wrong/rescuing"
|
3
|
+
require "wrong/d"
|
4
|
+
require "wrong/eventually"
|
5
|
+
require "wrong/close_to"
|
6
|
+
|
1
7
|
module Wrong
|
2
8
|
module Helpers
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
yield
|
9
|
-
rescue Exception, RuntimeError => e
|
10
|
-
error = e
|
11
|
-
end
|
12
|
-
error
|
13
|
-
end
|
14
|
-
|
15
|
-
# Usage:
|
16
|
-
# capturing { puts "hi" } => "hi\n"
|
17
|
-
# capturing(:stderr) { $stderr.puts "hi" } => "hi\n"
|
18
|
-
# out, err = capturing(:stdout, :stderr) { ... }
|
19
|
-
#
|
20
|
-
# see http://www.justskins.com/forums/closing-stderr-105096.html for more explanation
|
21
|
-
def capturing(*streams)
|
22
|
-
streams = [:stdout] if streams.empty?
|
23
|
-
original = {}
|
24
|
-
captured = {}
|
25
|
-
|
26
|
-
# reassign the $ variable (which is used by well-behaved code e.g. puts)
|
27
|
-
streams.each do |stream|
|
28
|
-
original[stream] = (stream == :stdout ? $stdout : $stderr)
|
29
|
-
captured[stream] = StringIO.new
|
30
|
-
reassign_stream(stream, captured)
|
31
|
-
end
|
32
|
-
|
33
|
-
yield
|
34
|
-
|
35
|
-
# return either one string, or an array of two strings
|
36
|
-
if streams.size == 1
|
37
|
-
captured[streams.first].string
|
38
|
-
else
|
39
|
-
[captured[streams[0]].string, captured[streams[1]].string]
|
40
|
-
end
|
41
|
-
|
42
|
-
ensure
|
43
|
-
|
44
|
-
streams.each do |stream|
|
45
|
-
# bail if stream was reassigned inside the block
|
46
|
-
if (stream == :stdout ? $stdout : $stderr) != captured[stream]
|
47
|
-
raise "#{stream} was reassigned while being captured"
|
48
|
-
end
|
49
|
-
# support nested calls to capturing
|
50
|
-
original[stream] << captured[stream].string if original[stream].is_a? StringIO
|
51
|
-
reassign_stream(stream, original)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
private
|
56
|
-
def reassign_stream(which, streams)
|
57
|
-
case which
|
58
|
-
when :stdout
|
59
|
-
$stdout = streams[which]
|
60
|
-
when :stderr
|
61
|
-
$stderr = streams[which]
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
9
|
+
include Rescuing
|
10
|
+
include Capturing
|
11
|
+
include Eventually
|
12
|
+
include CloseTo
|
13
|
+
include D
|
65
14
|
end
|
66
|
-
|
67
15
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Wrong
|
2
|
+
module Rescuing
|
3
|
+
|
4
|
+
# Executes a block that is expected to raise an exception. Returns that exception, or nil if none was raised.
|
5
|
+
def rescuing
|
6
|
+
error = nil
|
7
|
+
begin
|
8
|
+
yield
|
9
|
+
rescue Exception, RuntimeError => e
|
10
|
+
error = e
|
11
|
+
end
|
12
|
+
error
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/wrong/version.rb
CHANGED
data/test/adapters/rspec_test.rb
CHANGED
@@ -20,7 +20,7 @@ describe "testing rspec" do
|
|
20
20
|
clear_bundler_env
|
21
21
|
FileUtils.rm "#{dir}/Gemfile.lock", :force => true
|
22
22
|
|
23
|
-
sys "bundle check" do |output|
|
23
|
+
sys "bundle check", nil do |output|
|
24
24
|
unless output == "The Gemfile's dependencies are satisfied\n"
|
25
25
|
sys "bundle install --gemfile=#{dir}/Gemfile --local"
|
26
26
|
end
|
@@ -32,12 +32,13 @@ describe "testing rspec" do
|
|
32
32
|
assert { line =~ /rspec[-\w]* \(#{rspec_version}\.[\w.]*\)/ }
|
33
33
|
end
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
Bundler.with_clean_env do
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
# RSpec v1 exits with 0 on failure :-( (as do older rubies)
|
38
|
+
expected_status = (rspec_version == 1 || RUBY_VERSION =~ /^1\.8\./ || RUBY_VERSION == '1.9.1' ? nil : 1)
|
39
|
+
spec_output = sys "ruby #{dir}/failing_spec.rb", expected_status
|
40
40
|
end
|
41
|
+
end
|
41
42
|
|
42
43
|
assert { spec_output.include? "1 failure" }
|
43
44
|
assert { spec_output.include? "Expected ((2 + 2) == 5), but" }
|
data/test/sexp_ext_test.rb
CHANGED
@@ -3,13 +3,26 @@ require "wrong/sexp_ext"
|
|
3
3
|
|
4
4
|
describe Sexp do
|
5
5
|
describe "#deep_clone" do
|
6
|
+
|
7
|
+
def deeply_compare x, y
|
8
|
+
assert (x == y)
|
9
|
+
case x
|
10
|
+
when Symbol, Numeric, NilClass
|
11
|
+
# these are OK
|
12
|
+
else
|
13
|
+
assert (x.object_id != y.object_id)
|
14
|
+
end
|
15
|
+
if x.is_a? Sexp
|
16
|
+
x.each_with_index do |val, i|
|
17
|
+
deeply_compare(x[i], y[i])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
6
22
|
it "deeply duplicates the sexp" do
|
7
23
|
original = RubyParser.new.parse("x == 5")
|
8
24
|
duplicate = original.deep_clone
|
9
|
-
|
10
|
-
assert(original[1].object_id != duplicate[1].object_id)
|
11
|
-
assert(original[1][3].object_id != duplicate[1][3].object_id)
|
12
|
-
assert(original[3].object_id != duplicate[3].object_id)
|
25
|
+
deeply_compare original, duplicate
|
13
26
|
end
|
14
27
|
end
|
15
28
|
|
data/test/test_helper.rb
CHANGED
@@ -38,7 +38,7 @@ def sys(cmd, expected_status = 0)
|
|
38
38
|
exit_status = (wait_thread.value.exitstatus if wait_thread) || 0
|
39
39
|
output = stdout.read + stderr.read
|
40
40
|
unless expected_status.nil?
|
41
|
-
assert { output and exit_status == expected_status }
|
41
|
+
assert(cmd) { output and exit_status == expected_status }
|
42
42
|
end
|
43
43
|
yield output if block_given?
|
44
44
|
output
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wrong
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-11-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: predicated
|
@@ -33,49 +33,49 @@ dependencies:
|
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
none: false
|
35
35
|
requirements:
|
36
|
-
- -
|
36
|
+
- - ! '>='
|
37
37
|
- !ruby/object:Gem::Version
|
38
|
-
version:
|
38
|
+
version: 3.0.1
|
39
39
|
type: :runtime
|
40
40
|
prerelease: false
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - ! '>='
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 3.0.1
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: ruby2ruby
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.0.1
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
none: false
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ! '>='
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
62
|
+
version: 2.0.1
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
64
|
name: sexp_processor
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
66
66
|
none: false
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - ! '>='
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: '
|
70
|
+
version: '4.0'
|
71
71
|
type: :runtime
|
72
72
|
prerelease: false
|
73
73
|
version_requirements: !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
|
-
- -
|
76
|
+
- - ! '>='
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version: '
|
78
|
+
version: '4.0'
|
79
79
|
- !ruby/object:Gem::Dependency
|
80
80
|
name: diff-lcs
|
81
81
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- lib/wrong/adapters/rspec.rb
|
166
166
|
- lib/wrong/adapters/test_unit.rb
|
167
167
|
- lib/wrong/assert.rb
|
168
|
+
- lib/wrong/capturing.rb
|
168
169
|
- lib/wrong/chunk.rb
|
169
170
|
- lib/wrong/close_to.rb
|
170
171
|
- lib/wrong/config.rb
|
@@ -177,30 +178,13 @@ files:
|
|
177
178
|
- lib/wrong/message/string_comparison.rb
|
178
179
|
- lib/wrong/message/test_context.rb
|
179
180
|
- lib/wrong/rainbow.rb
|
181
|
+
- lib/wrong/rescuing.rb
|
180
182
|
- lib/wrong/ruby2ruby_patch.rb
|
181
183
|
- lib/wrong/sexp_ext.rb
|
182
184
|
- lib/wrong/version.rb
|
183
185
|
- lib/wrong.rb
|
184
186
|
- README.markdown
|
185
187
|
- test/adapters/minitest_test.rb
|
186
|
-
- test/adapters/railsapp/app/controllers/application_controller.rb
|
187
|
-
- test/adapters/railsapp/app/helpers/application_helper.rb
|
188
|
-
- test/adapters/railsapp/autotest/discover.rb
|
189
|
-
- test/adapters/railsapp/config/application.rb
|
190
|
-
- test/adapters/railsapp/config/boot.rb
|
191
|
-
- test/adapters/railsapp/config/environment.rb
|
192
|
-
- test/adapters/railsapp/config/environments/development.rb
|
193
|
-
- test/adapters/railsapp/config/environments/production.rb
|
194
|
-
- test/adapters/railsapp/config/environments/test.rb
|
195
|
-
- test/adapters/railsapp/config/initializers/backtrace_silencers.rb
|
196
|
-
- test/adapters/railsapp/config/initializers/inflections.rb
|
197
|
-
- test/adapters/railsapp/config/initializers/mime_types.rb
|
198
|
-
- test/adapters/railsapp/config/initializers/secret_token.rb
|
199
|
-
- test/adapters/railsapp/config/initializers/session_store.rb
|
200
|
-
- test/adapters/railsapp/config/routes.rb
|
201
|
-
- test/adapters/railsapp/db/seeds.rb
|
202
|
-
- test/adapters/railsapp/spec/spec_helper.rb
|
203
|
-
- test/adapters/railsapp/spec/wrong_spec.rb
|
204
188
|
- test/adapters/rspec1/failing_spec.rb
|
205
189
|
- test/adapters/rspec2/failing_spec.rb
|
206
190
|
- test/adapters/rspec_rails_test.rb
|
@@ -240,7 +224,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
240
224
|
version: '0'
|
241
225
|
segments:
|
242
226
|
- 0
|
243
|
-
hash:
|
227
|
+
hash: 2518606047608978167
|
244
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
245
229
|
none: false
|
246
230
|
requirements:
|
@@ -249,31 +233,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
249
233
|
version: '0'
|
250
234
|
requirements: []
|
251
235
|
rubyforge_project: wrong
|
252
|
-
rubygems_version: 1.8.
|
236
|
+
rubygems_version: 1.8.24
|
253
237
|
signing_key:
|
254
238
|
specification_version: 3
|
255
239
|
summary: Wrong provides a general assert method that takes a predicate block. Assertion
|
256
240
|
failure messages are rich in detail.
|
257
241
|
test_files:
|
258
242
|
- test/adapters/minitest_test.rb
|
259
|
-
- test/adapters/railsapp/app/controllers/application_controller.rb
|
260
|
-
- test/adapters/railsapp/app/helpers/application_helper.rb
|
261
|
-
- test/adapters/railsapp/autotest/discover.rb
|
262
|
-
- test/adapters/railsapp/config/application.rb
|
263
|
-
- test/adapters/railsapp/config/boot.rb
|
264
|
-
- test/adapters/railsapp/config/environment.rb
|
265
|
-
- test/adapters/railsapp/config/environments/development.rb
|
266
|
-
- test/adapters/railsapp/config/environments/production.rb
|
267
|
-
- test/adapters/railsapp/config/environments/test.rb
|
268
|
-
- test/adapters/railsapp/config/initializers/backtrace_silencers.rb
|
269
|
-
- test/adapters/railsapp/config/initializers/inflections.rb
|
270
|
-
- test/adapters/railsapp/config/initializers/mime_types.rb
|
271
|
-
- test/adapters/railsapp/config/initializers/secret_token.rb
|
272
|
-
- test/adapters/railsapp/config/initializers/session_store.rb
|
273
|
-
- test/adapters/railsapp/config/routes.rb
|
274
|
-
- test/adapters/railsapp/db/seeds.rb
|
275
|
-
- test/adapters/railsapp/spec/spec_helper.rb
|
276
|
-
- test/adapters/railsapp/spec/wrong_spec.rb
|
277
243
|
- test/adapters/rspec1/failing_spec.rb
|
278
244
|
- test/adapters/rspec2/failing_spec.rb
|
279
245
|
- test/adapters/rspec_rails_test.rb
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
require 'rails/all'
|
4
|
-
|
5
|
-
# If you have a Gemfile, require the gems listed there, including any gems
|
6
|
-
# you've limited to :test, :development, or :production.
|
7
|
-
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
8
|
-
|
9
|
-
module Railsapp
|
10
|
-
class Application < Rails::Application
|
11
|
-
# Settings in config/environments/* take precedence over those specified here.
|
12
|
-
# Application configuration should go into files in config/initializers
|
13
|
-
# -- all .rb files in that directory are automatically loaded.
|
14
|
-
|
15
|
-
# Custom directories with classes and modules you want to be autoloadable.
|
16
|
-
# config.autoload_paths += %W(#{config.root}/extras)
|
17
|
-
|
18
|
-
# Only load the plugins named here, in the order given (default is alphabetical).
|
19
|
-
# :all can be used as a placeholder for all plugins not explicitly named.
|
20
|
-
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
21
|
-
|
22
|
-
# Activate observers that should always be running.
|
23
|
-
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
24
|
-
|
25
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
26
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
27
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
28
|
-
|
29
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
30
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
31
|
-
# config.i18n.default_locale = :de
|
32
|
-
|
33
|
-
# JavaScript files you want as :defaults (application.js is always included).
|
34
|
-
config.action_view.javascript_expansions[:defaults] = %w()
|
35
|
-
|
36
|
-
# Configure the default encoding used in templates for Ruby 1.9.
|
37
|
-
config.encoding = "utf-8"
|
38
|
-
|
39
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
40
|
-
config.filter_parameters += [:password]
|
41
|
-
end
|
42
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
|
3
|
-
# Set up gems listed in the Gemfile.
|
4
|
-
gemfile = File.expand_path('../../Gemfile', __FILE__)
|
5
|
-
begin
|
6
|
-
ENV['BUNDLE_GEMFILE'] = gemfile
|
7
|
-
require 'bundler'
|
8
|
-
Bundler.setup
|
9
|
-
rescue Bundler::GemNotFound => e
|
10
|
-
STDERR.puts e.message
|
11
|
-
STDERR.puts "Try running `bundle install`."
|
12
|
-
exit!
|
13
|
-
end if File.exist?(gemfile)
|
@@ -1,26 +0,0 @@
|
|
1
|
-
Railsapp::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
-
|
4
|
-
# In the development environment your application's code is reloaded on
|
5
|
-
# every request. This slows down response time but is perfect for development
|
6
|
-
# since you don't have to restart the webserver when you make code changes.
|
7
|
-
config.cache_classes = false
|
8
|
-
|
9
|
-
# Log error messages when you accidentally call methods on nil.
|
10
|
-
config.whiny_nils = true
|
11
|
-
|
12
|
-
# Show full error reports and disable caching
|
13
|
-
config.consider_all_requests_local = true
|
14
|
-
config.action_view.debug_rjs = true
|
15
|
-
config.action_controller.perform_caching = false
|
16
|
-
|
17
|
-
# Don't care if the mailer can't send
|
18
|
-
config.action_mailer.raise_delivery_errors = false
|
19
|
-
|
20
|
-
# Print deprecation notices to the Rails logger
|
21
|
-
config.active_support.deprecation = :log
|
22
|
-
|
23
|
-
# Only use best-standards-support built into browsers
|
24
|
-
config.action_dispatch.best_standards_support = :builtin
|
25
|
-
end
|
26
|
-
|
@@ -1,49 +0,0 @@
|
|
1
|
-
Railsapp::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
-
|
4
|
-
# The production environment is meant for finished, "live" apps.
|
5
|
-
# Code is not reloaded between requests
|
6
|
-
config.cache_classes = true
|
7
|
-
|
8
|
-
# Full error reports are disabled and caching is turned on
|
9
|
-
config.consider_all_requests_local = false
|
10
|
-
config.action_controller.perform_caching = true
|
11
|
-
|
12
|
-
# Specifies the header that your server uses for sending files
|
13
|
-
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
14
|
-
|
15
|
-
# For nginx:
|
16
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
17
|
-
|
18
|
-
# If you have no front-end server that supports something like X-Sendfile,
|
19
|
-
# just comment this out and Rails will serve the files
|
20
|
-
|
21
|
-
# See everything in the log (default is :info)
|
22
|
-
# config.log_level = :debug
|
23
|
-
|
24
|
-
# Use a different logger for distributed setups
|
25
|
-
# config.logger = SyslogLogger.new
|
26
|
-
|
27
|
-
# Use a different cache store in production
|
28
|
-
# config.cache_store = :mem_cache_store
|
29
|
-
|
30
|
-
# Disable Rails's static asset server
|
31
|
-
# In production, Apache or nginx will already do this
|
32
|
-
config.serve_static_assets = false
|
33
|
-
|
34
|
-
# Enable serving of images, stylesheets, and javascripts from an asset server
|
35
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
36
|
-
|
37
|
-
# Disable delivery errors, bad email addresses will be ignored
|
38
|
-
# config.action_mailer.raise_delivery_errors = false
|
39
|
-
|
40
|
-
# Enable threaded mode
|
41
|
-
# config.threadsafe!
|
42
|
-
|
43
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
44
|
-
# the I18n.default_locale when a translation can not be found)
|
45
|
-
config.i18n.fallbacks = true
|
46
|
-
|
47
|
-
# Send deprecation notices to registered listeners
|
48
|
-
config.active_support.deprecation = :notify
|
49
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
Railsapp::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
-
|
4
|
-
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite. You never need to work with it otherwise. Remember that
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
8
|
-
config.cache_classes = true
|
9
|
-
|
10
|
-
# Log error messages when you accidentally call methods on nil.
|
11
|
-
config.whiny_nils = true
|
12
|
-
|
13
|
-
# Show full error reports and disable caching
|
14
|
-
config.consider_all_requests_local = true
|
15
|
-
config.action_controller.perform_caching = false
|
16
|
-
|
17
|
-
# Raise exceptions instead of rendering exception templates
|
18
|
-
config.action_dispatch.show_exceptions = false
|
19
|
-
|
20
|
-
# Disable request forgery protection in test environment
|
21
|
-
config.action_controller.allow_forgery_protection = false
|
22
|
-
|
23
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
24
|
-
# The :test delivery method accumulates sent emails in the
|
25
|
-
# ActionMailer::Base.deliveries array.
|
26
|
-
config.action_mailer.delivery_method = :test
|
27
|
-
|
28
|
-
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
29
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
30
|
-
# like if you have constraints or database-specific column types
|
31
|
-
# config.active_record.schema_format = :sql
|
32
|
-
|
33
|
-
# Print deprecation notices to the stderr
|
34
|
-
config.active_support.deprecation = :stderr
|
35
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
-
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
-
|
6
|
-
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
-
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Add new inflection rules using the following format
|
4
|
-
# (all these examples are active by default):
|
5
|
-
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
-
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
-
# inflect.singular /^(ox)en/i, '\1'
|
8
|
-
# inflect.irregular 'person', 'people'
|
9
|
-
# inflect.uncountable %w( fish sheep )
|
10
|
-
# end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
# Make sure the secret is at least 30 characters and all random,
|
6
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
-
Railsapp::Application.config.secret_token = '60ef44ef55c7289c9013546cef8ef9aa67efd47177d7b4dbd85535f25de545a448e97eb62b9ce64df8aad9ec765d6c08d3725b738b9cbb503b978a61d765224b'
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
Railsapp::Application.config.session_store :cookie_store, :key => '_railsapp_session'
|
4
|
-
|
5
|
-
# Use the database for sessions instead of the cookie-based default,
|
6
|
-
# which shouldn't be used to store highly confidential information
|
7
|
-
# (create the session table with "rake db:sessions:create")
|
8
|
-
# Railsapp::Application.config.session_store :active_record_store
|
@@ -1,58 +0,0 @@
|
|
1
|
-
Railsapp::Application.routes.draw do
|
2
|
-
# The priority is based upon order of creation:
|
3
|
-
# first created -> highest priority.
|
4
|
-
|
5
|
-
# Sample of regular route:
|
6
|
-
# match 'products/:id' => 'catalog#view'
|
7
|
-
# Keep in mind you can assign values other than :controller and :action
|
8
|
-
|
9
|
-
# Sample of named route:
|
10
|
-
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
11
|
-
# This route can be invoked with purchase_url(:id => product.id)
|
12
|
-
|
13
|
-
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
14
|
-
# resources :products
|
15
|
-
|
16
|
-
# Sample resource route with options:
|
17
|
-
# resources :products do
|
18
|
-
# member do
|
19
|
-
# get 'short'
|
20
|
-
# post 'toggle'
|
21
|
-
# end
|
22
|
-
#
|
23
|
-
# collection do
|
24
|
-
# get 'sold'
|
25
|
-
# end
|
26
|
-
# end
|
27
|
-
|
28
|
-
# Sample resource route with sub-resources:
|
29
|
-
# resources :products do
|
30
|
-
# resources :comments, :sales
|
31
|
-
# resource :seller
|
32
|
-
# end
|
33
|
-
|
34
|
-
# Sample resource route with more complex sub-resources
|
35
|
-
# resources :products do
|
36
|
-
# resources :comments
|
37
|
-
# resources :sales do
|
38
|
-
# get 'recent', :on => :collection
|
39
|
-
# end
|
40
|
-
# end
|
41
|
-
|
42
|
-
# Sample resource route within a namespace:
|
43
|
-
# namespace :admin do
|
44
|
-
# # Directs /admin/products/* to Admin::ProductsController
|
45
|
-
# # (app/controllers/admin/products_controller.rb)
|
46
|
-
# resources :products
|
47
|
-
# end
|
48
|
-
|
49
|
-
# You can have the root of your site routed with "root"
|
50
|
-
# just remember to delete public/index.html.
|
51
|
-
# root :to => "welcome#index"
|
52
|
-
|
53
|
-
# See how all your routes lay out with "rake routes"
|
54
|
-
|
55
|
-
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
56
|
-
# Note: This route will make all actions in every controller accessible via GET requests.
|
57
|
-
# match ':controller(/:action(/:id(.:format)))'
|
58
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
-
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
-
#
|
4
|
-
# Examples:
|
5
|
-
#
|
6
|
-
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
7
|
-
# Mayor.create(:name => 'Daley', :city => cities.first)
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
-
ENV["RAILS_ENV"] ||= 'test'
|
3
|
-
require File.expand_path("../../config/environment", __FILE__)
|
4
|
-
require 'rspec/rails'
|
5
|
-
require "wrong/adapters/rspec"
|
6
|
-
|
7
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
8
|
-
# in spec/support/ and its subdirectories.
|
9
|
-
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
10
|
-
|
11
|
-
RSpec.configure do |config|
|
12
|
-
# == Mock Framework
|
13
|
-
#
|
14
|
-
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
15
|
-
#
|
16
|
-
# config.mock_with :mocha
|
17
|
-
# config.mock_with :flexmock
|
18
|
-
# config.mock_with :rr
|
19
|
-
config.mock_with :rspec
|
20
|
-
|
21
|
-
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
22
|
-
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
23
|
-
|
24
|
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
25
|
-
# examples within a transaction, remove the following line or assign false
|
26
|
-
# instead of true.
|
27
|
-
config.use_transactional_fixtures = true
|
28
|
-
end
|