class RailsSuite < Suite attr_reader :feature_files, :feature_files_path, :feature_file_suffix, :feature_files_as_strings, :features, :test_cases_file, :feature_keyword, :scenario_keyword, :project_name, :passed, :given_scenario_keyword, :features_helper def initialize(hash) @feature_files_path = hash[:feature_files_path] @feature_file_suffix = hash[:feature_file_suffix] || "feature" @test_cases_file = hash[:test_cases_file] @features_helper = File.expand_path(hash[:features_helper]) @feature_keyword = hash[:feature_keyword] || "Feature:" @scenario_keyword = hash[:scenario_keyword] || "Scenario:" @given_scenario_keyword = hash[:given_scenario_keyword] || "GivenScenario:" @project_name = hash[:project_name] || "Features" @feature_files = all_feature_files @feature_files_as_strings = all_feature_files_as_strings end def parse_output_file_and_open_in_browser(file) results = "" File.open(file) do |f| f.readlines.each do |l| results << l end end html = parse_results(results).html %x(touch '/tmp/out.html' && echo '#{html}' > /tmp/out.html && open '/tmp/out.html' ) end def parse_results_and_open_in_safari(results) html = parse_results(results).html open_in_safari(html) end def open_in_safari(html) %x(touch '/tmp/out.html' && echo '#{html}' > /tmp/out.html && open '/tmp/out.html' ) end def parse_results(results="") parse @passed = true features.each do |f| f.scenarios.each do |s| s.verify_status(results) @passed &&= s.passed? end end self end def passed? @passed end def html <<-END