这是我的功能测试:
require 'test_helper'
class PagesControllerTest < ActionController::TestCase
tests Refinery::PagesController
include Devise::TestHelpers
def setup
Rails.application.load_seed
end
test "about us page" do
assert_equal "about", Refinery::Page.find_by_slug("about").slug
get :show, { use_route: :about }
assert_response :success
end
end
这是我运行它时得到的:
$ rake test TEST=test/functional/pages_controller_test.rb
Run options:
# Running tests:
F
Finished tests in 3.709222s, 0.2696 tests/s, 0.8088 assertions/s.
1) Failure:
test_access_about_page(PagesControllerTest) [test/functional/pages_controller_test.rb:17]:
Expected response to be a <:success>, but was <404>
1 tests, 3 assertions, 1 failures, 0 errors, 0 skips
rake aborted!
我应该如何在我的测试中路由get
请求?