开发者

RailsTutorial Chapter 3 - I just cannot get my tests to pass

I'm working my way through the RailsTutorial book and have stalled in Chapter 3. I'm beginning to feel like I'm going insane!

The autogenerated tests for the 'home' and 'contact' pages work fine, but try as I might I cannot get my test for the 'about' page to pass. I have (and I tell no lie) created and the deleted the addional lines in the routes.rb file and the pages_controller.rb file and created the view file no fewer than 4 times just in case I had some strange non-printing characters. I must have checked my versions against the sample code from the book at least twice that many times!

I temporarily changed the 'about' test case into a second 'contact' test just to prove that the syntax of the test case is fine. It works OK.

To make matters worse, the 'about' page actually renders fine in the browser... I've just created another new page called 'landing' and I get the same failure.

It's like the autogenerated tests were sprinkled with fairy dust!

Has anybody experienced similar? I guessing that it's so开发者_Python百科mething glaringly obvious, but after 5 hours with no visible progress frustration has got the better of me...

I'm using Ubuntu 10.04, Ruby 1.9.2, Rails 3.0.3

RESOLVED An Issue with spork not reloading files


Sounds like you've been thorough. So this isn't working?

# pages_controller_spec.rb
describe "GET 'landing'" do
    it "should be successful" do
        get 'landing'
        response.should be_success
    end
end

# pages_controller.rb
def landing
end

# routes.rb
get "pages/landing"

# views/pages/landing.html.erb
blah
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜