spec/support/incompatibilities_generator.rb in faml-0.3.2 vs spec/support/incompatibilities_generator.rb in faml-0.3.3
- old
+ new
@@ -4,11 +4,11 @@
require 'hamlit/version'
class IncompatibilitiesGenerator
include Singleton
- class Record < Struct.new(:template, :options, :spec_path, :line_number, :faml_result, :haml_result, :hamlit_result)
+ Record = Struct.new(:template, :options, :spec_path, :line_number, :faml_result, :haml_result, :hamlit_result) do
def incompatible?
!all_error? && (faml_result != haml_result || faml_result != hamlit_result || haml_result != hamlit_result)
end
def grouped_difference
@@ -68,21 +68,21 @@
private
def render_haml(template, options)
obj = Object.new
- Haml::Engine.new(template, {ugly: true, escape_html: true}.merge(options)).def_method(obj, :haml)
+ Haml::Engine.new(template, { ugly: true, escape_html: true }.merge(options)).def_method(obj, :haml)
obj.haml
- rescue Exception => e
+ rescue => e
e
end
def render_hamlit(template, options)
obj = Object.new
obj.instance_eval "def hamlit; #{Hamlit::Engine.new(options).call(template)}; end"
obj.hamlit
- rescue Exception => e
+ rescue => e
e
end
def render_difference(file, path, record)
spec_path = Pathname.new(record.spec_path).relative_path_from(path.parent).to_s
@@ -97,10 +97,10 @@
render_grouped_difference(file, record.grouped_difference)
end
def render_input_title(options)
title = 'Input'
- if !options.empty?
+ unless options.empty?
title << " (with options=#{options.inspect})"
end
title
end