aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/library/openstruct/element_reference_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/openstruct/element_reference_spec.rb')
-rw-r--r--spec/ruby/library/openstruct/element_reference_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/library/openstruct/element_reference_spec.rb b/spec/ruby/library/openstruct/element_reference_spec.rb
new file mode 100644
index 0000000000..431843547d
--- /dev/null
+++ b/spec/ruby/library/openstruct/element_reference_spec.rb
@@ -0,0 +1,13 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+require "ostruct"
+
+describe "OpenStruct#[]" do
+ before :each do
+ @os = OpenStruct.new
+ end
+
+ it "returns the associated value" do
+ @os.foo = 42
+ @os[:foo].should == 42
+ end
+end