Rails 4.1.12和路由

时间:2015-07-02 09:01:27

标签: ruby-on-rails rspec routes

我正在从Rails 4.1.8更新到4.1.12,并且一个规范因路由而失败:

   expected: "https://test.host/en/name-3/activities/3-activity-around-name-3/bookings/new?booking%5Bstart_date%5D=2015-07-03+08%3A38%3A39+UTC"
        got: "https://test.host/en/name-3/activities/3-activity-around-name-3/bookings/new.name-3?booking%5Bstart_date%5D=2015-07-03+08%3A38%3A39+UTC" (using ==)

配置/ routes.rb中:

get '*destination/activities/:id/bookings/new', to: 'bookings#new', as: :new_destination_activity_booking, constraints: DestinationConstraint.new

应用程序/控制器/公共/ bookings_controller.rb:

def new
  session[:traveler_return_to] = new_destination_activity_booking_url(@activity.destination, @activity, params)

规格/控制器/公共/ bookings_controller_spec.rb:

session[:traveler_return_to].should == new_destination_activity_booking_url(activity.destination, activity, booking: { start_date: start_date })

我在Rails控制台中测试了该路由并且它表现良好。它如何添加" .name-3"在规格?

0 个答案:

没有答案