[rspec-users] I am having a problem testing a date in a rails view

powertoaster powertoaster at hotmail.com
Thu Jun 11 23:36:28 EDT 2009


I see June 13, 2009 on my index page when running in development.

I get this
2.
<false> is not true.

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe "/timesheets/index.html.erb" do
  include TimesheetsHelper

  before(:each) do
    assigns[:timesheets] = [
            stub_model(Timesheets,
                       :tsdate => Date.parse('2009-6-13'),
                       :off => false,
                       :vacation => 9.99,
                       :holiday => 9.99,
                       :closed => false,
                       :comment => "value for comment",
                       :admin_comment => "value for admin_comment",
                       :approved => false
            ),
            stub_model(Timesheets,
                       :tsdate => Date.parse('2009-6-13'),
                       :off => false,
                       :vacation => 9.99,
                       :holiday => 9.99,
                       :closed => false,
                       :comment => "value for comment",
                       :admin_comment => "value for admin_comment",
                       :approved => false
            )
    ]
  end

  it "renders a list of timesheets" do
    render
    response.should have_tag("tr>td", "2009-06-13".to_s, 2) <++++++++ This
where it fails +++++>
    response.should have_tag("tr>td", false.to_s, 2)
    response.should have_tag("tr>td", 9.99.to_s, 2)
    response.should have_tag("tr>td", 9.99.to_s, 2)
    response.should have_tag("tr>td", false.to_s, 2)
    response.should have_tag("tr>td", "value for comment".to_s, 2)
    response.should have_tag("tr>td", "value for admin_comment".to_s, 2)
    response.should have_tag("tr>td", false.to_s, 2)
  end
end

-- 
View this message in context: http://www.nabble.com/I-am-having-a-problem-testing-a-date-in-a-rails-view-tp23992350p23992350.html
Sent from the rspec-users mailing list archive at Nabble.com.



More information about the rspec-users mailing list