我正在关注http://goo.gl/7Dlv5。视频创建了一个类
class Book
end
测试规范/book_spec.rb 看起来像:
require "spec_helper"
describe Book do
before :each do
@book = Book.new "Title","Author", :category
end
describe "#new" do
it "returns a new book object" do
@book.should be_an_instance_of Book
end
end
end
测试通过了作者。它对我来说失败了。所以我猜红宝石有什么变化?或者也许是我在代码中找不到的错字。你能帮忙吗?
这是我的结果。谢谢你。
Failures:
1) Book#new returns a new book object
Failure/Error: @book = Book.new "Title","Author", :category
ArgumentError:
wrong number of arguments(3 for 0)
# ./spec/book_spec.rb:6:in `initialize'
# ./spec/book_spec.rb:6:in `new'
# ./spec/book_spec.rb:6:in `block (2 levels) in <top (required)>'
Finished in 0.00058 seconds
1 example, 1 failure
Failed examples:
rspec ./spec/book_spec.rb:11 # Book#new returns a new book object