Ruby on rails,NoMethodError:未定义的方法`include&#39; for#&lt;#<class:on =“”all =“”tests =“”

时间:2016-05-14 04:45:24

标签: ruby-on-rails ruby testing

=“”

每个测试都会返回错误状态以下消息:

NoMethodError: undefined method `include' for #<#<Class:0x60fd1e8>:0x60fd158>

每个模块的每个测试都以这种方式失败,但应用程序按预期运行,没有问题

测试在一台计算机上运行,​​但不在另一台计算机上运行(分别是Windows 7和10)

Ruby / Rails版本:

ruby 2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32]
Rails 4.2.5.1

这是一个有问题的最小测试:

test "passes" do
  assert true
end

返回:

SessionControllerTest#test_passes:
NoMethodError: undefined method `include' for #<#<Class:0x45b5c20>:0x45b5a28>

这是一个完整的堆栈跟踪:

NoMethodError: undefined method `include' for #<#<Class:0x5cd6810>:0x5cd6768>
    (erb):7:in `get_binding'
    C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/erb.rb:863:in `eval'
    C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/erb.rb:863:in `result'
    activerecord (4.2.5.1) lib/active_record/fixture_set/file.rb:42:in `render'
    activerecord (4.2.5.1) lib/active_record/fixture_set/file.rb:33:in `rows'
    activerecord (4.2.5.1) lib/active_record/fixture_set/file.rb:24:in `each'
    activerecord (4.2.5.1) lib/active_record/fixtures.rb:760:in `block (2 levels) in read_fixture_files'
    activerecord (4.2.5.1) lib/active_record/fixture_set/file.rb:15:in `open'
    activerecord (4.2.5.1) lib/active_record/fixtures.rb:759:in `block in read_fixture_files'
    activerecord (4.2.5.1) lib/active_record/fixtures.rb:758:in `each'
    activerecord (4.2.5.1) lib/active_record/fixtures.rb:758:in `each_with_object'
    activerecord (4.2.5.1) lib/active_record/fixtures.rb:758:in `read_fixture_files'
    activerecord (4.2.5.1) lib/active_record/fixtures.rb:590:in `initialize'
    activerecord (4.2.5.1) lib/active_record/fixtures.rb:514:in `new'
    activerecord (4.2.5.1) lib/active_record/fixtures.rb:514:in `block (2 levels) in create_fixtures'
    activerecord (4.2.5.1) lib/active_record/fixtures.rb:511:in `map'
    activerecord (4.2.5.1) lib/active_record/fixtures.rb:511:in `block in create_fixtures'
    activerecord (4.2.5.1) lib/active_record/connection_adapters/abstract_mysql_adapter.rb:288:in `disable_referential_integrity'
    activerecord (4.2.5.1) lib/active_record/fixtures.rb:508:in `create_fixtures'
    activerecord (4.2.5.1) lib/active_record/fixtures.rb:979:in `load_fixtures'
    activerecord (4.2.5.1) lib/active_record/fixtures.rb:941:in `setup_fixtures'
    activerecord (4.2.5.1) lib/active_record/fixtures.rb:826:in `before_setup'
    minitest (5.8.4) lib/minitest/test.rb:106:in `block (3 levels) in run'
    minitest (5.8.4) lib/minitest/test.rb:205:in `capture_exceptions'
    minitest (5.8.4) lib/minitest/test.rb:105:in `block (2 levels) in run'
    minitest (5.8.4) lib/minitest/test.rb:256:in `time_it'
    minitest (5.8.4) lib/minitest/test.rb:104:in `block in run'
    minitest (5.8.4) lib/minitest.rb:331:in `on_signal'
    minitest (5.8.4) lib/minitest/test.rb:276:in `with_info_handler'
    minitest (5.8.4) lib/minitest/test.rb:103:in `run'
    minitest (5.8.4) lib/minitest.rb:778:in `run_one_method'
    minitest (5.8.4) lib/minitest.rb:305:in `run_one_method'
    minitest (5.8.4) lib/minitest.rb:293:in `block (2 levels) in run'
    minitest (5.8.4) lib/minitest.rb:292:in `each'
    minitest (5.8.4) lib/minitest.rb:292:in `block in run'
    minitest (5.8.4) lib/minitest.rb:331:in `on_signal'
    minitest (5.8.4) lib/minitest.rb:318:in `with_info_handler'
    minitest (5.8.4) lib/minitest.rb:291:in `run'
    minitest (5.8.4) lib/minitest.rb:152:in `block in __run'
    minitest (5.8.4) lib/minitest.rb:152:in `map'
    minitest (5.8.4) lib/minitest.rb:152:in `__run'
    minitest (5.8.4) lib/minitest.rb:129:in `run'
    minitest (5.8.4) lib/minitest.rb:56:in `block in autorun'

0 个答案:

没有答案