Class: Roger::Testing::MockProject
- Includes:
- TestConstruct::Helpers
- Defined in:
- lib/roger/testing/mock_project.rb
Overview
A Mock project. If initialized without a path it will create a test_construct with the following (empty) paths:
-
html
-
partials
-
layouts
-
releases
Use MockProject in testing but never forget to call:
MockProject#destroy
in teardown otherwise you pollute your filesystem with build directories
Instance Attribute Summary collapse
-
#construct ⇒ Object
Returns the value of attribute construct.
Attributes inherited from Project
#html_path, #layouts_path, #mode, #options, #partial_path, #path, #rogerfile, #rogerfile_path
Instance Method Summary collapse
-
#destroy ⇒ Object
Destroy will remove all files/directories.
-
#initialize(path = nil, config = {}) ⇒ MockProject
constructor
A new instance of MockProject.
- #shell ⇒ Object
Methods inherited from Project
Constructor Details
#initialize(path = nil, config = {}) ⇒ MockProject
Returns a new instance of MockProject.
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/roger/testing/mock_project.rb', line 25 def initialize(path = nil, config = {}) unless path self.construct = setup_construct path = construct %w(html partials layouts releases).each do |dir| construct.directory dir end end # Call super to initialize super(path, config) end |
Instance Attribute Details
#construct ⇒ Object
Returns the value of attribute construct.
23 24 25 |
# File 'lib/roger/testing/mock_project.rb', line 23 def construct @construct end |
Instance Method Details
#destroy ⇒ Object
Destroy will remove all files/directories
39 40 41 |
# File 'lib/roger/testing/mock_project.rb', line 39 def destroy teardown_construct(construct) if construct end |
#shell ⇒ Object
43 44 45 |
# File 'lib/roger/testing/mock_project.rb', line 43 def shell @shell ||= MockShell.new end |