1

***rails_helper.rb***

需要'spec_helper'

ActiveRecord::Migration.maintain_test_schema!

RSpec.configure 做 |config|

config.fixture_path = "#{::Rails.root}/spec/fixtures"

config.use_transactional_fixtures = true

config.infer_spec_type_from_file_location!

结尾

**spec_helper.rb**

需要“红宝石”

需要“spork”

Spork.prefork 做

ENV["RAILS_ENV"] ||= '测试'

需要 File.expand_path("../../config/environment", FILE )

需要'rspec/rails'

需要“水豚/rspec”

需要“email_spec”

需要“selenium-webdriver”

需要“webrat”

需要“webrat/core/matchers”

需要“rspec/autorun”

包括 Webrat::Methods

RSpec.configure 做 |config|

config.fixture_path = "#{::Rails.root}/spec/fixtures"

config.use_transactional_fixtures = true

config.infer_spec_type_from_file_location!

config.order = "随机"

config.before(:suite) 做

DatabaseCleaner.strategy = :truncation

结尾

config.before(:each) 做

  DatabaseCleaner.start

end

config.after(:each) do

  DatabaseCleaner.clean

end

结尾

结尾

Spork.each_run 做

需要“factory_girl_rails”

RSpec.configure 做 |config|

config.include FactoryGirl::Syntax::Methods

结尾

结尾

Webrat.configure 做 |config|

配置模式=:机架

结尾

4

0 回答 0