summaryrefslogtreecommitdiff
path: root/spec/rubyspec/core/fixnum
diff options
context:
space:
mode:
Diffstat (limited to 'spec/rubyspec/core/fixnum')
-rw-r--r--spec/rubyspec/core/fixnum/bit_and_spec.rb6
-rw-r--r--spec/rubyspec/core/fixnum/fixnum_spec.rb12
2 files changed, 18 insertions, 0 deletions
diff --git a/spec/rubyspec/core/fixnum/bit_and_spec.rb b/spec/rubyspec/core/fixnum/bit_and_spec.rb
index ff0e597a52..9586075039 100644
--- a/spec/rubyspec/core/fixnum/bit_and_spec.rb
+++ b/spec/rubyspec/core/fixnum/bit_and_spec.rb
@@ -27,6 +27,12 @@ describe "Fixnum#&" do
(-1 & 2**64).should == 18446744073709551616
end
+ it "coerces the rhs and calls #coerce" do
+ obj = mock("fixnum bit and")
+ obj.should_receive(:coerce).with(6).and_return([3, 6])
+ (6 & obj).should == 2
+ end
+
it "raises a TypeError when passed a Float" do
lambda { (3 & 3.4) }.should raise_error(TypeError)
end
diff --git a/spec/rubyspec/core/fixnum/fixnum_spec.rb b/spec/rubyspec/core/fixnum/fixnum_spec.rb
index d0af975c59..8a050fd25e 100644
--- a/spec/rubyspec/core/fixnum/fixnum_spec.rb
+++ b/spec/rubyspec/core/fixnum/fixnum_spec.rb
@@ -4,4 +4,16 @@ describe "Fixnum" do
it "includes Comparable" do
Fixnum.include?(Comparable).should == true
end
+
+ it ".allocate raises a TypeError" do
+ lambda do
+ Fixnum.allocate
+ end.should raise_error(TypeError)
+ end
+
+ it ".new is undefined" do
+ lambda do
+ Fixnum.new
+ end.should raise_error(NoMethodError)
+ end
end