Sha256: 64e5abdbbf75e87bc89080da995e5b5b8c8a972f396edf647ec3b154519feb88
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe Geometry::Triangle do let(:a) { 3} let(:b) { 4} let(:c) { 5} subject { Geometry::Triangle.new(a, b, c) } its(:a) { should eq 3} its(:b) { should eq 4} its(:c) { should eq 5} its(:perimeter) { should eq 12} its(:area) { should eq 6} its(:angles) { should eq [36.87, 53.13, 90.0]} # checks if the subject is an instance of the correct class it "should be an instance of geometry triangle" do subject.should be_an_instance_of Geometry::Triangle end end describe Geometry::Rectangle do let(:length) { 4} let(:width) { 6} subject { Geometry::Rectangle.new(length, width) } its(:length) { should eq 4} its(:width) { should eq 6} its(:area) { should eq 24} its(:perimeter) { should eq 20} end describe Geometry::Circle do let(:radius) { 3} subject { Geometry::Circle.new(radius) } its(:radius) { should eq 3} its(:circumference) { should eq 6 * Math::PI} its(:area) { should eq 9 * Math::PI} end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geometry-bgw-0.0.0 | spec/geometry-bgw_spec.rb |