Module: RSpec::Ui

Defined in:
lib/rspec/ui/dsl.rb,
lib/rspec/ui/context.rb,
lib/rspec/ui/ngrok_hook.rb,
lib/rspec/ui/configuration.rb,
lib/rspec/ui/ui_example_group.rb

Defined Under Namespace

Modules: Context, DSL, UiExampleGroup Classes: Configuration, NgrokHook

Constant Summary collapse

DIRECTORY_MAPPINGS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Mappings used by ‘infer_spec_type_from_file_location!`.

{
  :ui => %w[spec ui]
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.initialize_configuration(config) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/rspec/ui/configuration.rb', line 32

def self.initialize_configuration(config)

  config.add_setting :always_run_ui_tests, :default => false

  # Borrowed from rspec-rails
  config.instance_exec do
    def infer_spec_type_from_file_location!
      DIRECTORY_MAPPINGS.each do |type, dir_parts|
        escaped_path = Regexp.compile(dir_parts.join('[\\\/]') + '[\\\/]')
        (:file_path => escaped_path) do ||
          [:type] ||= type
        end
      end
    end
  end

  config.include RSpec::Ui::UiExampleGroup, :type => :ui
end

Instance Method Details

#infer_spec_type_from_file_location!Object

Automatically tag specs in conventional directories with matching ‘type` metadata so that they have relevant helpers available to them. See `RSpec::Rails::DIRECTORY_MAPPINGS` for details on which metadata is applied to each directory.



# File 'lib/rspec/ui/configuration.rb', line 6

#render_views(val) ⇒ Object

Enables view rendering for controllers specs.



# File 'lib/rspec/ui/configuration.rb', line 17

#render_views=(val) ⇒ Object

When set to ‘true`, controller specs will render the relevant view as well. Defaults to `false`.



# File 'lib/rspec/ui/configuration.rb', line 12

#render_views?Object

Reader for currently value of ‘render_views` setting.



# File 'lib/rspec/ui/configuration.rb', line 20