Ruby 初心者スレッド Part 28
■ このスレッドは過去ログ倉庫に格納されています
0125デフォルトの名無しさん
2009/05/21(木) 16:16:25しかし、NetBeansの "rspecテスト"からrspecを起動した場合だけテストに失敗してしまいます。
コマンドプロンプトから spec spec/hello_spec.rb では問題ないのですし、直接 ruby hello.rbでも問題ないです。
warningの文字列で、テストしているので起動時の "-w" をとれば成功するようになるのですが、
コマンドプロンプトからは -w をつけても問題ないのが気になります。
'my script should have no errors or warnings' FAILED
expected not: =~ /warning/n,
got: "(Rubyインストールディレクトリ)/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:138: warning: d:/my_home/.gem/ruby/1.8:(Rubyインストールディレクトリ)/lib/ruby/gems/1.8/specifications: Invalid argument\nHelloWorld\n"
./spec/hello_spec.rb:15:
./spec/hello_spec.rb:13:in `chdir'
./spec/hello_spec.rb:13:
hello_spec.rbのソース
require File.join(File.dirname(__FILE__), '/spec_helper.rb')
describe "my script" do
before do
@bin_path = File.join(File.dirname(__FILE__), "/../hello.rb")
end
it "should have no errors or warnings" do
pending "Hangs on JRuby" if PLATFORM =~ /java/
Dir.chdir(File.join(File.dirname(__FILE__), "/../")) do
output = `ruby -w #{@bin_path} --help 2>&1`
output.should_not =~ /warning/n
output.should_not =~ /Error/n
end
end
end
■ このスレッドは過去ログ倉庫に格納されています