[rspec-users] how to deal with redirect_to on cucumber?

Zhenning Guan lists at ruby-forum.com
Wed May 20 11:43:42 EDT 2009


I have a controller name forums and a action like this:
  def show
     redirect_to forum_topics_path(:forum_id => params[:id])
  end

my scenario is (not completed)
==========
Scenario: User input data correct
  When I run to the forum 1

--
When /^I run to the (.*)$/ do |topic_lists|
  visit path_to(topic_lists)
end

 def path_to(page_name)
    case page_name

    when /forum 1/
      forum_path(1)
==========

when I runned rake features
got a error..
++++++++++++++++
 Scenario: User input data correct # features/forums.feature:10
    When I run to the topic lists   #
features/step_definitions/forums_steps.rb:10
      Couldn't find Forum with ID=1 (ActiveRecord::RecordNotFound)
      /home/ning/blank/app/controllers/topics_controller.rb:71:in
`load_forum'
      /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
      (eval):2:in `/^I run to the (.*)$/'
      features/forums.feature:11:in `When I run to the topic lists'
++++++++++++++++++

so is that redirect_to problems? how to implement the scenario? any
thought here?
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list