In Rspec I have the following:
describe "triangle.parameter" do
it "should return nil when it has 0 sides" do
@triangle = Triangle.new({})
@triangle.paramater.should be_nil
end
end
And I have my parameter method like so:
def parameter
return 4
end
I’ve tried true, false, 4, “apple” for parameter to return and nothing will fail. I also can’t get it to fail with nothing in the method. What am I doing wrong?
You have
@triangle.paramaterinstead of@triangle.parameter; since it doesn’t know whatparamateris, it will always be nil.