diff options
Diffstat (limited to 'spec/ruby/core/struct/length_spec.rb')
-rw-r--r-- | spec/ruby/core/struct/length_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/ruby/core/struct/length_spec.rb b/spec/ruby/core/struct/length_spec.rb new file mode 100644 index 0000000000..067bb08f88 --- /dev/null +++ b/spec/ruby/core/struct/length_spec.rb @@ -0,0 +1,12 @@ +require File.expand_path('../../../spec_helper', __FILE__) +require File.expand_path('../fixtures/classes', __FILE__) +require File.expand_path('../shared/accessor', __FILE__) + +describe "Struct#length" do + it "returns the number of attributes" do + StructClasses::Car.new('Cadillac', 'DeVille').length.should == 3 + StructClasses::Car.new.length.should == 3 + end + + it_behaves_like :struct_accessor, :length +end |