Sha256: c546ec4f2c69c2eab6e7463186d0556406e035883a6c02d8df0a8c8fe12500f1

Contents?: true

Size: 1.58 KB

Versions: 39

Compression:

Stored size: 1.58 KB

Contents

module RSpec
  module Rails
    # @api public
    # Container module for routing spec functionality.
    module FeatureExampleGroup
      extend ActiveSupport::Concern
      include RSpec::Rails::RailsExampleGroup

      # Default host to be used in Rails route helpers if none is specified.
      DEFAULT_HOST = "www.example.com"

      included do
        app = ::Rails.application
        if app.respond_to?(:routes)
          include app.routes.url_helpers     if app.routes.respond_to?(:url_helpers)
          include app.routes.mounted_helpers if app.routes.respond_to?(:mounted_helpers)

          if respond_to?(:default_url_options)
            default_url_options[:host] ||= ::RSpec::Rails::FeatureExampleGroup::DEFAULT_HOST
          end
        end
      end

      # Shim to check for presence of Capybara. Will delegate if present, raise
      # if not. We assume here that in most cases `visit` will be the first
      # Capybara method called in a spec.
      def visit(*)
        if defined?(super)
          super
        else
          raise "Capybara not loaded, please add it to your Gemfile:\n\ngem \"capybara\""
        end
      end
    end
  end
end

unless RSpec.respond_to?(:feature)
  opts = {
    capybara_feature: true,
    type: :feature,
    skip: <<-EOT.squish
      Feature specs require the Capybara (https://github.com/teamcapybara/capybara)
      gem, version 2.13.0 or later.
    EOT
  }

  RSpec.configure do |c|
    c.alias_example_group_to :feature, opts
    c.alias_example_to :scenario
    c.alias_example_to :xscenario, skip: 'Temporarily skipped with xscenario'
  end
end

Version data entries

39 entries across 37 versions & 6 rubygems

Version Path
rspec-rails-6.0.0 lib/rspec/rails/example/feature_example_group.rb
rspec-rails-5.1.2 lib/rspec/rails/example/feature_example_group.rb
rspec-rails-6.0.0.rc1 lib/rspec/rails/example/feature_example_group.rb
rspec-rails-5.1.1 lib/rspec/rails/example/feature_example_group.rb
rspec-rails-5.1.0 lib/rspec/rails/example/feature_example_group.rb
rspec-rails-5.0.3 lib/rspec/rails/example/feature_example_group.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/rspec-rails-5.0.2/lib/rspec/rails/example/feature_example_group.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/rspec-rails-5.0.2/lib/rspec/rails/example/feature_example_group.rb
rspec-rails-5.0.2 lib/rspec/rails/example/feature_example_group.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/rspec-rails-4.1.2/lib/rspec/rails/example/feature_example_group.rb
rspec-rails-5.0.1 lib/rspec/rails/example/feature_example_group.rb
rspec-rails-4.1.2 lib/rspec/rails/example/feature_example_group.rb
rspec-rails-5.0.0 lib/rspec/rails/example/feature_example_group.rb
rspec-rails-4.1.1 lib/rspec/rails/example/feature_example_group.rb
rspec-rails-4.1.0 lib/rspec/rails/example/feature_example_group.rb
rspec-rails-4.0.2 lib/rspec/rails/example/feature_example_group.rb
rspec-rails-4.0.1 lib/rspec/rails/example/feature_example_group.rb
rspec-rails-4.0.0 lib/rspec/rails/example/feature_example_group.rb
rspec-rails-4.0.0.rc1 lib/rspec/rails/example/feature_example_group.rb