我最近拿起了 page-object gem,但是当包含这个 gem 时,我无法让我的测试(基于 Cucumber/Selenium)运行。
根据 gem list,我安装了 gem:
page-object (0.9.1)
我的 env.rb 文件包括:
require 'page-object'
但是,当我尝试运行测试时,我收到以下错误:
/Library/Ruby/Gems/1.8/gems/page-object-0.9.1/lib/page-object/widgets.rb:32:语法错误,意外'=',期待'|' ...dget_tag do |name, identifier={:index => 0}, &block| ^ /Library/Ruby/Gems/1.8/gems/page-object-0.9.1/lib/page-object/widgets.rb:32:语法错误,意外',',期待kEND ...ame,标识符= { :index => 0}, &block| ^ /Library/Ruby/Gems/1.8/gems/page-object-0.9.1/lib/page-object/widgets.rb:122:语法错误,意外的 kEND,期待 $end (SyntaxError) /Library/Ruby/Site /1.8/rubygems/core_ext/kernel_require.rb:51:in
gem_original_require' /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:51:in
要求' /Library/Ruby/Gems/1.8/gems/page-object-0.9.1/lib/page-object.rb:10 />图书馆/Ruby/站点/1.8/rubygems/core_ext/kernel_require.rb:116:ingem_original_require' />Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:116:in
需要' /Users/garethbragg/dev/trade-finder/test/cucumber/features/support/env.rb:6 /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/ cucumber/rb_support/rb_language.rb:122:inload' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/rb_support/rb_language.rb:122:in
load_code_file' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime/support_code.rb:180:in load_filesload_file' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime/support_code.rb:83:in
! ' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime/support_code.rb:82:ineach' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime/support_code.rb:82:in
load_files!/Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime.rb:183:inload_step_definitions' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime.rb:42:in
run!/Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/cli/main.rb:47:inexecute!' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/cucumber:13 /usr/bin/cucumber:23:in
load' /usr/bin/cucumber:23
如果我在我的任何课程中包含 PageObject,我会收到以下信息:
未初始化的常量 Home::PageObject (NameError) ./lib/Home.rb:4 /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:51:in
gem_original_require' /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:51:in
require' /Users/garethbragg/dev/trade-finder /test/cucumber/features/support/env.rb:2 /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/rb_support/rb_language.rb:122:inload' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/rb_support/rb_language.rb:122:in
load_code_file ' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime/support_code.rb:180:inload_file' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime/support_code.rb:83:in
load_files!' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime/support_code.rb:82:ineach' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime/support_code.rb:82:in
load_files!/Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime.rb:183:inload_step_definitions' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime.rb:42:in
run!/Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/cli/main.rb:47:inexecute!' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/cucumber:13 /usr/bin/cucumber:23:in
load' /usr/bin/cucumber:23
任何建议将不胜感激。