Rail's Cucumber 中的类型错误运行功能
我正在尝试为我的 Rails 应用程序运行 Cucumber 并不断收到此错误:
> superclass mismatch for class Point (TypeError)
此错误有一个巨大的堆栈跟踪,但除了缺少需求之外,它没有指向任何特定内容。这是跟踪:
rake 功能(在 /Users/rob/blue/blue_web 中) /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I“/Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/lib:lib” “/Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/cucumber” --color --tags ~@wip --strict --format Pretty --drb 功能/manage_logins.feature 警告:没有 DRb 服务器正在运行。 本地运行功能:超类 类 Point 不匹配(TypeError) /Users/rob/blue/blue_web/app/models/point.rb:1 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
gem_original_require' /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
polyglot_original_require' /Users/rob/.gem/ruby/1.8/gems/polyglot-0.2.9/lib/polyglot.rb:70:in需要' /Users/rob/.gem/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependency.rb:158:in
需要' /Users/rob/.gem/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:265:inrequire_or_load' /Users/rob/.gem/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependency.rb:224:in
依赖” /Users/rob/.gem/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependency.rb:136:inrequire_dependency' /Users/rob/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:414:in
load_application_classes' /Users/rob/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:413:in每个' /Users/rob/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:413:in
load_application_classes' /Users/rob/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:411:in每个' /Users/rob/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:411:in
load_application_classes' /Users/rob/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:197:in进程' /Users/rob/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in 发送' /Users/rob/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in <代码>运行' /Users/rob/blue/blue_web/config/environment.rb:16 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
gem_original_require' /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:inpolyglot_original_require' /Users/rob/.gem/ruby/1.8/gems/polyglot-0.2.9/lib/polyglot.rb:70:in
需要'./features/support/env.rb:7 /Library/Ruby/Gems/1.8/gems/spork-0.7.2/lib/spork.rb:14:inprefork' ./features/support/env.rb:4 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
gem_original_require' /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:inpolyglot_original_require' /Users/rob/.gem/ruby/1.8/gems/polyglot-0.2.9/lib/polyglot.rb:70:in
需要' /Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/../lib/cucumber/rb_support/rb_language.rb:107:in加载代码文件' /Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/../lib/cucumber/rb_support/rb_language.rb:48:in
step_definitions_for' /Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/../lib/cucumber/step_mother.rb:90:in加载代码文件' /Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/../lib/cucumber/step_mother.rb:82:in
load_code_files' /Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/../lib/cucumber/step_mother.rb:81:in每个' /Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/../lib/cucumber/step_mother.rb:81:in
load_code_files' /Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/../lib/cucumber/cli/main.rb:46:in执行!' /Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/../lib/cucumber/cli/main.rb:24:in 执行' /Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/cucumber:9 耙子中止!命令失败 状态(1): [/System/Library/Frameworks/Ruby.framework/...]
I'm trying to run Cucumber for my Rails application and keep getting this error:
> superclass mismatch for class Point (TypeError)
There's a huge stack trace from this error, but it does not point to anything specific except a missing requirement. Here's the trace:
rake features (in /Users/rob/blue/blue_web)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
-I "/Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/lib:lib"
"/Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/cucumber"
--color --tags ~@wip --strict --format pretty --drb
features/manage_logins.feature
WARNING: No DRb server is running.
Running features locally: superclass
mismatch for class Point (TypeError)
/Users/rob/blue/blue_web/app/models/point.rb:1
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:ingem_original_require'
polyglot_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
/Users/rob/.gem/ruby/1.8/gems/polyglot-0.2.9/lib/polyglot.rb:70:inrequire'
require'
/Users/rob/.gem/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in
/Users/rob/.gem/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:265:inrequire_or_load'
depend_on'
/Users/rob/.gem/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:224:in
/Users/rob/.gem/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:136:inrequire_dependency'
load_application_classes'
/Users/rob/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:414:in
/Users/rob/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:413:ineach'
load_application_classes'
/Users/rob/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:413:in
/Users/rob/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:411:ineach'
load_application_classes'
/Users/rob/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:411:in
/Users/rob/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:197:inprocess'
send'
/Users/rob/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in
/Users/rob/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:113:inrun'
gem_original_require'
/Users/rob/blue/blue_web/config/environment.rb:16
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:inpolyglot_original_require'
require' ./features/support/env.rb:7
/Users/rob/.gem/ruby/1.8/gems/polyglot-0.2.9/lib/polyglot.rb:70:in
/Library/Ruby/Gems/1.8/gems/spork-0.7.2/lib/spork.rb:14:inprefork' ./features/support/env.rb:4
gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:inpolyglot_original_require'
require'
/Users/rob/.gem/ruby/1.8/gems/polyglot-0.2.9/lib/polyglot.rb:70:in
/Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/../lib/cucumber/rb_support/rb_language.rb:107:inload_code_file'
step_definitions_for'
/Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/../lib/cucumber/rb_support/rb_language.rb:48:in
/Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/../lib/cucumber/step_mother.rb:90:inload_code_file'
load_code_files'
/Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/../lib/cucumber/step_mother.rb:82:in
/Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/../lib/cucumber/step_mother.rb:81:ineach'
load_code_files'
/Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/../lib/cucumber/step_mother.rb:81:in
/Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/../lib/cucumber/cli/main.rb:46:inexecute!'
execute'
/Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/../lib/cucumber/cli/main.rb:24:in
/Users/rob/.gem/ruby/1.8/gems/cucumber-0.3.102/bin/cucumber:9
rake aborted! Command failed with
status (1):
[/System/Library/Frameworks/Ruby.framework/...]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了这个问题的答案,它是类名与 mySQL geoSpatial 插件和我的架构冲突。
我上了一堂名为 Point 的课,一切都很开心。然后我添加了(非常酷的)geoSpatial 插件来使用 mySQL 的地理索引功能。该插件还定义了一个Point 类。
冲突导致 Cucumber 失败。
如果您在自己的应用程序中看到此错误,请查找重复的错误!
I found the answer to this problem, it was a class name conflict with the mySQL geoSpatial plug-in and my schema.
I had a class named Point and everything was happy. Then I added (the very cool) geoSpatial plug-in to use mySQL's geo index features. This plug-in also defines a Point class.
The conflict was causing Cucumber to fail.
If you are seeing this error in your own application, look for duplicates!