diff --git a/lib/mongoid/extensions/set.rb b/lib/mongoid/extensions/set.rb index 574723f845..a9072678e4 100644 --- a/lib/mongoid/extensions/set.rb +++ b/lib/mongoid/extensions/set.rb @@ -59,6 +59,16 @@ def mongoize(object) when ::Array then ::Array.mongoize(object).uniq end end + + # Returns whether the object's size can be changed. + # + # @example Is the object resizable? + # Set.resizable? + # + # @return [ true ] true. + def resizable? + true + end end end end diff --git a/spec/mongoid/extensions/array_spec.rb b/spec/mongoid/extensions/array_spec.rb index 6c007320fb..097e60ee36 100644 --- a/spec/mongoid/extensions/array_spec.rb +++ b/spec/mongoid/extensions/array_spec.rb @@ -362,7 +362,7 @@ end end - describe "#resiable?" do + describe "#resizable?" do it "returns true" do expect([]).to be_resizable diff --git a/spec/mongoid/extensions/set_spec.rb b/spec/mongoid/extensions/set_spec.rb index f81e43c5fc..fb4979a7c6 100644 --- a/spec/mongoid/extensions/set_spec.rb +++ b/spec/mongoid/extensions/set_spec.rb @@ -137,4 +137,18 @@ end end end + + describe ".resizable?" do + + it "returns true" do + expect(Set).to be_resizable + end + end + + describe "#resizable?" do + + it "returns true" do + expect(Set.new).to be_resizable + end + end end