spec/mem_spec.rb in mem-0.1.0 vs spec/mem_spec.rb in mem-0.1.1
- old
+ new
@@ -17,20 +17,31 @@
memoize :a
def b(value)
[value, yield]
end
+
+ def c
+ "c"
+ end
+ memoize :c
end
end
it "memoizes the method call" do
expect(object).to receive(:b).once.and_call_original
expect(object.a(1) { 2 }).to eq [1, 2]
expect(object.a(3) { 4 }).to eq [1, 2]
end
+
+ it "defines setter" do
+ expect(object.c).to eq "c"
+ object.c = "d"
+ expect(object.c).to eq "d"
+ end
end
- context "with normal method name" do
+ context "with abnormal method name" do
let(:klass) do
Class.new do
include Mem
def a!(value, &block)