我正在尝试学习 Objects on Rails 书籍并找到问题以了解->
操作员的意思。
代码是:
describe Blog do
subject { Blog.new(->{entries}) }
let(:entries) { [] }
it "has no entries" do
subject.entries.must_be_empty
end
describe "#new_entry" do
let(:new_post) { OpenStruct.new }
before do
subject.post_source = ->{ new_post }
end
it "returns a new post" do
subject.new_post.must_equal new_post
end
end
我花了很多时间在任何文档中找到它,但找不到