Method: MkSpec#write_spec

Defined in:
lib/mspec/commands/mkspec.rb

#write_spec(file, meth, exists) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/mspec/commands/mkspec.rb', line 81

def write_spec(file, meth, exists)
  if exists
    out = `#{ruby} #{MSPEC_HOME}/bin/mspec-run --dry-run -fs -e '#{meth}' #{file}`
    return if out =~ /#{Regexp.escape meth}/
  end

  File.open file, 'a' do |f|
    f.puts <<-EOS

describe "#{meth}" do
it "needs to be reviewed for spec completeness"
end
EOS
  end

  puts file
end