This repository was archived by the owner on Oct 22, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,12 @@ def store_script_and_validate
4040 false
4141 end
4242
43+ # Execute all tasks required before storing the script.
44+ # @return [Boolean] return true if the prerequisite actions were successfully executed.
45+ def before_store
46+ true
47+ end
48+
4349 # @return [Number] The status code that is expected after storing the script.
4450 def expected_status_code_after_store
4551 200
@@ -48,7 +54,7 @@ def expected_status_code_after_store
4854 # Run the module.
4955 # @return [Boolean] true if successful.
5056 def run
51- return false unless super
57+ return false unless super && before_store
5258
5359 emit_info 'Storing script...'
5460 return false unless store_script_and_validate
Original file line number Diff line number Diff line change 3232 subject . run
3333 expect ( invoked ) . to be true
3434 end
35+
36+ it 'returns false if #before_store returns false' do
37+ allow ( subject ) . to receive ( :before_store ) . and_return false
38+ allow ( subject ) . to receive ( :puts ) . and_return nil
39+ allow ( subject ) . to receive ( :check_wordpress_and_online ) . and_return true
40+ allow ( subject ) . to receive ( :start_http_server ) . and_return true
41+
42+ expect ( subject . run ) . to be false
43+ end
3544 end
3645
3746 describe '#store_script' do
You can’t perform that action at this time.
0 commit comments