Class: Roger::Testing::MockRelease
- Defined in:
- lib/roger/testing/mock_release.rb
Overview
Creates a mock release object. It is the same as a regular release with the following “presets”
-
it will automatically use the :fixed SCM
-
it will automatically initialize a MockProject if you don’t pass a project to the initializer
Use MockRelease in testing but never forget to call:
MockRelease#destroy
in teardown otherwise you pollute your filesystem with build directories
Constant Summary
Constants included from Helpers::GetFiles
Helpers::GetFiles::GLOB_OPTIONS
Constants included from Helpers::Logging
Helpers::Logging::GRAY, Helpers::Logging::RED
Instance Attribute Summary
Attributes inherited from Release
Instance Method Summary collapse
-
#destroy ⇒ Object
Destroy will remove all files/directories.
-
#initialize(project = nil, config = {}) ⇒ MockRelease
constructor
A new instance of MockRelease.
Methods inherited from Release
#banner, #build_path, #cleanup, #comment, #finalize, #inject, #run!, #scm, #source_path, #target_path, #use
Methods included from Helpers::GetCallable
Methods included from Helpers::GetFiles
Methods included from Helpers::Logging
Constructor Details
#initialize(project = nil, config = {}) ⇒ MockRelease
Returns a new instance of MockRelease.
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/roger/testing/mock_release.rb', line 19 def initialize(project = nil, config = {}) config = { scm: :fixed }.update(config) unless project # Create a mock project that's completely empty project = MockProject.new end # Call super to initialize super(project, config) end |
Instance Method Details
#destroy ⇒ Object
Destroy will remove all files/directories
34 35 36 |
# File 'lib/roger/testing/mock_release.rb', line 34 def destroy project.destroy if project.is_a?(MockProject) end |