IOError:使用Selenium + Minitest时关闭流

时间:2014-11-11 16:29:01

标签: ruby-on-rails selenium minitest

我想使用Selenium和mit Rails 4.1.5应用程序(使用mintest,而不是RSpec)

在测试助手中我有

"require 'minitest/rails/capybara'
require 'capybara/rails'
require 'selenium-webdriver'
require 'minitest/autorun'"

(以及更多)。

在test / features文件夹中的实际测试文件中我有

" require_relative' ../ test_helper' 包括Warden :: Test :: Helpers

feature 'Admin Backend' do
  let(:admin) { FactoryGirl.create :admin }

  before { login_as admin }

  scenario 'Administrating Offers' do
    Capybara.current_driver = Capybara.javascript_driver
    organization = FactoryGirl.create :organization

    visit rails_admin_path

    click_link 'Angebote', match: :first
    click_link 'Neu hinzufügen'

    assert_difference 'Offer.count', 1 do
      fill_in 'offer_name', with: 'testangebot'
      fill_in 'offer_description', with: 'testdescription'
      fill_in 'offer_next_steps', with: 'testnextsteps'
      select 'Fixed', from: 'offer_encounter'
      select organization.name, from: 'offer_organization_id'

      click_button 'Speichern'
      page.must_have_content 'testangebot'
    end
  end
end"

如果我运行测试,我会

" 1)错误: 示例功能测试#test_0001_Administrating优惠: IOError:封闭流     test / features / example_test.rb:13:在'块(2级)中'

1次运行,0次断言,0次失败,1次错误,0次跳过"

Lin 13正在访问rails_admin_path'。

如果我删除第10行(" Capybara.current_driver = Capybara.javascript_driver"),一切都按预期运行,测试正在通过。

任何想法我做错了什么?

0 个答案:

没有答案