class Roger::Testing::MockProject

A Mock project. If initialized without a path it will create a test_construct with the following (empty) paths:

Use MockProject in testing but never forget to call:

MockProject#destroy

in teardown otherwise you pollute your filesystem with build directories

Attributes

construct[RW]

Public Class Methods

new(path = nil, config = {}) click to toggle source
Calls superclass method Roger::Project::new
# 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

Public Instance Methods

destroy() click to toggle source

Destroy will remove all files/directories

# File lib/roger/testing/mock_project.rb, line 39
def destroy
  teardown_construct(construct) if construct
end
shell() click to toggle source
# File lib/roger/testing/mock_project.rb, line 43
def shell
  @shell ||= MockShell.new
end