看一下你对应的测试代码是不是 user
和 user1
只调用过一个。
Note that let is lazy-evaluated: it is not evaluated until the first time the method it defines is invoked.
关于 let 和 let!: https://www.relishapp.com/rspec/rspec-core/v/3-3/docs/helper-methods/let-and-let
git commit -m "Update a"
细心点啊。。
Object.class # => Class
Class.superclass.superclass # => Object
可以用
begin
puts val
val += 1
end while val < 0
但是推荐用
loop do
puts val
val += 1
break unless val < 0
end
关于Array#slice
an empty array is returned when the starting index for an element range is at the end of the array.
Returns nil if the index (or starting index) are out of range.
来源 ruby-doc