Sha256: ae264ebabf5ebb276db274d577b1e13d2a01e9b1e65e7ed0808d4370a889a919

Contents?: true

Size: 718 Bytes

Versions: 1

Compression:

Stored size: 718 Bytes

Contents

#calc_spec.rb
require 'spec_helper'
require './lib/calc'

describe Calc do
  before(:each) do
    @c = Calc::Calc.new
    @c.get [1, 2], 3
    @c.get [4, [5, 6], 7]

    @c_short = Calc::Calc.new
    @c_short.get 1
  end

  it "gets parameters" do
    @c.instance_variable_get("@numbers").should eql([1, 2, 3, 4, 5, 6, 7])
    @c_short.instance_variable_get("@numbers").should eql([1])
  end

  it "sums stack parameters and wipe them" do
    @c.plus.should == 28
    @c_short.plus.should == 1
    @c.instance_variable_get("@numbers").should == []
  end

  it "subsctract sum of stack from 0" do
    @c.minus.should == -28
    @c_short.minus.should == -1
    @c.instance_variable_get("@numbers").should == []
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
calc-nik-0.0.4 spec/calc_spec.rb