Class: GitTest::Test

Inherits:
Object
  • Object
show all
Defined in:
lib/git_test/test.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}, notify = Notify.new) ⇒ Test

Returns a new instance of Test.



4
5
6
7
8
# File 'lib/git_test/test.rb', line 4

def initialize(options = {}, notify = Notify.new)
  self.notify     = notify
  self.created_at = Time.now
  self.command    = options[:cmd]
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



3
4
5
# File 'lib/git_test/test.rb', line 3

def command
  @command
end

#created_atObject

Returns the value of attribute created_at.



3
4
5
# File 'lib/git_test/test.rb', line 3

def created_at
  @created_at
end

#exit_codeObject

Returns the value of attribute exit_code.



3
4
5
# File 'lib/git_test/test.rb', line 3

def exit_code
  @exit_code
end

#notifyObject

Returns the value of attribute notify.



3
4
5
# File 'lib/git_test/test.rb', line 3

def notify
  @notify
end

#reportObject

Returns the value of attribute report.



3
4
5
# File 'lib/git_test/test.rb', line 3

def report
  @report
end

#statusObject

Returns the value of attribute status.



3
4
5
# File 'lib/git_test/test.rb', line 3

def status
  @status
end

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/git_test/test.rb', line 18

def failed?
  !passed?
end

#formatObject



10
11
12
# File 'lib/git_test/test.rb', line 10

def format
  :html
end

#passed?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/git_test/test.rb', line 14

def passed?
  exit_code == 0
end

#run!Object



22
23
24
25
26
# File 'lib/git_test/test.rb', line 22

def run!
  self.report = %x{#{command}}
  self.exit_code = Integer($?)
  self.status = passed? ? "passed" : "failed"
end