Skip to content

Commit

Permalink
OpenStruct: Improve the spec of new_ostruct_member, even though it will
Browse files Browse the repository at this point in the history
most likely disappear altogether as this method should be private.
  • Loading branch information
marcandre committed Mar 16, 2012
1 parent bf2f4e9 commit 108ac10
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions library/openstruct/new_ostruct_member_spec.rb
Expand Up @@ -10,13 +10,14 @@
it "creates an attribute reader method for the passed method_name" do
@os.respond_to?(:age).should be_false
@os.new_ostruct_member(:age)
@os.respond_to?(:age).should be_true
@os.method(:age).call.should == 20
end

it "creates an attribute writer method for the passed method_name" do
@os.respond_to?(:age=).should be_false
@os.new_ostruct_member(:age)
@os.respond_to?(:age=).should be_true
@os.method(:age=).call(42).should == 42
@os.age.should == 42
end

it "does not allow overwriting existing methods" do
Expand Down

0 comments on commit 108ac10

Please sign in to comment.