Class: Transpec::Config
- Inherits:
-
Object
- Object
- Transpec::Config
- Defined in:
- lib/transpec/config.rb
Defined Under Namespace
Classes: SymbolKeyHash
Constant Summary collapse
- NEGATIVE_FORMS_OF_TO =
['not_to', 'to_not'].freeze
- FORMS_OF_BE_FALSEY =
['be_falsey', 'be_falsy'].freeze
- BOOLEAN_MATCHER_TYPES =
[:conditional, :exact].freeze
- PREDICATES =
[ [:forced, false], [:skip_dynamic_analysis, false], [:add_explicit_type_metadata_to_example_group, false], [:add_receiver_arg_to_any_instance_implementation_block, true], [:parenthesize_matcher_arg, true] ].freeze
- DEFAULT_CONVERSIONS =
{ should: true, oneliner: true, should_receive: true, stub: true, have_items: true, its: true, pending: true, deprecated: true, example_group: false, hook_scope: false, stub_with_hash: false # to allow(obj).to receive(:message).and_return(value) prior to RSpec 3 }.freeze
Instance Attribute Summary collapse
-
#boolean_matcher_type ⇒ Object
Returns the value of attribute boolean_matcher_type.
-
#conversion ⇒ Object
readonly
Returns the value of attribute conversion.
-
#form_of_be_falsey ⇒ Object
Returns the value of attribute form_of_be_falsey.
-
#negative_form_of_to ⇒ Object
Returns the value of attribute negative_form_of_to.
-
#rspec_command ⇒ Object
Returns the value of attribute rspec_command.
Class Method Summary collapse
Instance Method Summary collapse
- #convert?(type) ⇒ Boolean
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/transpec/config.rb', line 47 def initialize PREDICATES.each do |predicate, default_value| instance_variable_set('@' + predicate.to_s, default_value) end @conversion = SymbolKeyHash.new @conversion.update(DEFAULT_CONVERSIONS) self.negative_form_of_to = 'not_to' self.boolean_matcher_type = :conditional self.form_of_be_falsey = 'be_falsey' end |
Instance Attribute Details
#boolean_matcher_type ⇒ Object
Returns the value of attribute boolean_matcher_type.
37 38 39 |
# File 'lib/transpec/config.rb', line 37 def boolean_matcher_type @boolean_matcher_type end |
#conversion ⇒ Object (readonly)
Returns the value of attribute conversion.
36 37 38 |
# File 'lib/transpec/config.rb', line 36 def conversion @conversion end |
#form_of_be_falsey ⇒ Object
Returns the value of attribute form_of_be_falsey.
37 38 39 |
# File 'lib/transpec/config.rb', line 37 def form_of_be_falsey @form_of_be_falsey end |
#negative_form_of_to ⇒ Object
Returns the value of attribute negative_form_of_to.
37 38 39 |
# File 'lib/transpec/config.rb', line 37 def negative_form_of_to @negative_form_of_to end |
#rspec_command ⇒ Object
Returns the value of attribute rspec_command.
37 38 39 |
# File 'lib/transpec/config.rb', line 37 def rspec_command @rspec_command end |
Class Method Details
.conversion_types ⇒ Object
43 44 45 |
# File 'lib/transpec/config.rb', line 43 def self.conversion_types DEFAULT_CONVERSIONS.keys end |
.valid_conversion_type?(type) ⇒ Boolean
39 40 41 |
# File 'lib/transpec/config.rb', line 39 def self.valid_conversion_type?(type) conversion_types.include?(type.to_sym) end |
Instance Method Details
#convert?(type) ⇒ Boolean
60 61 62 |
# File 'lib/transpec/config.rb', line 60 def convert?(type) @conversion[type] end |