super_diff 0.5.3 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +46 -19
- data/lib/super_diff.rb +1 -7
- data/lib/super_diff/colorized_document_extensions.rb +4 -4
- data/lib/super_diff/configuration.rb +32 -22
- data/lib/super_diff/csi.rb +2 -1
- data/lib/super_diff/diff_formatters/collection.rb +1 -1
- data/lib/super_diff/diff_formatters/multiline_string.rb +4 -4
- data/lib/super_diff/equality_matchers/array.rb +2 -2
- data/lib/super_diff/equality_matchers/default.rb +2 -2
- data/lib/super_diff/equality_matchers/hash.rb +2 -2
- data/lib/super_diff/equality_matchers/multiline_string.rb +2 -2
- data/lib/super_diff/equality_matchers/primitive.rb +2 -2
- data/lib/super_diff/equality_matchers/singleline_string.rb +2 -2
- data/lib/super_diff/gem_version.rb +45 -0
- data/lib/super_diff/rspec.rb +4 -0
- data/lib/super_diff/rspec/matcher_text_builders/base.rb +7 -7
- data/lib/super_diff/rspec/matcher_text_builders/be_predicate.rb +6 -6
- data/lib/super_diff/rspec/matcher_text_builders/contain_exactly.rb +1 -1
- data/lib/super_diff/rspec/matcher_text_builders/have_predicate.rb +4 -4
- data/lib/super_diff/rspec/matcher_text_builders/raise_error.rb +1 -1
- data/lib/super_diff/rspec/matcher_text_builders/respond_to.rb +5 -5
- data/lib/super_diff/rspec/monkey_patches.rb +22 -13
- data/lib/super_diff/rspec/operation_tree_builders/collection_containing_exactly.rb +12 -1
- data/lib/super_diff/version.rb +1 -1
- data/spec/examples.txt +393 -5
- data/spec/integration/rspec/be_falsey_matcher_spec.rb +10 -10
- data/spec/integration/rspec/be_matcher_spec.rb +100 -100
- data/spec/integration/rspec/be_nil_matcher_spec.rb +10 -10
- data/spec/integration/rspec/be_predicate_matcher_spec.rb +103 -103
- data/spec/integration/rspec/be_truthy_matcher_spec.rb +10 -10
- data/spec/integration/rspec/contain_exactly_matcher_spec.rb +107 -107
- data/spec/integration/rspec/eq_matcher_spec.rb +230 -230
- data/spec/integration/rspec/have_attributes_matcher_spec.rb +129 -129
- data/spec/integration/rspec/have_predicate_matcher_spec.rb +65 -65
- data/spec/integration/rspec/include_matcher_spec.rb +73 -73
- data/spec/integration/rspec/match_array_matcher_spec.rb +119 -119
- data/spec/integration/rspec/match_matcher_spec.rb +274 -274
- data/spec/integration/rspec/raise_error_matcher_spec.rb +86 -86
- data/spec/integration/rspec/respond_to_matcher_spec.rb +240 -240
- data/spec/integration/rspec/third_party_matcher_spec.rb +8 -8
- data/spec/integration/rspec/unhandled_errors_spec.rb +5 -5
- data/spec/spec_helper.rb +22 -13
- data/spec/support/integration/helpers.rb +6 -2
- data/spec/support/integration/matchers/produce_output_when_run_matcher.rb +1 -1
- data/spec/support/integration/test_programs/base.rb +2 -0
- data/spec/support/integration/test_programs/rspec_active_record.rb +1 -1
- data/spec/support/integration/test_programs/rspec_active_support.rb +17 -0
- data/spec/support/integration/test_programs/rspec_rails.rb +1 -1
- data/spec/support/shared_examples/active_record.rb +108 -108
- data/spec/support/shared_examples/hash_with_indifferent_access.rb +196 -232
- data/spec/tmp/integration_spec.rb +15 -0
- data/spec/unit/equality_matchers/main_spec.rb +403 -403
- data/super_diff.gemspec +1 -1
- metadata +11 -3
@@ -23,7 +23,7 @@ RSpec.describe "Integration with a third-party matcher", type: :integration do
|
|
23
23
|
red_line "Here is the next line."
|
24
24
|
plain_line " This part is indented, for whatever reason. It just kinda keeps"
|
25
25
|
plain_line " going until we finish saying whatever it is we want to say."
|
26
|
-
}
|
26
|
+
},
|
27
27
|
)
|
28
28
|
|
29
29
|
expect(program).
|
@@ -50,10 +50,10 @@ RSpec.describe "Integration with a third-party matcher", type: :integration do
|
|
50
50
|
snippet: %|expect(:anything).to fail_with_paragraphed_failure_message|,
|
51
51
|
newline_before_expectation: true,
|
52
52
|
expectation: proc {
|
53
|
-
red_line
|
53
|
+
red_line "This is a message that spans multiple paragraphs."
|
54
54
|
newline
|
55
55
|
plain_line "Here is the next paragraph."
|
56
|
-
}
|
56
|
+
},
|
57
57
|
)
|
58
58
|
|
59
59
|
expect(program).
|
@@ -81,7 +81,7 @@ RSpec.describe "Integration with a third-party matcher", type: :integration do
|
|
81
81
|
expectation: proc {
|
82
82
|
red_line "This is a message that spans multiple lines."
|
83
83
|
red_line "Here is the next line."
|
84
|
-
}
|
84
|
+
},
|
85
85
|
)
|
86
86
|
|
87
87
|
expect(program).
|
@@ -142,7 +142,7 @@ RSpec.describe "Integration with a third-party matcher", type: :integration do
|
|
142
142
|
red_line "Here is the next line."
|
143
143
|
plain_line " This part is indented, for whatever reason. It just kinda keeps"
|
144
144
|
plain_line " going until we finish saying whatever it is we want to say."
|
145
|
-
}
|
145
|
+
},
|
146
146
|
)
|
147
147
|
|
148
148
|
expect(program).
|
@@ -171,8 +171,8 @@ RSpec.describe "Integration with a third-party matcher", type: :integration do
|
|
171
171
|
expectation: proc {
|
172
172
|
red_line "This is a message that spans multiple paragraphs."
|
173
173
|
newline
|
174
|
-
plain_line
|
175
|
-
}
|
174
|
+
plain_line "Here is the next paragraph."
|
175
|
+
},
|
176
176
|
)
|
177
177
|
|
178
178
|
expect(program).
|
@@ -228,7 +228,7 @@ RSpec.describe "Integration with a third-party matcher", type: :integration do
|
|
228
228
|
snippet: %|expect(:anything).not_to pass_with_singleline_failure_message|,
|
229
229
|
expectation: proc {
|
230
230
|
red_line "This is a message that spans only one line."
|
231
|
-
}
|
231
|
+
},
|
232
232
|
)
|
233
233
|
|
234
234
|
expect(program).
|
@@ -21,7 +21,7 @@ RSpec.describe "Integration with RSpec and unhandled errors", type: :integration
|
|
21
21
|
expectation: proc {
|
22
22
|
red_line "RuntimeError:"
|
23
23
|
indent by: 2 do
|
24
|
-
red_line
|
24
|
+
red_line "Some kind of error or whatever"
|
25
25
|
newline
|
26
26
|
plain_line "This is another line"
|
27
27
|
end
|
@@ -95,7 +95,7 @@ RSpec.describe "Integration with RSpec and unhandled errors", type: :integration
|
|
95
95
|
indent by: 5 do
|
96
96
|
line do
|
97
97
|
plain "1.1) "
|
98
|
-
bold
|
98
|
+
bold "Failure/Error: "
|
99
99
|
plain snippet
|
100
100
|
end
|
101
101
|
|
@@ -106,7 +106,7 @@ RSpec.describe "Integration with RSpec and unhandled errors", type: :integration
|
|
106
106
|
indent by: 2 do
|
107
107
|
red_line "Some kind of error or whatever"
|
108
108
|
newline
|
109
|
-
line
|
109
|
+
line "This is another line"
|
110
110
|
end
|
111
111
|
end
|
112
112
|
end
|
@@ -116,7 +116,7 @@ RSpec.describe "Integration with RSpec and unhandled errors", type: :integration
|
|
116
116
|
indent by: 5 do
|
117
117
|
line do
|
118
118
|
plain "1.2) "
|
119
|
-
bold
|
119
|
+
bold "Failure/Error: "
|
120
120
|
plain snippet
|
121
121
|
end
|
122
122
|
|
@@ -127,7 +127,7 @@ RSpec.describe "Integration with RSpec and unhandled errors", type: :integration
|
|
127
127
|
indent by: 2 do
|
128
128
|
red_line "Some kind of error or whatever"
|
129
129
|
newline
|
130
|
-
line
|
130
|
+
line "This is another line"
|
131
131
|
end
|
132
132
|
end
|
133
133
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -8,6 +8,8 @@ begin
|
|
8
8
|
rescue LoadError
|
9
9
|
end
|
10
10
|
|
11
|
+
require "pp"
|
12
|
+
|
11
13
|
#---
|
12
14
|
|
13
15
|
require_relative "../support/current_bundle"
|
@@ -18,26 +20,25 @@ SuperDiff::CurrentBundle.instance.assert_appraisal!
|
|
18
20
|
|
19
21
|
begin
|
20
22
|
require "active_record"
|
23
|
+
|
21
24
|
active_record_available = true
|
22
|
-
rescue LoadError
|
23
|
-
active_record_available = false
|
24
|
-
end
|
25
25
|
|
26
|
-
if active_record_available
|
27
26
|
ActiveRecord::Base.establish_connection(
|
28
27
|
adapter: "sqlite3",
|
29
28
|
database: ":memory:",
|
30
29
|
)
|
31
|
-
|
32
|
-
|
33
|
-
else
|
34
|
-
require "super_diff/rspec"
|
30
|
+
rescue LoadError
|
31
|
+
active_record_available = false
|
35
32
|
end
|
36
33
|
|
37
|
-
Dir.glob(File.expand_path("support/**/*.rb", __dir__)).
|
38
|
-
|
39
|
-
|
40
|
-
|
34
|
+
Dir.glob(File.expand_path("support/**/*.rb", __dir__)).
|
35
|
+
sort.
|
36
|
+
reject do |file|
|
37
|
+
file.include?("/models/active_record/") && !active_record_available
|
38
|
+
end.
|
39
|
+
each do |file|
|
40
|
+
require file
|
41
|
+
end
|
41
42
|
|
42
43
|
RSpec.configure do |config|
|
43
44
|
config.include(SuperDiff::IntegrationTests, type: :integration)
|
@@ -65,6 +66,14 @@ RSpec.configure do |config|
|
|
65
66
|
|
66
67
|
config.order = :random
|
67
68
|
Kernel.srand config.seed
|
69
|
+
|
70
|
+
if ENV["CI"] == "true"
|
71
|
+
config.color_mode = :on
|
72
|
+
end
|
68
73
|
end
|
69
74
|
|
70
|
-
|
75
|
+
if active_record_available
|
76
|
+
require "super_diff/rspec-rails"
|
77
|
+
else
|
78
|
+
require "super_diff/rspec"
|
79
|
+
end
|
@@ -21,11 +21,15 @@ module SuperDiff
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def make_rspec_active_record_program(test, color_enabled:)
|
24
|
-
TestPrograms::
|
24
|
+
TestPrograms::RSpecActiveRecord.new(test, color_enabled: color_enabled)
|
25
|
+
end
|
26
|
+
|
27
|
+
def make_rspec_active_support_program(test, color_enabled:)
|
28
|
+
TestPrograms::RSpecActiveSupport.new(test, color_enabled: color_enabled)
|
25
29
|
end
|
26
30
|
|
27
31
|
def make_rspec_rails_test_program(test, color_enabled:)
|
28
|
-
TestPrograms::
|
32
|
+
TestPrograms::RSpecRails.new(test, color_enabled: color_enabled)
|
29
33
|
end
|
30
34
|
|
31
35
|
def build_expected_output(
|
@@ -36,7 +36,7 @@ module SuperDiff
|
|
36
36
|
"."
|
37
37
|
else
|
38
38
|
message =
|
39
|
-
"Expected test to produce output, but it did not.\n\n" +
|
39
|
+
"Expected test to produce #{expect_output_to_contain_color? ? "colored" : "uncolored"} output, but it did not.\n\n" +
|
40
40
|
"Expected output to contain:\n\n" +
|
41
41
|
CommandRunner::OutputHelpers.bookended(expected_output) +
|
42
42
|
"\n" +
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module SuperDiff
|
2
|
+
module IntegrationTests
|
3
|
+
module TestPrograms
|
4
|
+
class RSpecActiveSupport < Base
|
5
|
+
protected
|
6
|
+
|
7
|
+
def test_plan_prelude
|
8
|
+
"test_plan.boot_active_support"
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_plan_command
|
12
|
+
"run_rspec_active_support_test"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -10,7 +10,7 @@ shared_examples_for "integration with ActiveRecord" do
|
|
10
10
|
state: "CA",
|
11
11
|
zip: "90382",
|
12
12
|
)
|
13
|
-
actual
|
13
|
+
actual = SuperDiff::Test::Models::ActiveRecord::ShippingAddress.new(
|
14
14
|
line_1: "456 Ponderosa Ct.",
|
15
15
|
city: "Oakland",
|
16
16
|
state: "CA",
|
@@ -25,27 +25,27 @@ shared_examples_for "integration with ActiveRecord" do
|
|
25
25
|
snippet: "expect(actual).to eq(expected)",
|
26
26
|
expectation: proc {
|
27
27
|
line do
|
28
|
-
plain
|
29
|
-
|
28
|
+
plain %|Expected |
|
29
|
+
actual %|#<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: nil, city: "Oakland", line_1: "456 Ponderosa Ct.", line_2: "", state: "CA", zip: "91234">|
|
30
30
|
end
|
31
31
|
|
32
32
|
line do
|
33
|
-
plain
|
34
|
-
|
33
|
+
plain %| to eq |
|
34
|
+
expected %|#<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: nil, city: "Hill Valley", line_1: "123 Main St.", line_2: "", state: "CA", zip: "90382">|
|
35
35
|
end
|
36
36
|
},
|
37
37
|
diff: proc {
|
38
|
-
plain_line
|
39
|
-
plain_line
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
plain_line
|
45
|
-
plain_line
|
46
|
-
|
47
|
-
|
48
|
-
plain_line
|
38
|
+
plain_line %| #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress {|
|
39
|
+
plain_line %| id: nil,|
|
40
|
+
expected_line %|- city: "Hill Valley",|
|
41
|
+
actual_line %|+ city: "Oakland",|
|
42
|
+
expected_line %|- line_1: "123 Main St.",|
|
43
|
+
actual_line %|+ line_1: "456 Ponderosa Ct.",|
|
44
|
+
plain_line %| line_2: "",|
|
45
|
+
plain_line %| state: "CA",|
|
46
|
+
expected_line %|- zip: "90382"|
|
47
|
+
actual_line %|+ zip: "91234"|
|
48
|
+
plain_line %| }>|
|
49
49
|
},
|
50
50
|
)
|
51
51
|
|
@@ -66,7 +66,7 @@ shared_examples_for "integration with ActiveRecord" do
|
|
66
66
|
state: "CA",
|
67
67
|
zip: "90382",
|
68
68
|
)
|
69
|
-
actual
|
69
|
+
actual = SuperDiff::Test::Models::ActiveRecord::Person.new(
|
70
70
|
name: "Elliot",
|
71
71
|
age: 31,
|
72
72
|
)
|
@@ -80,13 +80,13 @@ shared_examples_for "integration with ActiveRecord" do
|
|
80
80
|
newline_before_expectation: true,
|
81
81
|
expectation: proc {
|
82
82
|
line do
|
83
|
-
plain
|
84
|
-
|
83
|
+
plain %|Expected |
|
84
|
+
actual %|#<SuperDiff::Test::Models::ActiveRecord::Person id: nil, age: 31, name: "Elliot">|
|
85
85
|
end
|
86
86
|
|
87
87
|
line do
|
88
|
-
plain
|
89
|
-
|
88
|
+
plain %| to eq |
|
89
|
+
expected %|#<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: nil, city: "Hill Valley", line_1: "123 Main St.", line_2: "", state: "CA", zip: "90382">|
|
90
90
|
end
|
91
91
|
},
|
92
92
|
)
|
@@ -108,7 +108,7 @@ shared_examples_for "integration with ActiveRecord" do
|
|
108
108
|
state: "CA",
|
109
109
|
zip: "90382"
|
110
110
|
)
|
111
|
-
actual
|
111
|
+
actual = nil
|
112
112
|
expect(actual).to eq(expected)
|
113
113
|
TEST
|
114
114
|
program = make_program(snippet, color_enabled: color_enabled)
|
@@ -119,13 +119,13 @@ shared_examples_for "integration with ActiveRecord" do
|
|
119
119
|
newline_before_expectation: true,
|
120
120
|
expectation: proc {
|
121
121
|
line do
|
122
|
-
plain
|
123
|
-
|
122
|
+
plain %|Expected |
|
123
|
+
actual %|nil|
|
124
124
|
end
|
125
125
|
|
126
126
|
line do
|
127
|
-
plain
|
128
|
-
|
127
|
+
plain %| to eq |
|
128
|
+
expected %|#<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: nil, city: "Hill Valley", line_1: "123 Main St.", line_2: "", state: "CA", zip: "90382">|
|
129
129
|
end
|
130
130
|
},
|
131
131
|
)
|
@@ -150,7 +150,7 @@ shared_examples_for "integration with ActiveRecord" do
|
|
150
150
|
zip: "90382",
|
151
151
|
)
|
152
152
|
}
|
153
|
-
actual
|
153
|
+
actual = {
|
154
154
|
name: "Marty McFly",
|
155
155
|
shipping_address: SuperDiff::Test::Models::ActiveRecord::ShippingAddress.new(
|
156
156
|
line_1: "456 Ponderosa Ct.",
|
@@ -168,30 +168,30 @@ shared_examples_for "integration with ActiveRecord" do
|
|
168
168
|
snippet: "expect(actual).to eq(expected)",
|
169
169
|
expectation: proc {
|
170
170
|
line do
|
171
|
-
plain
|
172
|
-
|
171
|
+
plain %|Expected |
|
172
|
+
actual %|{ name: "Marty McFly", shipping_address: #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: nil, city: "Oakland", line_1: "456 Ponderosa Ct.", line_2: "", state: "CA", zip: "91234"> }|
|
173
173
|
end
|
174
174
|
|
175
175
|
line do
|
176
|
-
plain
|
177
|
-
|
176
|
+
plain %| to eq |
|
177
|
+
expected %|{ name: "Marty McFly", shipping_address: #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: nil, city: "Hill Valley", line_1: "123 Main St.", line_2: "", state: "CA", zip: "90382"> }|
|
178
178
|
end
|
179
179
|
},
|
180
180
|
diff: proc {
|
181
|
-
plain_line
|
182
|
-
plain_line
|
183
|
-
plain_line
|
184
|
-
plain_line
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
plain_line
|
190
|
-
plain_line
|
191
|
-
|
192
|
-
|
193
|
-
plain_line
|
194
|
-
plain_line
|
181
|
+
plain_line %| {|
|
182
|
+
plain_line %| name: "Marty McFly",|
|
183
|
+
plain_line %| shipping_address: #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress {|
|
184
|
+
plain_line %| id: nil,|
|
185
|
+
expected_line %|- city: "Hill Valley",|
|
186
|
+
actual_line %|+ city: "Oakland",|
|
187
|
+
expected_line %|- line_1: "123 Main St.",|
|
188
|
+
actual_line %|+ line_1: "456 Ponderosa Ct.",|
|
189
|
+
plain_line %| line_2: "",|
|
190
|
+
plain_line %| state: "CA",|
|
191
|
+
expected_line %|- zip: "90382"|
|
192
|
+
actual_line %|+ zip: "91234"|
|
193
|
+
plain_line %| }>|
|
194
|
+
plain_line %| }|
|
195
195
|
},
|
196
196
|
)
|
197
197
|
|
@@ -215,7 +215,7 @@ shared_examples_for "integration with ActiveRecord" do
|
|
215
215
|
zip: "90382",
|
216
216
|
)
|
217
217
|
}
|
218
|
-
actual
|
218
|
+
actual = {
|
219
219
|
name: "Marty McFly",
|
220
220
|
shipping_address: SuperDiff::Test::Models::ActiveRecord::Person.new(
|
221
221
|
name: "Elliot",
|
@@ -231,32 +231,32 @@ shared_examples_for "integration with ActiveRecord" do
|
|
231
231
|
snippet: "expect(actual).to eq(expected)",
|
232
232
|
expectation: proc {
|
233
233
|
line do
|
234
|
-
plain
|
235
|
-
|
234
|
+
plain %|Expected |
|
235
|
+
actual %|{ name: "Marty McFly", shipping_address: #<SuperDiff::Test::Models::ActiveRecord::Person id: nil, age: 31, name: "Elliot"> }|
|
236
236
|
end
|
237
237
|
|
238
238
|
line do
|
239
|
-
plain
|
240
|
-
|
239
|
+
plain %| to eq |
|
240
|
+
expected %|{ name: "Marty McFly", shipping_address: #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: nil, city: "Hill Valley", line_1: "123 Main St.", line_2: "", state: "CA", zip: "90382"> }|
|
241
241
|
end
|
242
242
|
},
|
243
243
|
diff: proc {
|
244
|
-
plain_line
|
245
|
-
plain_line
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
plain_line
|
244
|
+
plain_line %| {|
|
245
|
+
plain_line %| name: "Marty McFly",|
|
246
|
+
expected_line %|- shipping_address: #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress {|
|
247
|
+
expected_line %|- id: nil,|
|
248
|
+
expected_line %|- city: "Hill Valley",|
|
249
|
+
expected_line %|- line_1: "123 Main St.",|
|
250
|
+
expected_line %|- line_2: "",|
|
251
|
+
expected_line %|- state: "CA",|
|
252
|
+
expected_line %|- zip: "90382"|
|
253
|
+
expected_line %|- }>|
|
254
|
+
actual_line %|+ shipping_address: #<SuperDiff::Test::Models::ActiveRecord::Person {|
|
255
|
+
actual_line %|+ id: nil,|
|
256
|
+
actual_line %|+ age: 31,|
|
257
|
+
actual_line %|+ name: "Elliot"|
|
258
|
+
actual_line %|+ }>|
|
259
|
+
plain_line %| }|
|
260
260
|
},
|
261
261
|
)
|
262
262
|
|
@@ -287,7 +287,7 @@ shared_examples_for "integration with ActiveRecord" do
|
|
287
287
|
)
|
288
288
|
]
|
289
289
|
expected = [shipping_addresses.first]
|
290
|
-
actual
|
290
|
+
actual = SuperDiff::Test::Models::ActiveRecord::ShippingAddress.all
|
291
291
|
expect(actual).to eq(expected)
|
292
292
|
TEST
|
293
293
|
program = make_program(snippet, color_enabled: color_enabled)
|
@@ -297,34 +297,34 @@ shared_examples_for "integration with ActiveRecord" do
|
|
297
297
|
snippet: "expect(actual).to eq(expected)",
|
298
298
|
expectation: proc {
|
299
299
|
line do
|
300
|
-
plain
|
301
|
-
|
300
|
+
plain %|Expected |
|
301
|
+
actual %|#<ActiveRecord::Relation [#<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: 1, city: "Hill Valley", line_1: "123 Main St.", line_2: "", state: "CA", zip: "90382">, #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: 2, city: "Oakland", line_1: "456 Ponderosa Ct.", line_2: "", state: "CA", zip: "91234">]>|
|
302
302
|
end
|
303
303
|
|
304
304
|
line do
|
305
|
-
plain
|
306
|
-
|
305
|
+
plain %| to eq |
|
306
|
+
expected %|[#<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: 1, city: "Hill Valley", line_1: "123 Main St.", line_2: "", state: "CA", zip: "90382">]|
|
307
307
|
end
|
308
308
|
},
|
309
309
|
diff: proc {
|
310
|
-
plain_line
|
311
|
-
plain_line
|
312
|
-
plain_line
|
313
|
-
plain_line
|
314
|
-
plain_line
|
315
|
-
plain_line
|
316
|
-
plain_line
|
317
|
-
plain_line
|
318
|
-
plain_line
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
plain_line
|
310
|
+
plain_line %| #<ActiveRecord::Relation [|
|
311
|
+
plain_line %| #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress {|
|
312
|
+
plain_line %| id: 1,|
|
313
|
+
plain_line %| city: "Hill Valley",|
|
314
|
+
plain_line %| line_1: "123 Main St.",|
|
315
|
+
plain_line %| line_2: "",|
|
316
|
+
plain_line %| state: "CA",|
|
317
|
+
plain_line %| zip: "90382"|
|
318
|
+
plain_line %| }>,|
|
319
|
+
actual_line %|+ #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress {|
|
320
|
+
actual_line %|+ id: 2,|
|
321
|
+
actual_line %|+ city: "Oakland",|
|
322
|
+
actual_line %|+ line_1: "456 Ponderosa Ct.",|
|
323
|
+
actual_line %|+ line_2: "",|
|
324
|
+
actual_line %|+ state: "CA",|
|
325
|
+
actual_line %|+ zip: "91234"|
|
326
|
+
actual_line %|+ }>|
|
327
|
+
plain_line %| ]>|
|
328
328
|
},
|
329
329
|
)
|
330
330
|
|
@@ -354,7 +354,7 @@ shared_examples_for "integration with ActiveRecord" do
|
|
354
354
|
)
|
355
355
|
]
|
356
356
|
|
357
|
-
actual
|
357
|
+
actual = [
|
358
358
|
SuperDiff::Test::Models::ActiveRecord::Query.new(
|
359
359
|
results: SuperDiff::Test::Models::ActiveRecord::Person.all
|
360
360
|
)
|
@@ -371,30 +371,30 @@ shared_examples_for "integration with ActiveRecord" do
|
|
371
371
|
newline_before_expectation: true,
|
372
372
|
expectation: proc {
|
373
373
|
line do
|
374
|
-
plain
|
375
|
-
|
374
|
+
plain %|Expected |
|
375
|
+
actual %|[#<SuperDiff::Test::Models::ActiveRecord::Query @results=#<ActiveRecord::Relation [#<SuperDiff::Test::Models::ActiveRecord::Person id: 1, name: "Murphy", age: 20>]>>]|
|
376
376
|
end
|
377
377
|
|
378
378
|
line do
|
379
|
-
plain
|
380
|
-
|
379
|
+
plain %|to match |
|
380
|
+
expected %|[#<an object having attributes (results: [#<an object having attributes (name: "John", age: 19)>])>]|
|
381
381
|
end
|
382
382
|
},
|
383
383
|
diff: proc {
|
384
|
-
plain_line
|
385
|
-
plain_line
|
386
|
-
plain_line
|
387
|
-
plain_line
|
388
|
-
plain_line
|
389
|
-
#
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
plain_line
|
395
|
-
plain_line
|
396
|
-
plain_line
|
397
|
-
plain_line
|
384
|
+
plain_line %| [|
|
385
|
+
plain_line %| #<SuperDiff::Test::Models::ActiveRecord::Query {|
|
386
|
+
plain_line %| @results=#<ActiveRecord::Relation [|
|
387
|
+
plain_line %| #<SuperDiff::Test::Models::ActiveRecord::Person {|
|
388
|
+
plain_line %| id: 1,|
|
389
|
+
# expected_line %|- age: 19,| # TODO
|
390
|
+
expected_line %|- age: 19|
|
391
|
+
actual_line %|+ age: 20,|
|
392
|
+
expected_line %|- name: "John"|
|
393
|
+
actual_line %|+ name: "Murphy"|
|
394
|
+
plain_line %| }>|
|
395
|
+
plain_line %| ]>|
|
396
|
+
plain_line %| }>|
|
397
|
+
plain_line %| ]|
|
398
398
|
},
|
399
399
|
)
|
400
400
|
|