Skip to content

Commit

Permalink
fix @no-clobber breaking process management
Browse files Browse the repository at this point in the history
@no-clobber does not call Setup#call *at all*, which causes the
process monitor to not be listening to process events
  • Loading branch information
doudou committed Jan 18, 2018
1 parent f632923 commit d517fac
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/aruba/api/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def aruba
# This will only clean up aruba's working directory to remove all
# artifacts of your tests. This does NOT clean up the current working
# directory.
def setup_aruba
Aruba::Setup.new(aruba).call
def setup_aruba(clobber: true)
Aruba::Setup.new(aruba).call(clobber: clobber)

self
end
Expand Down
4 changes: 4 additions & 0 deletions lib/aruba/cucumber/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
aruba.command_monitor.clear
end

Before('@no-clobber') do
setup_aruba(clobber: false)
end

Before('~@no-clobber') do
setup_aruba
end
Expand Down
10 changes: 6 additions & 4 deletions lib/aruba/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ def initialize(runtime)
@runtime = runtime
end

def call
def call(clobber: true)
return if runtime.setup_already_done?

working_directory
working_directory(clobber: clobber)
events

runtime.setup_done
Expand All @@ -23,8 +23,10 @@ def call

private

def working_directory
Aruba.platform.rm File.join(runtime.config.root_directory, runtime.config.working_directory), :force => true
def working_directory(clobber: true)
if clobber
Aruba.platform.rm File.join(runtime.config.root_directory, runtime.config.working_directory), :force => true
end
Aruba.platform.mkdir File.join(runtime.config.root_directory, runtime.config.working_directory)
Aruba.platform.chdir runtime.config.root_directory
end
Expand Down

0 comments on commit d517fac

Please sign in to comment.