Class: Blueprints::Configuration
- Inherits:
-
Object
- Object
- Blueprints::Configuration
- Defined in:
- lib/blueprints/configuration.rb
Constant Summary collapse
- SUPPORTED_ORMS =
[nil, :active_record]
Instance Attribute Summary collapse
-
#filename ⇒ Object
Allows passing custom filename pattern in case blueprints are held in place other than spec/blueprint, test/blueprint, blueprint.
-
#prebuild ⇒ Object
Allows passing scenarios that should be prebuilt and available in all tests.
-
#root ⇒ Object
Allows passing custom root folder to use in case of non rails project.
-
#transactions ⇒ Object
By default blueprints runs each test in it’s own transaction.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
Sets default attributes for all attributes.
Constructor Details
#initialize ⇒ Configuration
Sets default attributes for all attributes
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/blueprints/configuration.rb', line 14 def initialize self.filename = [nil, "spec", "test"].map do |dir| ["blueprint"].map do |file| path = File.join([dir, file].compact) ["#{path}.rb", File.join(path, "*.rb")] end end.flatten @orm = :active_record @prebuild = [] @transactions = true @root = defined?(Rails) ? Rails.root : Pathname.pwd end |
Instance Attribute Details
#filename ⇒ Object
Allows passing custom filename pattern in case blueprints are held in place other than spec/blueprint, test/blueprint, blueprint.
5 6 7 |
# File 'lib/blueprints/configuration.rb', line 5 def filename @filename end |
#prebuild ⇒ Object
Allows passing scenarios that should be prebuilt and available in all tests. Works similarly to fixtures.
7 8 9 |
# File 'lib/blueprints/configuration.rb', line 7 def prebuild @prebuild end |
#root ⇒ Object
Allows passing custom root folder to use in case of non rails project. Defaults to RAILS_ROOT or current folder if RAILS_ROOT is not defined.
9 10 11 |
# File 'lib/blueprints/configuration.rb', line 9 def root @root end |
#transactions ⇒ Object
By default blueprints runs each test in it’s own transaction. This may sometimes be not desirable so this options allows to turn this off.
11 12 13 |
# File 'lib/blueprints/configuration.rb', line 11 def transactions @transactions end |