diff options
Diffstat (limited to 'spec/ruby/library/prime')
| -rw-r--r-- | spec/ruby/library/prime/each_spec.rb | 22 | ||||
| -rw-r--r-- | spec/ruby/library/prime/instance_spec.rb | 8 | ||||
| -rw-r--r-- | spec/ruby/library/prime/integer/prime_division_spec.rb | 2 | ||||
| -rw-r--r-- | spec/ruby/library/prime/integer/prime_spec.rb | 14 | ||||
| -rw-r--r-- | spec/ruby/library/prime/prime_division_spec.rb | 4 | ||||
| -rw-r--r-- | spec/ruby/library/prime/prime_spec.rb | 14 |
6 files changed, 32 insertions, 32 deletions
diff --git a/spec/ruby/library/prime/each_spec.rb b/spec/ruby/library/prime/each_spec.rb index b99cf7cf0e..d81e952a88 100644 --- a/spec/ruby/library/prime/each_spec.rb +++ b/spec/ruby/library/prime/each_spec.rb @@ -32,11 +32,11 @@ describe :prime_each, shared: true do all_prime &&= (2..Math.sqrt(prime)).all? { |d| prime % d != 0 } end - all_prime.should be_true + all_prime.should == true end it "returns the last evaluated expression in the passed block" do - @object.each { break :value }.should equal(:value) + @object.each { break :value }.should.equal?(:value) end describe "when not passed a block" do @@ -45,23 +45,23 @@ describe :prime_each, shared: true do end it "returns an object that is Enumerable" do - @prime_enum.each.should be_kind_of(Enumerable) + @prime_enum.each.should.is_a?(Enumerable) end it "returns an object that responds to #with_index" do - @prime_enum.should respond_to(:with_index) + @prime_enum.should.respond_to?(:with_index) end it "returns an object that responds to #with_object" do - @prime_enum.should respond_to(:with_object) + @prime_enum.should.respond_to?(:with_object) end it "returns an object that responds to #next" do - @prime_enum.should respond_to(:next) + @prime_enum.should.respond_to?(:next) end it "returns an object that responds to #rewind" do - @prime_enum.should respond_to(:rewind) + @prime_enum.should.respond_to?(:rewind) end it "yields primes starting at 2 independent of prior enumerators" do @@ -106,13 +106,13 @@ describe :prime_each_with_arguments, shared: true do ScratchPad.recorded.all? do |prime| (2..Math.sqrt(prime)).all? { |d| prime % d != 0 } - end.should be_true + end.should == true - ScratchPad.recorded.all? { |prime| prime <= bound }.should be_true + ScratchPad.recorded.all? { |prime| prime <= bound }.should == true end it "returns nil when no prime is generated" do - @object.each(1) { :value }.should be_nil + @object.each(1) { :value }.should == nil end it "yields primes starting at 2 independent of prior enumeration" do @@ -132,7 +132,7 @@ describe :prime_each_with_arguments, shared: true do describe "when not passed a block" do it "returns an object that returns primes less than or equal to the bound" do bound = 100 - @object.each(bound).all? { |prime| prime <= bound }.should be_true + @object.each(bound).all? { |prime| prime <= bound }.should == true end end end diff --git a/spec/ruby/library/prime/instance_spec.rb b/spec/ruby/library/prime/instance_spec.rb index 5183f36901..680895eb64 100644 --- a/spec/ruby/library/prime/instance_spec.rb +++ b/spec/ruby/library/prime/instance_spec.rb @@ -3,12 +3,12 @@ require 'prime' describe "Prime.instance" do it "returns a object representing the set of prime numbers" do - Prime.instance.should be_kind_of(Prime) + Prime.instance.should.is_a?(Prime) end it "returns a object with no obsolete features" do - Prime.instance.should_not respond_to(:succ) - Prime.instance.should_not respond_to(:next) + Prime.instance.should_not.respond_to?(:succ) + Prime.instance.should_not.respond_to?(:next) end it "does not complain anything" do @@ -16,6 +16,6 @@ describe "Prime.instance" do end it "raises a ArgumentError when is called with some arguments" do - -> { Prime.instance(1) }.should raise_error(ArgumentError) + -> { Prime.instance(1) }.should.raise(ArgumentError) end end diff --git a/spec/ruby/library/prime/integer/prime_division_spec.rb b/spec/ruby/library/prime/integer/prime_division_spec.rb index be03438a6f..5631b22d0a 100644 --- a/spec/ruby/library/prime/integer/prime_division_spec.rb +++ b/spec/ruby/library/prime/integer/prime_division_spec.rb @@ -14,6 +14,6 @@ describe "Integer#prime_division" do -1.prime_division.should == [[-1, 1]] end it "raises ZeroDivisionError for 0" do - -> { 0.prime_division }.should raise_error(ZeroDivisionError) + -> { 0.prime_division }.should.raise(ZeroDivisionError) end end diff --git a/spec/ruby/library/prime/integer/prime_spec.rb b/spec/ruby/library/prime/integer/prime_spec.rb index 53de76d5ab..d24f883b19 100644 --- a/spec/ruby/library/prime/integer/prime_spec.rb +++ b/spec/ruby/library/prime/integer/prime_spec.rb @@ -3,15 +3,15 @@ require 'prime' describe "Integer#prime?" do it "returns a true value for prime numbers" do - 2.prime?.should be_true - 3.prime?.should be_true - (2**31-1).prime?.should be_true # 8th Mersenne prime (M8) + 2.prime?.should == true + 3.prime?.should == true + (2**31-1).prime?.should == true # 8th Mersenne prime (M8) end it "returns a false value for composite numbers" do - 4.prime?.should be_false - 15.prime?.should be_false - (2**32-1).prime?.should be_false - ( (2**17-1)*(2**19-1) ).prime?.should be_false # M6*M7 + 4.prime?.should == false + 15.prime?.should == false + (2**32-1).prime?.should == false + ( (2**17-1)*(2**19-1) ).prime?.should == false # M6*M7 end end diff --git a/spec/ruby/library/prime/prime_division_spec.rb b/spec/ruby/library/prime/prime_division_spec.rb index 6293478f59..cc39969a56 100644 --- a/spec/ruby/library/prime/prime_division_spec.rb +++ b/spec/ruby/library/prime/prime_division_spec.rb @@ -16,10 +16,10 @@ describe "Prime.prime_division" do end it "includes [[-1, 1]] in the divisors of a negative number" do - Prime.prime_division(-10).should include([-1, 1]) + Prime.prime_division(-10).should.include?([-1, 1]) end it "raises ZeroDivisionError for 0" do - -> { Prime.prime_division(0) }.should raise_error(ZeroDivisionError) + -> { Prime.prime_division(0) }.should.raise(ZeroDivisionError) end end diff --git a/spec/ruby/library/prime/prime_spec.rb b/spec/ruby/library/prime/prime_spec.rb index 0896c7f0f3..207c763aed 100644 --- a/spec/ruby/library/prime/prime_spec.rb +++ b/spec/ruby/library/prime/prime_spec.rb @@ -3,15 +3,15 @@ require 'prime' describe "Prime#prime?" do it "returns a true value for prime numbers" do - Prime.prime?(2).should be_true - Prime.prime?(3).should be_true - Prime.prime?(2**31-1).should be_true # 8th Mersenne prime (M8) + Prime.prime?(2).should == true + Prime.prime?(3).should == true + Prime.prime?(2**31-1).should == true # 8th Mersenne prime (M8) end it "returns a false value for composite numbers" do - Prime.prime?(4).should be_false - Prime.prime?(15).should be_false - Prime.prime?(2**32-1).should be_false - Prime.prime?( (2**17-1)*(2**19-1) ).should be_false # M6*M7 + Prime.prime?(4).should == false + Prime.prime?(15).should == false + Prime.prime?(2**32-1).should == false + Prime.prime?( (2**17-1)*(2**19-1) ).should == false # M6*M7 end end |
