Class: CubaGenie::MinitestSetup

Inherits:
Command
  • Object
show all
Includes:
Content
Defined in:
lib/cuba_genie/minitest_setup.rb

Constant Summary

Constants included from Content

Content::ACCEPTANCE_TEST_FILE_CONTENT, Content::APP_FILE_CONTENT, Content::BOOTSTRAP_CSS, Content::BOOTSTRAP_JS, Content::FUNCTIONAL_TEST_FILE_CONTENT, Content::GEM_FILE_CAPYBARA_CONTENT, Content::GEM_FILE_CONTENT, Content::HOME_VIEW_CONTENT, Content::LAYOUT_VIEW_CONTENT, Content::MINITEST_REPORTERS, Content::RACK_FILE_CONTENT, Content::RAKE_FILE_CONTENT, Content::TEST_HELPER_CONTENT_CAPYBARA, Content::TEST_HELPER_CONTENT_CORE

Instance Attribute Summary collapse

Attributes inherited from Command

#description, #error, #project_name, #rollback_msg

Instance Method Summary collapse

Methods inherited from Command

#unexecute

Constructor Details

#initialize(**args) ⇒ MinitestSetup

Returns a new instance of MinitestSetup.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cuba_genie/minitest_setup.rb', line 13

def initialize(**args)
  @description = (args[:capybara_setup] ?
                  "Setting up Minitest functional and acceptance tests" :
                  "Setting up Minitest functional tests")
  @rollback_msg = "rolling back Minitest"
  @capybara_setup = args[:capybara_setup]
  @project_name = args[:project_name]
  @reporter = args[:reporter] || 'Default'
  @test_helper = "test/test_helper.rb"
  super
end

Instance Attribute Details

#test_helper=(value) ⇒ Object (writeonly)

Sets the attribute test_helper

Parameters:

  • value

    the value to set the attribute test_helper to.



11
12
13
# File 'lib/cuba_genie/minitest_setup.rb', line 11

def test_helper=(value)
  @test_helper = value
end

Instance Method Details

#executeObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/cuba_genie/minitest_setup.rb', line 25

def execute
  super do
    FileUtils.mkdir_p "test/functional"
    @dirs_created << "test" << "test/functional"
    if @capybara_setup
      FileUtils.mkdir_p "test/acceptance"
      @dirs_created << "test/acceptance"
    end
    create_test_helper
    create_rake_file
    create_functional_test
    create_acceptance_test if @capybara_setup
  end
end