summaryrefslogtreecommitdiff
path: root/spec/ruby/library/matrix/identity_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/matrix/identity_spec.rb')
-rw-r--r--spec/ruby/library/matrix/identity_spec.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/spec/ruby/library/matrix/identity_spec.rb b/spec/ruby/library/matrix/identity_spec.rb
index 646462bc47..afefd27565 100644
--- a/spec/ruby/library/matrix/identity_spec.rb
+++ b/spec/ruby/library/matrix/identity_spec.rb
@@ -1,6 +1,20 @@
require_relative '../../spec_helper'
-require_relative 'shared/identity'
+require_relative 'fixtures/classes'
+require 'matrix'
describe "Matrix.identity" do
- it_behaves_like :matrix_identity, :identity
+ it "returns a Matrix" do
+ Matrix.identity(2).should.is_a?(Matrix)
+ end
+
+ it "returns a n x n identity matrix" do
+ Matrix.identity(3).should == Matrix.scalar(3, 1)
+ Matrix.identity(100).should == Matrix.scalar(100, 1)
+ end
+
+ describe "for a subclass of Matrix" do
+ it "returns an instance of that subclass" do
+ MatrixSub.identity(2).should.instance_of?(MatrixSub)
+ end
+ end
end