Skip to content

Commit

Permalink
Fixes #88
Browse files Browse the repository at this point in the history
  • Loading branch information
erwanlr committed Apr 8, 2019
1 parent ba63596 commit 932bb26
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion example/cmsscan.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.executables = ['cmsscan']
s.require_paths = ['lib']

s.add_dependency 'cms_scanner', '~> 0.0.42.0'
s.add_dependency 'cms_scanner', '~> 0.0.44.1'

s.add_development_dependency 'bundler', '>= 1.6'
s.add_development_dependency 'coveralls', '~> 0.8.0'
Expand Down
9 changes: 4 additions & 5 deletions lib/cms_scanner/parsed_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ module CMSScanner
# This is similar to an OpenStruct, but class wise (rather than instance), and with
# the logic to update the Browser options accordinly
class ParsedCli
@options = {}

class << self
attr_reader :options
# @return [ Hash ]
def self.options
@options ||= {}
end

# Sets the CLI options, and put them into the Browser as well
# @param [ Hash ] options
def self.options=(options)
@options = options.dup
@options = options.dup || {}

NS::Browser.reset
NS::Browser.instance(@options)
Expand Down
8 changes: 8 additions & 0 deletions spec/lib/parsed_cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
expect(parsed_cli.options).to eql(key: 'value', cache_ttl: 10)
end
end

context 'when passing nil' do
it 'sets an empty hash' do
parsed_cli.options = nil

expect(parsed_cli.options).to eql({})
end
end
end

describe '.options, .verbose etc' do
Expand Down

0 comments on commit 932bb26

Please sign in to comment.