class XcodeTestCase

Attributes

commands[RW]
name[RW]

Public Class Methods

new(name) click to toggle source
# File lib/second_curtain/xcode_test_case.rb, line 33
def initialize (name)
  @commands = []
  @name = name
end
test_case_from_line(line) click to toggle source
# File lib/second_curtain/xcode_test_case.rb, line 5
def self.test_case_from_line(line)
  components = line.split("Test Case '-[")

  if components.count == 2 && line.include?("]' started.")
    # Let's make it readable
    name = components.last.split("'").first
    name = name.split(" ").last
    name = name.split("]").first
    name = name.gsub("_", " ")

    # We avoid hitting ends of words by addng the space, but that potentially misses the first one
    name += " "

    name.gsub!(" hasnt ", " hasn't")
    name.gsub!(" isn t", " isn't")
    name.gsub!(" won t", " won't")
    name.gsub!(" don t", " don't")
    name.gsub!(" doesn t", " doesn't")
    name.gsub!(" shouldn t", " shouldn't")
    name.gsub!(" can t", " can't")

    first_char_upper = name[0].upcase
    name[0] = first_char_upper
    name.strip!
    XcodeTestCase.new(name)
  end
end

Public Instance Methods

add_command(command) click to toggle source
# File lib/second_curtain/xcode_test_case.rb, line 38
def add_command(command)
  @commands.push(command)
end
latest_command() click to toggle source
# File lib/second_curtain/xcode_test_case.rb, line 42
def latest_command
  @commands.last
end