我需要换个房间
Rakefile
:
require 'rspec/core/rake_task'
task :default => :spec
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = "spec/**/*_spec.rb"
end
我还需要改变
spec/spec_helper.rb
# added
require 'rubygems'
require 'bundler/setup'
# existing
require 'rack/test'
require 'rspec'
require File.expand_path '../../app.rb', __FILE__
RSpec.configure do |config|
# rack
config.include Rack::Test::Methods
...
end
从中运行测试时
rspec
:
$ rspec
...
Finished in 0.07952 seconds (files took 0.63445 seconds to load)
15 examples, 0 failures, 1 pending
从中运行测试时
rake
:
$ rake
/Users/<user>/.rbenv/versions/2.3.3/bin/ruby -I/Users/<user>/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rspec-support-3.8.0/lib:/Users/<user>/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rspec-core-3.8.0/lib /Users/<user>/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rspec-core-3.8.0/exe/rspec --pattern spec/\*\*/\*_spec.rb
...
Finished in 0.08885 seconds (files took 0.70133 seconds to load)
15 examples, 0 failures, 1 pending
$LOAD_PATH
然而。