Sha256: dc4eec232b9c86c1b4a89e2a9a5932e222f2d4215d82716485bef3c376290a40
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
TESTDATA_DIR = File.join(File.dirname(__FILE__), '..', 'support', 'testdata') Given(/the following inputs and outputs:/) do |table| @table = table end When(/I scan for warnings/) do @result_table = [ ['input', 'output'] ] swizzling_io do @table.hashes.each do |hash| full_path = File.join(TESTDATA_DIR, hash[:input]) runner = Wool::Scanner.new({}) warnings = runner.scan(File.read(full_path), hash[:input]) @result_table << [hash[:input], warnings.size.to_s] end end end Then(/the input and output tables should match/) do @table.diff!(@result_table) end When(/I scan-and-fix warnings/) do @result_table = [ ['input', 'output'] ] swizzling_io do @table.hashes.each do |hash| full_path = File.join(TESTDATA_DIR, hash[:input]) expected_output = File.read(File.join(TESTDATA_DIR, hash[:output])) captured_output = StringIO.new Wool::LineLengthMaximum(80) runner = Wool::Scanner.new(:fix => true, :output_file => captured_output) runner.scan(File.read(full_path), hash[:input]) reported_output = hash[:output] reported_output += '+' if captured_output.string != expected_output STDERR.puts [captured_output.string, expected_output].inspect if captured_output.string != expected_output @result_table << [hash[:input], reported_output] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wool-0.5.1 | features/step_definitions/wool_steps.rb |