Class: Smartest::InitGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/smartest/init_generator.rb

Constant Summary collapse

FILES =
{
  "smartest/test_helper.rb" => <<~RUBY,
  "smartest/example_test.rb" => <<~RUBY
    # frozen_string_literal: true

    require "test_helper"

    test("example") do
      expect(1 + 1).to eq(2)
    end
  RUBY
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(root: Dir.pwd, output: $stdout) ⇒ InitGenerator

Returns a new instance of InitGenerator.



28
29
30
31
# File 'lib/smartest/init_generator.rb', line 28

def initialize(root: Dir.pwd, output: $stdout)
  @root = root
  @output = output
end

Instance Method Details

#runObject



33
34
35
36
37
38
39
40
41
42
# File 'lib/smartest/init_generator.rb', line 33

def run
  create_directory("smartest")
  create_directory("smartest/fixtures")
  FILES.each { |path, contents| create_file(path, contents) }

  @output.puts
  @output.puts "Run your test suite with: bundle exec smartest"

  0
end