2013-07-02 81 views
9

khi tôi chạy thử nghiệm rspec trong ruby ​​của tôi trên ứng dụng đường ray ..kiểm tra RSpec trong ruby ​​trên đường ray, không thể tải như tập tin webmock/rspec

[email protected]:~/gitlab$ sudo bundle exec rspec spec/controllers/public_spec.rb 
No DRb server is running. Running in local process instead ... 
/usr/local/lib/ruby/gems/1.9.1/bundler/gems/gollum-5dcd3c8c8f68/lib/gollum/markup.rb:222: warning: already initialized constant PREFORMATTED_TAGS 
/usr/local/lib/ruby/gems/1.9.1/bundler/gems/gollum-5dcd3c8c8f68/lib/gollum/markup.rb:685: warning: already initialized constant MarkupGFM 
/usr/local/lib/ruby/gems/1.9.1/bundler/gems/gollum-5dcd3c8c8f68/lib/gollum/sanitization.rb:9: warning: already initialized constant ELEMENTS 
/usr/local/lib/ruby/gems/1.9.1/bundler/gems/gollum-5dcd3c8c8f68/lib/gollum/sanitization.rb:23: warning: already initialized constant ATTRIBUTES 
/usr/local/lib/ruby/gems/1.9.1/bundler/gems/gollum-5dcd3c8c8f68/lib/gollum/sanitization.rb:46: warning: already initialized constant PROTOCOLS 
/usr/local/lib/ruby/gems/1.9.1/bundler/gems/gollum-5dcd3c8c8f68/lib/gollum/sanitization.rb:52: warning: already initialized constant ADD_ATTRIBUTES 
/usr/local/lib/ruby/gems/1.9.1/bundler/gems/gollum-5dcd3c8c8f68/lib/gollum/sanitization.rb:62: warning: already initialized constant REMOVE_CONTENTS 
/usr/local/lib/ruby/gems/1.9.1/bundler/gems/gollum-5dcd3c8c8f68/lib/gollum/sanitization.rb:68: warning: already initialized constant TRANSFORMERS 
/usr/local/lib/ruby/gems/1.9.1/bundler/gems/gollum-5dcd3c8c8f68/lib/gollum/web_sequence_diagram.rb:7: warning: already initialized constant WSD_URL 
/usr/local/lib/ruby/gems/1.9.1/bundler/gems/gollum-5dcd3c8c8f68/lib/gollum.rb:32: warning: already initialized constant VERSION 
MiniTest::Unit::TestCase is now Minitest::Test. From /usr/local/lib/ruby/1.9.1/test/unit/testcase.rb:8:in `<module:Unit>' 
MiniTest::Unit::TestCase is now Minitest::Test. From /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/test_case.rb:12:in `<module:ActiveSupport>' 
MiniTest::Unit::TestCase is now Minitest::Test. From /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/descendants_tracker.rb:34:in `inherited' 
MiniTest::Unit::TestCase is now Minitest::Test. From /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/descendants_tracker.rb:34:in `inherited' 
MiniTest::Unit::TestCase is now Minitest::Test. From /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/descendants_tracker.rb:34:in `inherited' 
MiniTest::Unit::TestCase is now Minitest::Test. From /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/descendants_tracker.rb:34:in `inherited' 
MiniTest::Unit::TestCase is now Minitest::Test. From /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/descendants_tracker.rb:34:in `inherited' 
/usr/local/lib/ruby/gems/1.9.1/gems/backports-3.3.3/lib/backports/tools.rb:328:in `require': cannot load such file -- webmock/rspec (LoadError) 
    from /usr/local/lib/ruby/gems/1.9.1/gems/backports-3.3.3/lib/backports/tools.rb:328:in `require_with_backports' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' 
    from /home/git/gitlab/spec/spec_helper.rb:18:in `block in <top (required)>' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc2/lib/spork.rb:24:in `prefork' 
    from /home/git/gitlab/spec/spec_helper.rb:4:in `<top (required)>' 
    from /home/git/gitlab/spec/controllers/public_spec.rb:2:in `require' 
    from /home/git/gitlab/spec/controllers/public_spec.rb:2:in `<top (required)>' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb:789:in `load' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb:789:in `block in load_spec_files' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb:789:in `each' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb:789:in `load_spec_files' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.12.2/lib/rspec/core/command_line.rb:22:in `run' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:77:in `rescue in run' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:73:in `run' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:17:in `block in autorun' 
Coverage report generated for RSpec to /home/git/gitlab/coverage. 2055/5187 LOC (39.62%) covered. 

Đây là Gemfile tôi:

gem 'coveralls', require: false 
    gem 'rails-dev-tweaks' 
    gem 'spinach-rails', '0.2.0' 
    gem "rspec-rails", '2.12.2' 
    gem "capybara", '2.0.2' 
    gem "pry" 
    gem "awesome_print" 
    gem "database_cleaner" 
-- 
    # Generate Fake data 
    gem "ffaker" 

    # Guard 
    gem 'guard-rspec' 
    gem 'guard-spinach' 

    # Notification 
    gem 'rb-fsevent', require: darwin_only('rb-fsevent') 

tôi chắc chắn rằng Gemfile của tôi có chứa rspec-ray. Và lệnh này cũng hoạt động tốt:

ruby -e 'require "webmock/rspec"' 

Tôi nghi ngờ rằng có điều gì đó không ổn với gói của tôi.

Nhưng khi tôi kiểm tra nhóm của mình.

more /usr/local/bin/bundle 

tôi thấy:

#!/usr/local/bin/ruby 

Điều này có nghĩa bó đang sử dụng ruby ​​giống như tôi thử nghiệm.

Dưới đây là phiên bản ruby ​​Tôi đang sử dụng:

ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux] 

Trả lời

12

đưa dòng này trong GemFile bạn

gem 'webmock' 

và sau đó làm bó cài đặt.

+0

Cảm ơn bạn. Nó được thực hiện .. mặc dù một chút thời gian .. – Qinghao

0

bạn có thể sử dụng gem 'webmock'. Xem wiki của nó.