Class: Blueprints::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/blueprints/configuration.rb

Constant Summary collapse

SUPPORTED_ORMS =
[nil, :active_record]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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

#filenameObject

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

#prebuildObject

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

#rootObject

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

#transactionsObject

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