Class: ManiokBdd::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/maniok_bdd/cli.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Cli

Returns a new instance of Cli.



3
4
5
# File 'lib/maniok_bdd/cli.rb', line 3

def initialize(args)
  @feature_file = args.first
end

Instance Method Details

#create_spec_acceptance_folderObject



16
17
18
19
# File 'lib/maniok_bdd/cli.rb', line 16

def create_spec_acceptance_folder
  create_unless_exists "spec"
  create_unless_exists File.join("spec", "acceptance")
end

#ruby_fileObject



21
22
23
24
# File 'lib/maniok_bdd/cli.rb', line 21

def ruby_file
  feature_file_basename = File.basename(@feature_file)
  File.join "spec", "acceptance", "#{feature_file_basename}.rb"
end

#runObject



7
8
9
10
11
12
13
14
# File 'lib/maniok_bdd/cli.rb', line 7

def run
  gherkin_formatter = ManiokBdd::GherkinFormatter.build @feature_file

  create_spec_acceptance_folder
  write_file ruby_file, gherkin_formatter.to_s

  0 # success:)
end