51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2520|回复: 0
打印 上一主题 下一主题

用cucumber命令可以执行的ruby文件,用freeride运行总是报错

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2012-12-3 16:31:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 fengzhulin 于 2012-12-3 16:38 编辑

ruby和watir我都已经安装成功了,通过命令行程序执行如下代码是ok的
但是安装了freeride后,执行下面这个代码就会报错
  1. require  ‘rubygems’
  2. require  ‘watir’

  3. ie=Watir::IE.new
复制代码
报错内容如下:
d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- watir/loader (LoadError)
        from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from d:/ruby/lib/ruby/gems/1.8/gems/commonwatir-4.0.0/lib/watir.rb:1
        from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from D:/untitled1.rb:2

这是为何呢?请各位大侠指导一下。另外每次执行我新建的rb文件,都会自动执行附件图所示的文件并有报错,是不是跟这个文件有关系?是什么错误呢

custom_require.rb文件的代码如下。
  1. #--
  2. # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
  3. # All rights reserved.
  4. # See LICENSE.txt for permissions.
  5. #++

  6. require 'rubygems'

  7. module Kernel

  8.   ##
  9.   # The Kernel#require from before RubyGems was loaded.

  10.   alias gem_original_require require

  11.   ##
  12.   # When RubyGems is required, Kernel#require is replaced with our own which
  13.   # is capable of loading gems on demand.
  14.   #
  15.   # When you call <tt>require 'x'</tt>, this is what happens:
  16.   # * If the file can be loaded from the existing Ruby loadpath, it
  17.   #   is.
  18.   # * Otherwise, installed gems are searched for a file that matches.
  19.   #   If it's found in gem 'y', that gem is activated (added to the
  20.   #   loadpath).
  21.   #
  22.   # The normal <tt>require</tt> functionality of returning false if
  23.   # that file has already been loaded is preserved.

  24.   def require(path) # :doc:
  25.     gem_original_require path
  26.   rescue LoadError => load_error
  27.     if load_error.message =~ /#{Regexp.escape path}\z/ and
  28.        spec = Gem.searcher.find(path) then
  29.       Gem.activate(spec.name, "= #{spec.version}")
  30.       gem_original_require path
  31.     else
  32.       raise load_error
  33.     end
  34.   end

  35.   private :require
  36.   private :gem_original_require

  37. end

复制代码
还有一个问题:
为什么freeride里面我把1个文件关闭了,点击run之后,又会把我关闭了的那个文件执行一次呢。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-17 04:56 , Processed in 0.067722 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表