私は自分のプロジェクトをテストしようとしました。bundle exec rspec spec/
以前は機能していましたが、入力するたびに何をしたのかわかりませんcannot load such file -- capybara/rspec (LoadError)
。そして、初心者としてRuby on Railsで私のMVCをテストするのに適したアドバイスが必要です。
Gemfile:
------------
group :test do
# Pretty printed test output
gem 'turn', :require => false
gem 'minitest'
gem 'capybara', '1.1.2'
gem 'rb-inotify', '0.8.8'
gem 'libnotify', '0.5.9'
gem 'guard-spork', '0.3.2'
gem 'spork', '0.9.0'
gem 'spork-testunit'
gem 'guard-test'
gem 'ruby-prof'
gem 'factory_girl_rails', '1.4.0'
if RUBY_PLATFORM =~ /linux/
gem 'capybara-webkit'
end
gem 'launchy'
end
group :development, :test do
gem 'rspec-rails', '2.10.0'
gem 'guard-rspec', '0.5.5'
end
spec_helper:
require 'rubygems'
#require 'factory_girl'
#uncomment the following line to use spork with the debugger
#require 'spork/ext/ruby-debug'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rspec'
require 'capybara/rails'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
config.mock_with :rspec
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = false
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
#Capybara.default_driver = :selenium
Capybara.javascript_driver = :webkit
end
エラー:
/home/IN4SYSTEMS/sri.kalai/Desktop/gems/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- capybara/rspec (LoadError)
from /home/IN4SYSTEMS/sri.kalai/Desktop/gems/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `block in require'
from /home/IN4SYSTEMS/sri.kalai/Desktop/gems/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/IN4SYSTEMS/sri.kalai/Desktop/gems/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
from /home/IN4SYSTEMS/sri.kalai/Documents/promaster/spec/spec_helper.rb:11:in `<top (required)>'
from /home/IN4SYSTEMS/sri.kalai/Documents/promaster/spec/helpers/loc/epcs_helper_spec.rb:1:in `require'
from /home/IN4SYSTEMS/sri.kalai/Documents/promaster/spec/helpers/loc/epcs_helper_spec.rb:1:in `<top (required)>'
from /home/IN4SYSTEMS/sri.kalai/Desktop/gems/ruby/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `load'
from /home/IN4SYSTEMS/sri.kalai/Desktop/gems/ruby/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `block in load_spec_files'
from /home/IN4SYSTEMS/sri.kalai/Desktop/gems/ruby/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `map'
from /home/IN4SYSTEMS/sri.kalai/Desktop/gems/ruby/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `load_spec_files'
from /home/IN4SYSTEMS/sri.kalai/Desktop/gems/ruby/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:22:in `run'
from /home/IN4SYSTEMS/sri.kalai/Desktop/gems/ruby/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:66:in `rescue in run'
from /home/IN4SYSTEMS/sri.kalai/Desktop/gems/ruby/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:62:in `run'
from /home/IN4SYSTEMS/sri.kalai/Desktop/gems/ruby/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:10:in `block in autorun'
前もって感謝します!!!