lib/cuesmash/cucumber.rb in cuesmash-0.1.9.7 vs lib/cuesmash/cucumber.rb in cuesmash-0.1.9.8

- old
+ new

@@ -1,18 +1,16 @@ #!/usr/bin/env ruby # coding: utf-8 module Cuesmash - # # Provides a nice interface to cucumber, allowing # us to run the cucumber test suite # # @author [alexfish] # class Cucumber - # Public: the output directory for the tests attr_accessor :output # Public: the output format for the tests attr_accessor :format @@ -41,32 +39,28 @@ # def test started status = nil - output = "" - cucumber_command = command - Logger.debug "cucumber_command == #{cucumber_command}" + Logger.debug "cucumber_command == #{command}" - Open3.popen3 cucumber_command do |stdin, out, err, wait_thr| - + Open3.popen3 command do |_stdin, out, err, wait_thr| [out, err].each do |stream| Thread.new do - until (line = stream.gets).nil? do + until (line = stream.gets).nil? Logger.info line end end end wait_thr.join status = wait_thr.value.exitstatus end if status != 0 - Logger.info "Cucumber failed" - # exit status + Logger.info 'Cucumber failed' status else completed end end @@ -75,33 +69,33 @@ # # Output a nice message for starting # def started - Logger.info "Running Cucumber" + Logger.info 'Running Cucumber' end # # Output a nice message for completing # def completed - Logger.info "Cucumber Completed 👌" + Logger.info 'Cucumber Completed 👌' end # # Figure out what the cucumber command is and # return it # # @return [String] The cucumber command string def command - command_string = "cucumber" - command_string += " --format #{self.format}" if self.format - command_string += " --out #{self.output}" if self.output - command_string += " --profile #{self.profile}" if self.profile - command_string += @tags.to_a.empty? ? "" : tag_arguments - command_string += " --quiet" if self.quiet - command_string += " -c" + command_string = 'cucumber' + command_string += " --format #{format}" if format + command_string += " --out #{output}" if output + command_string += " --profile #{profile}" if profile + command_string += @tags.to_a.empty? ? '' : tag_arguments + command_string += ' --quiet' if quiet + command_string += ' -c' Logger.debug "cucumber command == #{command_string}" command_string end @@ -110,12 +104,12 @@ # Generate the --tags arguments for the cucumber # command # # @return [String] The --tags commands ready to go def tag_arguments - command_tag = "" + command_tag = '' @tags.each do |tag_set| - command_tag = "" unless command_tag + command_tag = '' unless command_tag command_tag += " --tags #{tag_set}" end command_tag end