8
사양/lib 디렉토리에서 테스트를 실행하지 않습니다,하지만 난 spec/lib
의 사양 시험받을 얻을 수도 rspec
도 spec spec/
을 실행합니다.RSpec에 레일 내가 <code>spec/lib</code>에 <code>lib</code> 폴더 아래에 모듈 내 사양을 넣어
이 작업을 위해 필요한 것이 있습니까? 나는 레일 3.2.0를 사용하고, 다음은 내 spec_helper.rb
require 'rubygems'
require 'spork'
#uncomment the following line to use spork with the debugger
#require 'spork/ext/ruby-debug'
Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll
# need to restart spork for it take effect.
# These lines are needed for SimpleCov to generate a complete coverage report
require 'simplecov'
SimpleCov.start 'rails'
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
# 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|
config.infer_base_class_for_anonymous_controllers = false
config.mock_with :rspeC# use rspec's built-in mock objects
require 'database_cleaner'
config.before(:suite) do
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.orm = "mongoid"
end
config.before(:each) do
DatabaseCleaner.clean
end
end
end
Spork.each_run do
# This code will be run each time you run your specs.
end