Hrm.

I have a spec for a model 'Phase'. a Phase has a start and end date, and a method 'percentage_complete' that calculates the percentage of time that has already elapsed between said start and end dates.

This spec passes as expected:

module PhaseHelper
  def valid_attributes
    {
      :start_date => Date.today - 5.days,
      :end_date => Date.tomorrow
    }
  end
end

describe Phase do

  include PhaseHelper

  before(:each) do
    @phase = Phase.new(valid_attributes)
  end

  it "should know how to generate the percentage_complete attribute" do
    @phase.percentage_complete.should == 83
  end



However, when I run 'rake spec:models', the spec fails:

'Phase should know how to generate the percentage_complete attribute' FAILED
expected: 83,
     got: 100 (using ==)


RSpec and rspec_on_rails are current from GitHub (RSpec gem has been reinstalled from source)
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to