diff options
Diffstat (limited to 'spec/ruby/library/matrix/shared')
| -rw-r--r-- | spec/ruby/library/matrix/shared/collect.rb | 8 | ||||
| -rw-r--r-- | spec/ruby/library/matrix/shared/conjugate.rb | 4 | ||||
| -rw-r--r-- | spec/ruby/library/matrix/shared/determinant.rb | 8 | ||||
| -rw-r--r-- | spec/ruby/library/matrix/shared/equal_value.rb | 22 | ||||
| -rw-r--r-- | spec/ruby/library/matrix/shared/identity.rb | 6 | ||||
| -rw-r--r-- | spec/ruby/library/matrix/shared/imaginary.rb | 4 | ||||
| -rw-r--r-- | spec/ruby/library/matrix/shared/inverse.rb | 10 | ||||
| -rw-r--r-- | spec/ruby/library/matrix/shared/rectangular.rb | 4 | ||||
| -rw-r--r-- | spec/ruby/library/matrix/shared/trace.rb | 2 | ||||
| -rw-r--r-- | spec/ruby/library/matrix/shared/transpose.rb | 4 |
10 files changed, 36 insertions, 36 deletions
diff --git a/spec/ruby/library/matrix/shared/collect.rb b/spec/ruby/library/matrix/shared/collect.rb index 256cd6a190..3a4dbe3a36 100644 --- a/spec/ruby/library/matrix/shared/collect.rb +++ b/spec/ruby/library/matrix/shared/collect.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../fixtures/classes', __FILE__) +require_relative '../fixtures/classes' require 'matrix' describe :collect, shared: true do @@ -7,7 +7,7 @@ describe :collect, shared: true do end it "returns an instance of Matrix" do - @m.send(@method){|n| n * 2 }.should be_kind_of(Matrix) + @m.send(@method){|n| n * 2 }.should.is_a?(Matrix) end it "returns a Matrix where each element is the result of the block" do @@ -15,12 +15,12 @@ describe :collect, shared: true do end it "returns an enumerator if no block is given" do - @m.send(@method).should be_an_instance_of(Enumerator) + @m.send(@method).should.instance_of?(Enumerator) end describe "for a subclass of Matrix" do it "returns an instance of that subclass" do - MatrixSub.ins.send(@method){1}.should be_an_instance_of(MatrixSub) + MatrixSub.ins.send(@method){1}.should.instance_of?(MatrixSub) end end end diff --git a/spec/ruby/library/matrix/shared/conjugate.rb b/spec/ruby/library/matrix/shared/conjugate.rb index 180ff4fa98..ffdf5ebca1 100644 --- a/spec/ruby/library/matrix/shared/conjugate.rb +++ b/spec/ruby/library/matrix/shared/conjugate.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../fixtures/classes', __FILE__) +require_relative '../fixtures/classes' require 'matrix' describe :matrix_conjugate, shared: true do @@ -14,7 +14,7 @@ describe :matrix_conjugate, shared: true do describe "for a subclass of Matrix" do it "returns an instance of that subclass" do - MatrixSub.ins.send(@method).should be_an_instance_of(MatrixSub) + MatrixSub.ins.send(@method).should.instance_of?(MatrixSub) end end end diff --git a/spec/ruby/library/matrix/shared/determinant.rb b/spec/ruby/library/matrix/shared/determinant.rb index 47a58c62a6..b7c86393ba 100644 --- a/spec/ruby/library/matrix/shared/determinant.rb +++ b/spec/ruby/library/matrix/shared/determinant.rb @@ -27,12 +27,12 @@ describe :determinant, shared: true do end it "raises an error for rectangular matrices" do - lambda { + -> { Matrix[[1], [2], [3]].send(@method) - }.should raise_error(Matrix::ErrDimensionMismatch) + }.should.raise(Matrix::ErrDimensionMismatch) - lambda { + -> { Matrix.empty(3,0).send(@method) - }.should raise_error(Matrix::ErrDimensionMismatch) + }.should.raise(Matrix::ErrDimensionMismatch) end end diff --git a/spec/ruby/library/matrix/shared/equal_value.rb b/spec/ruby/library/matrix/shared/equal_value.rb index e2102e823a..9bc6ed908b 100644 --- a/spec/ruby/library/matrix/shared/equal_value.rb +++ b/spec/ruby/library/matrix/shared/equal_value.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../fixtures/classes', __FILE__) +require_relative '../fixtures/classes' require 'matrix' describe :equal, shared: true do @@ -7,27 +7,27 @@ describe :equal, shared: true do end it "returns true for self" do - @matrix.send(@method, @matrix).should be_true + @matrix.send(@method, @matrix).should == true end it "returns true for equal matrices" do - @matrix.send(@method, Matrix[ [1, 2, 3, 4, 5], [2, 3, 4, 5, 6] ]).should be_true + @matrix.send(@method, Matrix[ [1, 2, 3, 4, 5], [2, 3, 4, 5, 6] ]).should == true end it "returns false for different matrices" do - @matrix.send(@method, Matrix[ [42, 2, 3, 4, 5], [2, 3, 4, 5, 6] ]).should be_false - @matrix.send(@method, Matrix[ [1, 2, 3, 4, 5, 6], [2, 3, 4, 5, 6, 7] ]).should be_false - @matrix.send(@method, Matrix[ [1, 2, 3], [2, 3, 4] ]).should be_false + @matrix.send(@method, Matrix[ [42, 2, 3, 4, 5], [2, 3, 4, 5, 6] ]).should == false + @matrix.send(@method, Matrix[ [1, 2, 3, 4, 5, 6], [2, 3, 4, 5, 6, 7] ]).should == false + @matrix.send(@method, Matrix[ [1, 2, 3], [2, 3, 4] ]).should == false end it "returns false for different empty matrices" do - Matrix.empty(42, 0).send(@method, Matrix.empty(6, 0)).should be_false - Matrix.empty(0, 42).send(@method, Matrix.empty(0, 6)).should be_false - Matrix.empty(0, 0).send(@method, Matrix.empty(6, 0)).should be_false - Matrix.empty(0, 0).send(@method, Matrix.empty(0, 6)).should be_false + Matrix.empty(42, 0).send(@method, Matrix.empty(6, 0)).should == false + Matrix.empty(0, 42).send(@method, Matrix.empty(0, 6)).should == false + Matrix.empty(0, 0).send(@method, Matrix.empty(6, 0)).should == false + Matrix.empty(0, 0).send(@method, Matrix.empty(0, 6)).should == false end it "doesn't distinguish on subclasses" do - MatrixSub.ins.send(@method, Matrix.I(2)).should be_true + MatrixSub.ins.send(@method, Matrix.I(2)).should == true end end diff --git a/spec/ruby/library/matrix/shared/identity.rb b/spec/ruby/library/matrix/shared/identity.rb index 20b35ae8e3..df957b5a75 100644 --- a/spec/ruby/library/matrix/shared/identity.rb +++ b/spec/ruby/library/matrix/shared/identity.rb @@ -1,9 +1,9 @@ -require File.expand_path('../../fixtures/classes', __FILE__) +require_relative '../fixtures/classes' require 'matrix' describe :matrix_identity, shared: true do it "returns a Matrix" do - Matrix.send(@method, 2).should be_kind_of(Matrix) + Matrix.send(@method, 2).should.is_a?(Matrix) end it "returns a n x n identity matrix" do @@ -13,7 +13,7 @@ describe :matrix_identity, shared: true do describe "for a subclass of Matrix" do it "returns an instance of that subclass" do - MatrixSub.send(@method, 2).should be_an_instance_of(MatrixSub) + MatrixSub.send(@method, 2).should.instance_of?(MatrixSub) end end end diff --git a/spec/ruby/library/matrix/shared/imaginary.rb b/spec/ruby/library/matrix/shared/imaginary.rb index 61a65a62ec..16615213a2 100644 --- a/spec/ruby/library/matrix/shared/imaginary.rb +++ b/spec/ruby/library/matrix/shared/imaginary.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../fixtures/classes', __FILE__) +require_relative '../fixtures/classes' require 'matrix' describe :matrix_imaginary, shared: true do @@ -14,7 +14,7 @@ describe :matrix_imaginary, shared: true do describe "for a subclass of Matrix" do it "returns an instance of that subclass" do - MatrixSub.ins.send(@method).should be_an_instance_of(MatrixSub) + MatrixSub.ins.send(@method).should.instance_of?(MatrixSub) end end end diff --git a/spec/ruby/library/matrix/shared/inverse.rb b/spec/ruby/library/matrix/shared/inverse.rb index c6996df4a3..ac463cf680 100644 --- a/spec/ruby/library/matrix/shared/inverse.rb +++ b/spec/ruby/library/matrix/shared/inverse.rb @@ -1,10 +1,10 @@ -require File.expand_path('../../fixtures/classes', __FILE__) +require_relative '../fixtures/classes' require 'matrix' describe :inverse, shared: true do it "returns a Matrix" do - Matrix[ [1,2], [2,1] ].send(@method).should be_an_instance_of(Matrix) + Matrix[ [1,2], [2,1] ].send(@method).should.instance_of?(Matrix) end it "returns the inverse of the Matrix" do @@ -25,14 +25,14 @@ describe :inverse, shared: true do end it "raises a ErrDimensionMismatch if the Matrix is not square" do - lambda{ + ->{ Matrix[ [1,2,3], [1,2,3] ].send(@method) - }.should raise_error(Matrix::ErrDimensionMismatch) + }.should.raise(Matrix::ErrDimensionMismatch) end describe "for a subclass of Matrix" do it "returns an instance of that subclass" do - MatrixSub.ins.send(@method).should be_an_instance_of(MatrixSub) + MatrixSub.ins.send(@method).should.instance_of?(MatrixSub) end end end diff --git a/spec/ruby/library/matrix/shared/rectangular.rb b/spec/ruby/library/matrix/shared/rectangular.rb index 4206311586..0229e614c6 100644 --- a/spec/ruby/library/matrix/shared/rectangular.rb +++ b/spec/ruby/library/matrix/shared/rectangular.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../fixtures/classes', __FILE__) +require_relative '../fixtures/classes' require 'matrix' describe :matrix_rectangular, shared: true do @@ -12,7 +12,7 @@ describe :matrix_rectangular, shared: true do describe "for a subclass of Matrix" do it "returns instances of that subclass" do - MatrixSub.ins.send(@method).each{|m| m.should be_an_instance_of(MatrixSub) } + MatrixSub.ins.send(@method).each{|m| m.should.instance_of?(MatrixSub) } end end end diff --git a/spec/ruby/library/matrix/shared/trace.rb b/spec/ruby/library/matrix/shared/trace.rb index 2a42839f5d..c4a5491b22 100644 --- a/spec/ruby/library/matrix/shared/trace.rb +++ b/spec/ruby/library/matrix/shared/trace.rb @@ -6,7 +6,7 @@ describe :trace, shared: true do end it "returns the sum of diagonal elements in a rectangular Matrix" do - lambda{ Matrix[[1,2,3], [4,5,6]].trace}.should raise_error(Matrix::ErrDimensionMismatch) + ->{ Matrix[[1,2,3], [4,5,6]].trace}.should.raise(Matrix::ErrDimensionMismatch) end end diff --git a/spec/ruby/library/matrix/shared/transpose.rb b/spec/ruby/library/matrix/shared/transpose.rb index dba6c71041..a0b495359b 100644 --- a/spec/ruby/library/matrix/shared/transpose.rb +++ b/spec/ruby/library/matrix/shared/transpose.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../fixtures/classes', __FILE__) +require_relative '../fixtures/classes' require 'matrix' describe :matrix_transpose, shared: true do @@ -13,7 +13,7 @@ describe :matrix_transpose, shared: true do describe "for a subclass of Matrix" do it "returns an instance of that subclass" do - MatrixSub.ins.send(@method).should be_an_instance_of(MatrixSub) + MatrixSub.ins.send(@method).should.instance_of?(MatrixSub) end end end |
