Method: #test_spec

Defined in:
lib/cli.rb

#test_spec(spec) ⇒ Object



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/cli.rb', line 177

def test_spec(spec)
  passed = 0
  amount = spec['features'].length
  message = Emoji.find_by_alias('heavy_minus_sign').raw * 3 + "\n\n"
  puts(message)
  for feature in spec['features']
    result = test_feature(feature, spec['scope'])
    if result
      passed += 1
    end
  end
  success = (passed == amount)
  color = 'green'
  message = ("\n " + Emoji.find_by_alias('heavy_check_mark').raw + '  ').green.bold
  if !success
    color = 'red'
    message = ("\n " + Emoji.find_by_alias('x').raw + '  ').red.bold
  end
  message += "#{spec['package']}: #{passed}/#{amount}\n".colorize(color).bold
  puts(message)
  return success
end