vendor/plugins/rspec/spec/spec/expectations/differs/default_spec.rb in spree-0.2.0 vs vendor/plugins/rspec/spec/spec/expectations/differs/default_spec.rb in spree-0.4.0
- old
+ new
@@ -26,11 +26,29 @@
end
it "should output unified diff of two strings" do
expected="foo\nbar\nzap\nthis\nis\nsoo\nvery\nvery\nequal\ninsert\na\nline\n"
actual="foo\nzap\nbar\nthis\nis\nsoo\nvery\nvery\nequal\ninsert\na\nanother\nline\n"
- expected_diff="\n\n@@ -1,6 +1,6 @@\n foo\n-bar\n zap\n+bar\n this\n is\n soo\n@@ -9,5 +9,6 @@\n equal\n insert\n a\n+another\n line\n"
+ expected_diff= <<'EOD'
+
+
+@@ -1,6 +1,6 @@
+ foo
+-zap
+ bar
++zap
+ this
+ is
+ soo
+@@ -9,6 +9,5 @@
+ equal
+ insert
+ a
+-another
+ line
+EOD
+
diff = @differ.diff_as_string(expected, actual)
diff.should eql(expected_diff)
end
it "should output unified diff message of two arrays" do
@@ -42,15 +60,15 @@
@@ -5,7 +5,7 @@
:metasyntactic,
"variable",
:delta,
-- "charlie",
-+ "tango",
+- "tango",
++ "charlie",
:width,
-- "quite wide"]
-+ "very wide"]
+- "very wide"]
++ "quite wide"]
EOD
diff = @differ.diff_as_object(expected,actual)
diff.should == expected_diff
@@ -63,12 +81,12 @@
expected_diff = <<'EOD'
@@ -1,5 +1,5 @@
<Animal
name=bob,
-- species=giraffe
-+ species=tortoise
+- species=tortoise
++ species=giraffe
>
EOD
diff = @differ.diff_as_object(expected,actual)
diff.should == expected_diff
@@ -92,15 +110,15 @@
***************
*** 1,5 ****
<Animal
name=bob,
-! species=giraffe
+! species=tortoise
>
--- 1,5 ----
<Animal
name=bob,
-! species=tortoise
+! species=giraffe
>
EOD
diff = @differ.diff_as_object(expected,actual)
diff.should == expected_diff