Class: CypressRails::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/cypress-rails/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rails_dir: Env.fetch("CYPRESS_RAILS_DIR", default: Dir.pwd), cypress_dir: Env.fetch("CYPRESS_RAILS_CYPRESS_DIR", default: rails_dir), host: Env.fetch("CYPRESS_RAILS_HOST", default: "127.0.0.1"), port: Env.fetch("CYPRESS_RAILS_PORT"), base_path: Env.fetch("CYPRESS_RAILS_BASE_PATH", default: "/"), transactional_server: Env.fetch("CYPRESS_RAILS_TRANSACTIONAL_SERVER", type: :boolean, default: true), cypress_cli_opts: Env.fetch("CYPRESS_RAILS_CYPRESS_OPTS", default: "")) ⇒ Config

Returns a new instance of Config.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cypress-rails/config.rb', line 7

def initialize(
  rails_dir: Env.fetch("CYPRESS_RAILS_DIR", default: Dir.pwd),
  cypress_dir: Env.fetch("CYPRESS_RAILS_CYPRESS_DIR", default: rails_dir),
  host: Env.fetch("CYPRESS_RAILS_HOST", default: "127.0.0.1"),
  port: Env.fetch("CYPRESS_RAILS_PORT"),
  base_path: Env.fetch("CYPRESS_RAILS_BASE_PATH", default: "/"),
  transactional_server: Env.fetch("CYPRESS_RAILS_TRANSACTIONAL_SERVER", type: :boolean, default: true),
  cypress_cli_opts: Env.fetch("CYPRESS_RAILS_CYPRESS_OPTS", default: "")
)
  @rails_dir = rails_dir
  @cypress_dir = cypress_dir
  @host = host
  @port = port
  @base_path = base_path
  @transactional_server = transactional_server
  @cypress_cli_opts = cypress_cli_opts
end

Instance Attribute Details

#base_pathObject

Returns the value of attribute base_path.



5
6
7
# File 'lib/cypress-rails/config.rb', line 5

def base_path
  @base_path
end

#cypress_cli_optsObject

Returns the value of attribute cypress_cli_opts.



5
6
7
# File 'lib/cypress-rails/config.rb', line 5

def cypress_cli_opts
  @cypress_cli_opts
end

#cypress_dirObject

Returns the value of attribute cypress_dir.



5
6
7
# File 'lib/cypress-rails/config.rb', line 5

def cypress_dir
  @cypress_dir
end

#hostObject

Returns the value of attribute host.



5
6
7
# File 'lib/cypress-rails/config.rb', line 5

def host
  @host
end

#portObject

Returns the value of attribute port.



5
6
7
# File 'lib/cypress-rails/config.rb', line 5

def port
  @port
end

#rails_dirObject

Returns the value of attribute rails_dir.



5
6
7
# File 'lib/cypress-rails/config.rb', line 5

def rails_dir
  @rails_dir
end

#transactional_serverObject

Returns the value of attribute transactional_server.



5
6
7
# File 'lib/cypress-rails/config.rb', line 5

def transactional_server
  @transactional_server
end

Instance Method Details

#to_sObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cypress-rails/config.rb', line 25

def to_s
  <<~DESC

    cypress-rails configuration:
    ============================
     CYPRESS_RAILS_DIR.....................#{rails_dir.inspect}
     CYPRESS_RAILS_CYPRESS_DIR.............#{cypress_dir.inspect}
     CYPRESS_RAILS_HOST....................#{host.inspect}
     CYPRESS_RAILS_PORT....................#{port.inspect}
     CYPRESS_RAILS_BASE_PATH...............#{base_path.inspect}
     CYPRESS_RAILS_TRANSACTIONAL_SERVER....#{transactional_server.inspect}
     CYPRESS_RAILS_CYPRESS_OPTS............#{cypress_cli_opts.inspect}

  DESC
end