1

最近、page-object gem を入手しましたが、この gem が含まれていると (Cucumber/Selenium に基づく) テストを実行できませんでした。

gem リストによると、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、identifier={ :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:require gem_original_require' /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:51:in' /ライブラリ/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:inrequire' /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:in load' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/rb_support/rb_language.rb:122:inload_code_file' load_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:180:load_files! ' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime/support_code.rb:82:in each' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime/support_code.rb:82:inload_files!' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime.rb:183 load_step_definitions' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime.rb:42:in:実行中!' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/cli/main.rb:47:in execute!' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/cucumber:13 /usr/bin/cucumber:23:inload' /usr/bin/cucumber:23

クラスのいずれかに PageObject を含めると、次のようになります。

初期化されていない定数 Home::PageObject (NameError) ./lib/Home.rb:4 /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:51:require gem_original_require' /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:51:in' /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:in load' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/rb_support/rb_language.rb:122:inload_code_file ' load_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:180:in load_files!' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime/support_code.rb:82:in each' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime/support_code.rb:82:inload_files!' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime.rb:183 load_step_definitions' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/runtime.rb:42:in:実行中!' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/../lib/cucumber/cli/main.rb:47:in execute!' /Library/Ruby/Gems/1.8/gems/cucumber-1.3.5/bin/cucumber:13 /usr/bin/cucumber:23:inload' /usr/bin/cucumber:23

任意の提案をいただければ幸いです。

4

2 に答える 2

1

エラーはRuby 1.8を使用しているためだと思います。1.9以降で試してみませんか?

于 2013-08-10T12:19:50.783 に答える