diff options
Diffstat (limited to 'spec/ruby/core/rational/quo_spec.rb')
| -rw-r--r-- | spec/ruby/core/rational/quo_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/ruby/core/rational/quo_spec.rb b/spec/ruby/core/rational/quo_spec.rb new file mode 100644 index 0000000000..907898ad34 --- /dev/null +++ b/spec/ruby/core/rational/quo_spec.rb @@ -0,0 +1,25 @@ +require_relative "../../spec_helper" + +describe "Rational#quo" do + it "calls #coerce on the passed argument with self" do + rational = Rational(3, 4) + obj = mock("Object") + obj.should_receive(:coerce).with(rational).and_return([1, 2]) + + rational.quo(obj) + end + + it "calls #/ on the coerced Rational with the coerced Object" do + rational = Rational(3, 4) + + coerced_rational = mock("Coerced Rational") + coerced_rational.should_receive(:/).and_return(:result) + + coerced_obj = mock("Coerced Object") + + obj = mock("Object") + obj.should_receive(:coerce).and_return([coerced_rational, coerced_obj]) + + rational.quo(obj).should == :result + end +end |
