Rspec Capybara功能测试不会退出

时间:2014-10-20 15:21:48

标签: ruby-on-rails testing rspec capybara

我正在尝试从功能测试开始,但它无法正常运行。我只是想在这里查看内容。

require 'rails_helper'

    feature "Browse Subjects Topics", :type => :feature do

      scenario "list subjects and topics" do

        visit root_path
        expect(page).to have_content('fes')

      end

    end

这给了我这个输出并永远保持这样。

$ rspec spec/features/
ActiveRecord::SchemaMigration Load (0.6ms)  SELECT "schema_migrations".* FROM "schema_migrations"
(0.2ms)  begin transaction
(0.1ms)  commit transaction
(0.1ms)  begin transaction
Topic Exists (0.3ms)  SELECT  1 AS one FROM "topics"  WHERE "topics"."name" = 'Topic 1' LIMIT 1
(0.2ms)  rollback transaction
(0.1ms)  begin transaction
Started GET "/" for 127.0.0.1 at 2014-10-20 17:20:36 +0200
Processing by WelcomeController#index as HTML
   Rendered welcome/index.html.erb within layouts/application (48.7ms)

Rails 4.1.6 Rspec 3.1.4

rails_helper.rb

ENV["RAILS_ENV"] ||= 'test'
require 'spec_helper'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'

Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }


ActiveRecord::Migration.maintain_test_schema!

RSpec.configure do |config|
  config.include FactoryGirl::Syntax::Methods

  config.before(:suite) do
    begin
      DatabaseCleaner.start
      FactoryGirl.lint
    ensure
      DatabaseCleaner.clean
    end
  end

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

  config.infer_spec_type_from_file_location!
end

spec_helper.rb

require 'capybara/rspec'

RSpec.configure do |config|

  config.expect_with :rspec do |expectations|

    expectations.include_chain_clauses_in_custom_matcher_descriptions = true

    expectations.syntax = [:should, :expect]
  end

  config.mock_with :rspec do |mocks|
    mocks.verify_partial_doubles = true
  end

end

.rspec

--color
--require spec_helper

0 个答案:

没有答案