Expected response to be a <:success>,but was <500>

Hi,Man
I write some integration test,like follow

require "#{File.dirname(__FILE__)}/../test_helper"

class BrowsingAndSearchingTest < ActionController::IntegrationTest
  fixtures :publishers, :authors, :books, :authors_books

  def test_browsing_the_site
    jill = enter_site(:jill)
    jill.browse_index
  end

  private

  module BrowsingTestDSL
     attr_writer :name

     def browse_index
      get "/catalog"

      assert_response :success
      assert_template  "catalog/index"
      assert_tag  :tag => "dl", :attributes =>
                                { :id => "books"},
                      :children =>
                                 { :count => 10, :only =>
                                  {:tag => "dt"}}
      assert_tag :tag => "dt", :content => "The Idiot"
     end
   end

 def enter_site(name)
  open_session do |session|
    session.extend(BrowsingTestDSL)
    session.name = name
    yield seesion if block_given?
    end

 end

 end

but when i run the integration test,it go wrong,the wrong information
was

Am I missing something ?

was

Am I missing something ?

what is output in test log file?

you can try this on console

follow the steps

1)go to console (ruby script/console)
2)app.get “/catalog”

see what response you get

500

On Mon, Aug 31, 2009 at 2:40 PM, Nik C.
[email protected]wrote:

you can try this on console


Sons of Gondor, of Rohan, my brothers!
I see in your eyes the same fear that would take the heart of me.
A day may come when the courage of men fails when we forsake our friends
and
break all bonds of fellowship.
But this is not this day.
And hour of wolves and shattered shields when the age of Men comes
crashing
down. But this is not this day!
This day we fight! By all that you hold dear on this good earth, I bid
you
stand! Men of the West!

2009/8/31 fireflyman [email protected]:

Am I missing something ?

what is output in test log file?

You did not answer this question (look in log/test.log after running
test). If you delete the file before running the test you will start
with an empty file, obviously.

Colin

On Mon, Aug 31, 2009 at 6:00 PM, Colin L. [email protected]
wrote:

[quote]
Colin


and


Sons of Gondor, of Rohan, my brothers!
I see in your eyes the same fear that would take the heart of me.
A day may come when the courage of men fails when we forsake our friends
and
break all bonds of fellowship.
But this is not this day.
And hour of wolves and shattered shields when the age of Men comes
crashing
down. But this is not this day!
This day we fight! By all that you hold dear on this good earth, I bid
you
stand! Men of the West!

Session ID: 6efd9f650c0eb779f4726c3b5b0c609c
Parameters: {}

ActionController::RoutingError (No route matches “/catalog” with
{:method=>:get}):

C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/routing.rb:1441:in
`recognize_path’

C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/routing.rb:1424:in
`recognize’

C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:170:in
`handle_request’

C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in
`dispatch’

C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in
`dispatch_cgi’

C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in
`dispatch’

C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/integration.rb:279:in
`process’

C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/integration.rb:172:in
get' test/integration/browsing_and_searching_test.rb:17:inbrowse_index’
test/integration/browsing_and_searching_test.rb:8:in
test_browsing_the_site' C:/Ruby/lib/ruby/1.8/test/unit/testcase.rb:78:insend
C:/Ruby/lib/ruby/1.8/test/unit/testcase.rb:78:in `run’

C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/integration.rb:547:in
run' C:/Ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:inrun’
C:/Ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in each' C:/Ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:inrun’
C:/Ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in run' C:/Ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:ineach’
C:/Ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in run' C:/Ruby/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:inrun_suite’
C:/Ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in
start_mediator' C:/Ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:instart’
C:/Ruby/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in run' C:/Ruby/lib/ruby/1.8/test/unit/autorunner.rb:216:inrun’
C:/Ruby/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run’
C:/Ruby/lib/ruby/1.8/test/unit.rb:278
test/integration/browsing_and_searching_test.rb:30

Rendering
C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/templates/rescues/layout.erb
(not_found)

On Mon, Aug 31, 2009 at 6:17 PM, fireflyman [email protected]
wrote:

wrote:
You did not answer this question (look in log/test.log after running

1)go to console (ruby script/console)

you


Sons of Gondor, of Rohan, my brothers!
I see in your eyes the same fear that would take the heart of me.
A day may come when the courage of men fails when we forsake our friends
and
break all bonds of fellowship.
But this is not this day.
And hour of wolves and shattered shields when the age of Men comes
crashing
down. But this is not this day!
This day we fight! By all that you hold dear on this good earth, I bid
you
stand! Men of the West!

fireflyman wrote:

Session ID: 6efd9f650c0eb779f4726c3b5b0c609c
Parameters: {}

ActionController::RoutingError (No route matches “/catalog” with
{:method=>:get}):

Rendering
C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/templates/rescues/layout.erb
(not_found)

ActionController::RoutingError (No route matches “/catalog” with
{:method=>:get}):

clearly above line indicated that you don’t have route for the method
and
app.get “/catalog”
gives 500 indicates you dont have url like this
www.yourdomain.com/catalog
(No route matches “/catalog” with {:method=>:get}):

2009/8/31 fireflyman [email protected]:

Session ID: 6efd9f650c0eb779f4726c3b5b0c609c
 Parameters: {}

ActionController::RoutingError (No route matches “/catalog” with
{:method=>:get}):

Well there you are then. No one has asked the obvious question, as it
is too obvious to require asking, what happens if you run your server
and go to /catalog?

Colin

So,What should I do ?I’m a fresher.

On Mon, Aug 31, 2009 at 6:46 PM, Nik C.
[email protected]wrote:

Rendering
and


Posted via http://www.ruby-forum.com/.


Sons of Gondor, of Rohan, my brothers!
I see in your eyes the same fear that would take the heart of me.
A day may come when the courage of men fails when we forsake our friends
and
break all bonds of fellowship.
But this is not this day.
And hour of wolves and shattered shields when the age of Men comes
crashing
down. But this is not this day!
This day we fight! By all that you hold dear on this good earth, I bid
you
stand! Men of the West!

fireflyman wrote:

So,What should I do ?I’m a fresher.

go to

http://guides.rubyonrails.org/testing.html
http://6brand.com/rails-integration-testing-how-to-learn.html

read about rails integration testing

do

rake routes
you will get all the routes in your application
then perform integration testing

Thanks so much ! You are good [email protected]

On Tue, Sep 1, 2009 at 12:55 PM, Nik C.
[email protected]wrote:

read about rails integration testing


Sons of Gondor, of Rohan, my brothers!
I see in your eyes the same fear that would take the heart of me.
A day may come when the courage of men fails when we forsake our friends
and
break all bonds of fellowship.
But this is not this day.
And hour of wolves and shattered shields when the age of Men comes
crashing
down. But this is not this day!
This day we fight! By all that you hold dear on this good earth, I bid
you
stand! Men of the West!

2009/9/1 fireflyman [email protected]:

Also work through the getting starting guide if you have not already
done so. I would suggest actually working through it as a tutorial
rather than just reading it.

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs