0
我想比較兩個數組比較2個陣列,但是assert_equal
引發錯誤:內容相等
No visible difference in the Array#inspect output.
You should look at the implementation of #== on Array or its members.
這裏是我的測試:
describe Post do
before do
@draft = Post.new('test-draft', draft = true)
@post = Post.new('2014-10-31-test-post')
end
describe '.drafts' do
it 'returns an array of unpublished posts' do
actual = Post.drafts
assert_equal [@draft], actual
end
end
end
這裏是我的兩個數組,它們是相同的在內容上,但有不同的內存位置。
[
[0] #<Post:0x0000000851a178 @file_name="test-draft", @draft=true>
]
[
[0] #<Post:0x0000000851a538 @file_name="test-draft", @draft=true>
]
如何比較我的兩個數組?