spec/o_spec.rb in o-2.0.2 vs spec/o_spec.rb in o-2.0.3
- old
+ new
@@ -80,10 +80,23 @@
it '#["key"]= value' do
@rc["a"] = 1
@rc[:a].should == 1
end
end
+
+ context "initalize with default value" do
+ it "default value is nil" do
+ rc = O.new
+ rc[:foo].should == nil
+ end
+
+ it "init with default value 1" do
+ rc = O.new 1
+ rc[:foo].should == 1
+ end
+ end
+
it "return <#O> if key doesn't exist" do
rc = O.new
rc.i.dont.exists.should be_an_instance_of O
end
@@ -243,9 +256,16 @@
a 1
end
rc._keys.should == [:a]
end
+
+ it "_method? must comes before method?" do
+ rc = O.new
+ rc.i._empty?.should be_true
+ rc.i.empty?.should be_false
+ end
+
end
context "temporarily change" do
it "works" do
rc = O.new do