Class: Teaspoon::Configuration
- Inherits:
-
Object
- Object
- Teaspoon::Configuration
- Includes:
- Singleton
- Defined in:
- lib/teaspoon/deprecated.rb,
lib/teaspoon/configuration.rb
Defined Under Namespace
Constant Summary collapse
- ENV_OVERRIDES =
options that can be specified in the ENV
{ boolean: %w(FAIL_FAST SUPPRESS_LOG COLOR), integer: %w(DRIVER_TIMEOUT SERVER_TIMEOUT), string: %w(DRIVER DRIVER_OPTIONS SERVER SERVER_PORT FORMATTERS USE_COVERAGE) }
- @@mount_at =
"/teaspoon"- @@root =
will default to Rails.root
nil- @@asset_paths =
["spec/javascripts", "spec/javascripts/stylesheets", "test/javascripts", "test/javascripts/stylesheets"]
- @@fixture_paths =
["spec/javascripts/fixtures", "test/javascripts/fixtures"]
- @@asset_manifest =
["teaspoon.css", "teaspoon-filterer.js", "support/*.js"]
- @@driver =
Teaspoon::Driver.default
- @@driver_options =
nil- @@driver_timeout =
180- @@server =
nil- @@server_host =
nil- @@server_port =
nil- @@server_timeout =
20- @@fail_fast =
true- @@formatters =
[Teaspoon::Formatter.default]
- @@color =
true- @@suppress_log =
false- @@use_coverage =
nil- @@suite_configs =
{ "default" => { block: proc { } } }
- @@coverage_configs =
{ "default" => { block: proc { } } }
Class Method Summary collapse
- .context=(*_args) ⇒ Object
- .coverage(name = :default, &block) ⇒ Object
- .driver_cli_options=(val) ⇒ Object
- .fixture_path=(*args) ⇒ Object
- .formatters ⇒ Object
- .override(config, value) ⇒ Object
- .override_from_env(env) ⇒ Object
-
.override_from_options(options) ⇒ Object
override from env or options.
-
.root=(path) ⇒ Object
custom getters / setters.
- .suite(name = :default, &block) ⇒ Object
Class Method Details
.context=(*_args) ⇒ Object
21 22 23 |
# File 'lib/teaspoon/deprecated.rb', line 21 def self.context=(*_args) Teaspoon.dep("the teaspoon context directive is no longer used, remove it from your configuration.") end |
.coverage(name = :default, &block) ⇒ Object
109 110 111 |
# File 'lib/teaspoon/configuration.rb', line 109 def self.coverage(name = :default, &block) @@coverage_configs[name.to_s] = { block: block, instance: Coverage.new(&block) } end |
.driver_cli_options=(val) ⇒ Object
33 34 35 36 |
# File 'lib/teaspoon/deprecated.rb', line 33 def self.(val) Teaspoon.dep("the teaspoon driver_cli_options directive is no longer used, use driver_options instead.") self. = val end |
.fixture_path=(*args) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/teaspoon/deprecated.rb', line 25 def self.fixture_path=(*args) Teaspoon.dep( "the teaspoon fixture_path directive has been changed to fixture_paths, which expects an array, please " + "update your configuration." ) self.fixture_paths = args end |
.formatters ⇒ Object
139 140 141 142 143 |
# File 'lib/teaspoon/configuration.rb', line 139 def self.formatters return ["dot"] if @@formatters.blank? return @@formatters if @@formatters.is_a?(Array) @@formatters.to_s.split(/,\s?/) end |
.override(config, value) ⇒ Object
157 158 159 160 |
# File 'lib/teaspoon/configuration.rb', line 157 def self.override(config, value) setter = "#{config.to_s.downcase}=" send(setter, value) if respond_to?(setter) end |
.override_from_env(env) ⇒ Object
151 152 153 154 155 |
# File 'lib/teaspoon/configuration.rb', line 151 def self.override_from_env(env) ENV_OVERRIDES[:boolean].each { |o| override(o, env[o] == "true") if env[o].present? } ENV_OVERRIDES[:integer].each { |o| override(o, env[o].to_i) if env[o].present? } ENV_OVERRIDES[:string].each { |o| override(o, env[o]) if env[o].present? } end |
.override_from_options(options) ⇒ Object
override from env or options
147 148 149 |
# File 'lib/teaspoon/configuration.rb', line 147 def self.() .each { |k, v| override(k, v) } end |
.root=(path) ⇒ Object
custom getters / setters
135 136 137 |
# File 'lib/teaspoon/configuration.rb', line 135 def self.root=(path) @@root = Pathname.new(path.to_s) if path.present? end |