Class: Chemlab::Configuration

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

Overview

Chemlab Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#browserObject

Returns the value of attribute browser.



13
14
15
# File 'lib/chemlab/configuration.rb', line 13

def browser
  @browser
end

#librariesObject

Returns the value of attribute libraries.



19
20
21
# File 'lib/chemlab/configuration.rb', line 19

def libraries
  @libraries
end

Class Method Details

.add_config(name) ⇒ Object

Add a chemlab configuration



7
8
9
# File 'lib/chemlab/configuration.rb', line 7

def self.add_config(name)
  attr_accessor name
end

Instance Method Details

#configure_rspecObject

Call RSpec.configure for additional configuration



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/chemlab/configuration.rb', line 30

def configure_rspec
  RSpec.configure do |rspec|
    yield rspec if block_given?

    # TODO Change this. /spec/api /spec/ui is hardcoded
    rspec.(file_path: Regexp.new('/spec/api')) do ||
      [:type] = :api
    end

    rspec.(file_path: Regexp.new('/spec/ui')) do ||
      [:type] = :ui
    end

    rspec.after(:each, type: :ui) do
      Chemlab.configuration.browser&.session&.engine&.quit
    end
  end
end