Class: TestRail::Project

Inherits:
Object
  • Object
show all
Includes:
InitializeWithApi
Defined in:
lib/test_rail/project.rb

Instance Method Summary collapse

Methods included from InitializeWithApi

#initialize

Instance Method Details

#find_or_create_suite(args) ⇒ Object

Find or create a suite in this project based on the suite name project.find_or_create_suite( :name => “My Suite” )



33
34
35
36
37
38
39
40
# File 'lib/test_rail/project.rb', line 33

def find_or_create_suite( args )
  name = args[:name] or raise "Need to provide the name of a suite"
  suite = self.find_suite( args )
  if suite.nil?
    suite = new_suite( args )
  end
  suite
end

#find_suite(args) ⇒ Object

Find a suite in this project based on the suite name project.find_suite( :name => “My Suite” )



26
27
28
29
# File 'lib/test_rail/project.rb', line 26

def find_suite( args )
  name = args[:name] or raise "Need to provide the name of a suite"
  suites.select{ |s| s.name == name }.first
end

#new_suite(args) ⇒ Object

Create a new suite for this project



20
21
22
# File 'lib/test_rail/project.rb', line 20

def new_suite( args )
  @api.add_suite( args.merge({:project_id => id}) )
end

#suitesObject

Return a list of suites belonging to this project



15
16
17
# File 'lib/test_rail/project.rb', line 15

def suites
  @api.get_suites( :project_id => @id )
end