deviseでパフォーマンステストを実行するにはどうすればよいですか。 Functional testing with Rails and Devise. What to put in my fixtures?から私のtest_helper.rbdevise認証によるパフォーマンステスト
class ActionController::TestCase
include Devise::TestHelpers
end
に私はこれを持って考案のドキュメントを使用して、私は私の性能試験でこれを持っている:
require 'test_helper'
require 'rails/performance_test_help'
class EditorTest < ActionDispatch::PerformanceTest
def test_create
@user = users(:one)
sign_in @user
get 'documents/new/1'
end
end
私は、取得するには、次のエラー
NoMethodError: undefined method `sign_in' for #<EditorTest:0xb6bc0654 ...>
/test/performance/editor_test.rb:9:in `test_create'
方法Devise TestHelpersをパフォーマンステストに適切に含めるにはどうすればよいですか?
ありがとうございました!
[編集]
これは機能テストとして機能します。
/usr/lib/ruby/gems/1.8/gems/devise-1.1.rc2/lib/devise/test_helpers.rb: 53: warning: instance variable @request not initialized Exception `NoMethodError' at /usr/lib/ruby/gems/1.8/gems/ activesupport-3.0.3/lib/active_support/whiny_nil.rb:48 - undefined method `env' for nil:NilClass EEditorTest#test_create (0 ms warmup) /usr/lib/ruby/gems/1.8/gems/devise-1.1.rc2/lib/devise/test_helpers.rb: 53: warning: instance variable @request not initialized Exception `NoMethodError' at /usr/lib/ruby/gems/1.8/gems/ activesupport-3.0.3/lib/active_support/whiny_nil.rb:48 - undefined method `env' for nil:NilClass E process_time: 0 ms Exception `Errno::EEXIST' at /usr/lib/ruby/1.8/fileutils.rb:243 -
File exists - tmp/performance Exception
Errno::EEXIST' at /usr/lib/ruby/1.8/fileutils.rb:243 - File exists - tmp/performance Exception
Errno::EEXIST' at /usr/lib/ruby/1.8/fileutils.rb:243 - File exists - tmp/performance
の短いバージョン:
[編集]
ActionDispatch :: PerformanceTestで工夫ヘルパーを含むとルビー-dを使用してテストを実行した後、ここでのデバッグ出力の底があります上記のエラー:
NoMethodError: undefined method `env' for nil:NilClass
デビッドとホセありがとう! – joshs