Created
April 10, 2011 09:02
-
-
Save anonymous/912172 to your computer and use it in GitHub Desktop.
catalog of books
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def setup() | |
Mongoid.configure do |config| | |
config.master = Mongo::Connection.new.db("testbooks") | |
end | |
@books = Books.new(title: 'Turn of a Screw', author: "Henry James", barcode: '666') | |
end | |
def test_barcode | |
# Test for uniqueness of each book barcode | |
# Compare to whole, must not match any | |
assert_equal(@books, Books.where(author: 'Henry James').entries) | |
end | |
output | |
1) Failure: | |
test_barcode(TestBooks) [test_books.rb:24]: | |
<#<Books _id: 4da1744c3484173351000001, title: "Turn of a Screw", author: "Henry James", barcode: "666">> expected but was | |
<#<Books _id: 4da173bd348417333b000001, title: "Turn of a Screw", author: "Henry James", barcode: "666">>. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment