diff options
Diffstat (limited to 'spec/ruby/library/matrix/vector')
| -rw-r--r-- | spec/ruby/library/matrix/vector/cross_product_spec.rb | 6 | ||||
| -rw-r--r-- | spec/ruby/library/matrix/vector/each2_spec.rb | 14 | ||||
| -rw-r--r-- | spec/ruby/library/matrix/vector/eql_spec.rb | 6 | ||||
| -rw-r--r-- | spec/ruby/library/matrix/vector/inner_product_spec.rb | 6 | ||||
| -rw-r--r-- | spec/ruby/library/matrix/vector/normalize_spec.rb | 10 |
5 files changed, 21 insertions, 21 deletions
diff --git a/spec/ruby/library/matrix/vector/cross_product_spec.rb b/spec/ruby/library/matrix/vector/cross_product_spec.rb index f26cf585da..96a462c067 100644 --- a/spec/ruby/library/matrix/vector/cross_product_spec.rb +++ b/spec/ruby/library/matrix/vector/cross_product_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../../../spec_helper', __FILE__) +require_relative '../../../spec_helper' require 'matrix' describe "Vector#cross_product" do @@ -7,8 +7,8 @@ describe "Vector#cross_product" do end it "raises an error unless both vectors have dimension 3" do - lambda { + -> { Vector[1, 2, 3].cross_product(Vector[0, -4]) - }.should raise_error(Vector::ErrDimensionMismatch) + }.should.raise(Vector::ErrDimensionMismatch) end end diff --git a/spec/ruby/library/matrix/vector/each2_spec.rb b/spec/ruby/library/matrix/vector/each2_spec.rb index e9d89e21c4..86e7ed75aa 100644 --- a/spec/ruby/library/matrix/vector/each2_spec.rb +++ b/spec/ruby/library/matrix/vector/each2_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../../../spec_helper', __FILE__) +require_relative '../../../spec_helper' require 'matrix' describe "Vector.each2" do @@ -8,8 +8,8 @@ describe "Vector.each2" do end it "requires one argument" do - lambda { @v.each2(@v2, @v2){} }.should raise_error(ArgumentError) - lambda { @v.each2(){} }.should raise_error(ArgumentError) + -> { @v.each2(@v2, @v2){} }.should.raise(ArgumentError) + -> { @v.each2(){} }.should.raise(ArgumentError) end describe "given one argument" do @@ -20,8 +20,8 @@ describe "Vector.each2" do end it "raises a DimensionMismatch error if the Vector size is different" do - lambda { @v.each2(Vector[1,2]){} }.should raise_error(Vector::ErrDimensionMismatch) - lambda { @v.each2(Vector[1,2,3,4]){} }.should raise_error(Vector::ErrDimensionMismatch) + -> { @v.each2(Vector[1,2]){} }.should.raise(Vector::ErrDimensionMismatch) + -> { @v.each2(Vector[1,2,3,4]){} }.should.raise(Vector::ErrDimensionMismatch) end it "yields arguments in sequence" do @@ -37,12 +37,12 @@ describe "Vector.each2" do end it "returns self when given a block" do - @v.each2(@v2){}.should equal(@v) + @v.each2(@v2){}.should.equal?(@v) end it "returns an enumerator if no block given" do enum = @v.each2(@v2) - enum.should be_an_instance_of(Enumerator) + enum.should.instance_of?(Enumerator) enum.to_a.should == [[1, 4], [2, 5], [3, 6]] end end diff --git a/spec/ruby/library/matrix/vector/eql_spec.rb b/spec/ruby/library/matrix/vector/eql_spec.rb index 6cc69bbf7d..6e2cd47b8e 100644 --- a/spec/ruby/library/matrix/vector/eql_spec.rb +++ b/spec/ruby/library/matrix/vector/eql_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../../../spec_helper', __FILE__) +require_relative '../../../spec_helper' require 'matrix' describe "Vector#eql?" do @@ -7,10 +7,10 @@ describe "Vector#eql?" do end it "returns true for self" do - @vector.eql?(@vector).should be_true + @vector.eql?(@vector).should == true end it "returns false when there are a pair corresponding elements which are not equal in the sense of Kernel#eql?" do - @vector.eql?(Vector[1, 2, 3, 4, 5.0]).should be_false + @vector.eql?(Vector[1, 2, 3, 4, 5.0]).should == false end end diff --git a/spec/ruby/library/matrix/vector/inner_product_spec.rb b/spec/ruby/library/matrix/vector/inner_product_spec.rb index a953598b51..79dee10833 100644 --- a/spec/ruby/library/matrix/vector/inner_product_spec.rb +++ b/spec/ruby/library/matrix/vector/inner_product_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../../../spec_helper', __FILE__) +require_relative '../../../spec_helper' require 'matrix' describe "Vector#inner_product" do @@ -11,9 +11,9 @@ describe "Vector#inner_product" do end it "raises an error for mismatched vectors" do - lambda { + -> { Vector[1, 2, 3].inner_product(Vector[0, -4]) - }.should raise_error(Vector::ErrDimensionMismatch) + }.should.raise(Vector::ErrDimensionMismatch) end it "uses the conjugate of its argument" do diff --git a/spec/ruby/library/matrix/vector/normalize_spec.rb b/spec/ruby/library/matrix/vector/normalize_spec.rb index 14aac1f5e3..bb1f046786 100644 --- a/spec/ruby/library/matrix/vector/normalize_spec.rb +++ b/spec/ruby/library/matrix/vector/normalize_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../../../spec_helper', __FILE__) +require_relative '../../../spec_helper' require 'matrix' describe "Vector#normalize" do @@ -8,11 +8,11 @@ describe "Vector#normalize" do end it "raises an error for zero vectors" do - lambda { + -> { Vector[].normalize - }.should raise_error(Vector::ZeroVectorError) - lambda { + }.should.raise(Vector::ZeroVectorError) + -> { Vector[0, 0, 0].normalize - }.should raise_error(Vector::ZeroVectorError) + }.should.raise(Vector::ZeroVectorError) end end |
