Class: RoxClient::RSpec::Config
- Inherits:
-
Object
- Object
- RoxClient::RSpec::Config
- Defined in:
- lib/rox-client-rspec/config.rb
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#cache_payload ⇒ Object
writeonly
Sets the attribute cache_payload.
-
#load_warnings ⇒ Object
readonly
Returns the value of attribute load_warnings.
-
#local_mode ⇒ Object
writeonly
Sets the attribute local_mode.
-
#print_payload ⇒ Object
writeonly
Sets the attribute print_payload.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#publish ⇒ Object
writeonly
Sets the attribute publish.
-
#save_payload ⇒ Object
writeonly
Sets the attribute save_payload.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#workspace ⇒ Object
Returns the value of attribute workspace.
Instance Method Summary collapse
- #client_options ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #load ⇒ Object
- #servers ⇒ Object
-
#setup! ⇒ Object
Plugs ROX utilities into RSpec.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
23 24 25 26 27 28 |
# File 'lib/rox-client-rspec/config.rb', line 23 def initialize @servers = [] @project = Project.new @publish, @local_mode, @cache_payload, @print_payload, @save_payload = false, false, false, false, false @load_warnings = [] end |
Instance Attribute Details
#cache_payload=(value) ⇒ Object (writeonly)
Sets the attribute cache_payload
20 21 22 |
# File 'lib/rox-client-rspec/config.rb', line 20 def cache_payload=(value) @cache_payload = value end |
#load_warnings ⇒ Object (readonly)
Returns the value of attribute load_warnings.
21 22 23 |
# File 'lib/rox-client-rspec/config.rb', line 21 def load_warnings @load_warnings end |
#local_mode=(value) ⇒ Object (writeonly)
Sets the attribute local_mode
20 21 22 |
# File 'lib/rox-client-rspec/config.rb', line 20 def local_mode=(value) @local_mode = value end |
#print_payload=(value) ⇒ Object (writeonly)
Sets the attribute print_payload
20 21 22 |
# File 'lib/rox-client-rspec/config.rb', line 20 def print_payload=(value) @print_payload = value end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
21 22 23 |
# File 'lib/rox-client-rspec/config.rb', line 21 def project @project end |
#publish=(value) ⇒ Object (writeonly)
Sets the attribute publish
20 21 22 |
# File 'lib/rox-client-rspec/config.rb', line 20 def publish=(value) @publish = value end |
#save_payload=(value) ⇒ Object (writeonly)
Sets the attribute save_payload
20 21 22 |
# File 'lib/rox-client-rspec/config.rb', line 20 def save_payload=(value) @save_payload = value end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
21 22 23 |
# File 'lib/rox-client-rspec/config.rb', line 21 def server @server end |
#workspace ⇒ Object
Returns the value of attribute workspace.
21 22 23 |
# File 'lib/rox-client-rspec/config.rb', line 21 def workspace @workspace end |
Instance Method Details
#client_options ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/rox-client-rspec/config.rb', line 49 def { publish: @publish, local_mode: @local_mode, workspace: @workspace, cache_payload: @cache_payload, print_payload: @print_payload, save_payload: @save_payload }.select{ |k,v| !v.nil? } end |
#load ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/rox-client-rspec/config.rb', line 60 def load @load_warnings = [] return unless config = load_config_files @publish = parse_env_flag :publish, !!config[:publish] @server_name = parse_env_option(:server) || config[:server] @local_mode = parse_env_flag(:local) || !!config[:local] self.workspace = parse_env_option(:workspace) || config[:workspace] @cache_payload = parse_env_flag :cache_payload, !!config[:payload][:cache] @print_payload = parse_env_flag :print_payload, !!config[:payload][:print] @save_payload = parse_env_flag :save_payload, !!config[:payload][:save] @servers, @server = build_servers config if @servers.empty? @load_warnings << "No server defined" elsif !@server_name @load_warnings << "No server name given" elsif !@server @load_warnings << "Unknown server '#{@server_name}'" end = config[:project] .merge! api_id: @server.project_api_id if @server and @server.project_api_id @project.update self end |
#servers ⇒ Object
34 35 36 |
# File 'lib/rox-client-rspec/config.rb', line 34 def servers @servers.dup end |
#setup! ⇒ Object
Plugs ROX utilities into RSpec.
39 40 41 42 43 |
# File 'lib/rox-client-rspec/config.rb', line 39 def setup! ::RSpec.configure do |c| c.add_formatter Formatter end end |