diff options
Diffstat (limited to 'spec/ruby/optional/capi/shared/rbasic.rb')
| -rw-r--r-- | spec/ruby/optional/capi/shared/rbasic.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/ruby/optional/capi/shared/rbasic.rb b/spec/ruby/optional/capi/shared/rbasic.rb new file mode 100644 index 0000000000..e3485d4b7b --- /dev/null +++ b/spec/ruby/optional/capi/shared/rbasic.rb @@ -0,0 +1,27 @@ +describe :rbasic, shared: true do + before :all do + specs = CApiRBasicSpecs.new + @freeze = specs.freeze_flag + end + + it "reports the appropriate FREEZE flag for the object when reading" do + obj, _ = @data.call + initial = @specs.get_flags(obj) + obj.freeze + (@specs.get_flags(obj) & 0xFFFF).should == (@freeze | initial) & 0xFFFF + end + + it "supports setting the FREEZE flag" do + obj, _ = @data.call + initial = @specs.get_flags(obj) + @specs.set_flags(obj, @freeze | initial).should == @freeze | initial + obj.should.frozen? + end + + it "supports retrieving the (meta)class" do + obj, _ = @data.call + @specs.get_klass(obj).should == obj.class + obj.singleton_class # ensure the singleton class exists + @specs.get_klass(obj).should == obj.singleton_class + end +end |
