class BugModelItem

# ———————————————————————- A bug report. This includes a description of the bug and an open/closed status. A Bug is associated with one or more Tests that cause the Bug to occur. Bugs should be closed when none of their tests fail; this can be handled automatically by calling Bug#update after performing tests.

Public Class Methods

new(model, path) click to toggle source
Calls superclass method GitDS::ModelItem::new
# File doc/examples/test_suite/model.rb, line 432
def initialize(model, path)
  super
  @tests = GitDS::ProxyItemList.new(TestModelItem, model, path)
end

Public Instance Methods

add_test( t ) click to toggle source

Associated a test with this bug.

Note: t is a TestModelItem object.

# File doc/examples/test_suite/model.rb, line 472
def add_test( t )
  ensure_valid
  @tests.add(self, t )
end
del_test(ident) click to toggle source

Delete a test from this suite.

# File doc/examples/test_suite/model.rb, line 480
def del_test(ident)
  ensure_valid
  @tests.delete(ident)
end
description() click to toggle source

Description of the bug and its effects.

# File doc/examples/test_suite/model.rb, line 440
def description
  property(:description)
end
description=(val) click to toggle source
# File doc/examples/test_suite/model.rb, line 444
def description=(val)
  set_property(:description, val)
end
open=(val) click to toggle source
# File doc/examples/test_suite/model.rb, line 455
def open=(val)
  set_property(:open, val)
end
open?() click to toggle source

Status of the bug: open or closed?

# File doc/examples/test_suite/model.rb, line 451
def open?
  bool_property(:open)
end
tests() click to toggle source

Tests which demonstrate the buig.

# File doc/examples/test_suite/model.rb, line 462
def tests
  ensure_valid
  @tests.keys
end
update() click to toggle source

Update the status of the bug: open if any of the tests fail, closed if all of the tests pass.

# File doc/examples/test_suite/model.rb, line 489
def update
  pass_all = true
  tests.each do |ident|
    test = @tests[ident]
    pass_all = false if not test.pass?
  end

  # pass_all should equal !open
  if pass_all == open?
    open = (not pass_all)
  end
end