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

David Chelimsky dchelimsky at gmail.com
Fri Jun 12 01:39:15 EDT 2009


On Thu, Jun 11, 2009 at 10:36 PM, powertoaster<powertoaster at hotmail.com> wrote:
>
> I see June 13, 2009 on my index page when running in development.
>
> I get this
> 2.
> <false> is not true.

This is not an rspec failure message. What other gems do you have at play?

Also, what versions of rspec, rspec-rails, ruby, rails, OS, etc?

http://wiki.github.com/dchelimsky/rspec/get-in-touch

>
> 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.
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list