2011-06-11 2 views
1

capybara 1.0.0.rc1에는 스테이크와 매우 유사한 새로운 DSL이 있습니다. 배경/이전 섹션에서 조명기를 설정하려고하지만 첫 번째 시나리오/예제를 디버그하고 데이터베이스를 검사 할 때 백그라운드에서 설정 한 조명기는 사라졌습니다. use_transactional_fixtures를 true로 설정했지만 배경이 이전의 별칭 인 경우 문제가 될 수 있습니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까?Capybara 요청 사양 DSL 및 거래 용 설비

spec_helper.rb 내 환경에서 true로 config.cache_classes를 설정하는 몇 가지 이유를 들어

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 

답변

0

은/test.rb 예상대로 작동했다. 이유를 모르겠다.