Skip to content

Robert Wayne's submission for "RSpec Calculator" assignment#79

Open
robertjosephwayne wants to merge 10 commits into
vikingeducation:masterfrom
robertjosephwayne:master
Open

Robert Wayne's submission for "RSpec Calculator" assignment#79
robertjosephwayne wants to merge 10 commits into
vikingeducation:masterfrom
robertjosephwayne:master

Conversation

@robertjosephwayne

Copy link
Copy Markdown

No description provided.

Comment thread spec/calculator_spec.rb
# The add method properly adds numbers,
# whether positive or negative, integer or float.
describe "add" do

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create a common instance for Calculator and use it throughout the specs.
let(:c) { Calculator.new }

Comment thread spec/calculator_spec.rb
expect(Calculator.new.divide(-9, 4.0)).to be_within(0.1).of(-2.25)
end

it "raises an ArgumentError if the second argument is zero" do

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It raises an ArgumentError when second argument is less than 0

Comment thread spec/calculator_spec.rb
end

it "returns 2-digit decimals for non-round roots" do
expect(Calculator.new.sqrt(17)).to be_within(0.1).of(4.1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should return a result with 2 decimal places for non-round roots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants