В капибаре 1.0.0.rc1 есть новый dsl, очень похожий на стейк.Я пытаюсь настроить прибор в секции background / before, но когда я отлаживаю первый сценарий / пример и проверяю базу данных, прибор, работающий в фоновом режиме, исчезает.У меня для use_transactional_fixtures установлено значение true, но странно, что это будет иметь значение, учитывая, что фон является псевдонимом ранее.Что я делаю не так?
spec_helper.rb
require 'rubygems'
require 'spork'
require 'capybara/rspec'
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.
# 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 File.expand_path(File.dirname(__FILE__) + "/blueprints")
# 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
# 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 = true
config.before(:all) { Sham.reset(:before_all) }
config.before(:each) { Sham.reset(:before_each) }
end
end
Spork.each_run do
# This code will be run each time you run your specs.
end
teacher_creates_event.rb
require 'requests/requests_helper'
feature "Teacher creates event" do
background do
Teacher.make(:username => 'testteacher', :password => 'mypassword')
visit new_user_session_url
fill_in "Username", :with => 'testteacher'
fill_in "Password", :with => 'mypassword'
click_on "Sign in"
end
scenario "Teacher creates one-time event" do
visit studio_calendar_url
click_on "New Event"
fill_in "Title", :with => "Test One Time Event"
fill_in "Description", :with => "An event that occurs once and never repeats..."
fill_in "Start Date", :with => "2011-07-18"
fill_in "Start Time", :with => "1:00pm"
fill_in "End Date", :with => "2011-07-18"
fill_in "End Time", :with => "3:00pm"
uncheck "All Day"
click_on "Create Event"
end
end