Skip to content
Browse files

Attribute Rally type to Ticket with :type_as_symbol instead of :type …

…to remove 'Object#type is deprecated' warnings.
  • Loading branch information...
1 parent e74cad2 commit bd78d1bd7386cce0f106a15515f767a35e54b192 @simeonwillbanks committed Mar 2, 2011
Showing with 12 additions and 12 deletions.
  1. +3 −3 lib/provider/ticket.rb
  2. +9 −9 spec/tickets_spec.rb
View
6 lib/provider/ticket.rb
@@ -25,7 +25,7 @@ def initialize(*object)
:project_id => project_id,
# Rally symbol for Tasks and Defects
# :hierarchical_requirement, :defect or :task (:artifact for all)
- :type => ticket.type_as_symbol,
+ :type_as_symbol => ticket.type_as_symbol,
:title => ticket.name,
:description => ticket.description,
:requestor => ticket.submitted_by,
@@ -84,7 +84,7 @@ def self.find_by_attributes(project_id, attributes = {})
# This is a helper method to find
def self.search(project_id, options = {}, limit = 1000)
project = self.rally_project(project_id)
- search_type = options.delete(:type) || :artifact
+ search_type = options.delete(:type_as_symbol) || :artifact
query_result = TicketMaster::Provider::Rally.rally.find_all(search_type, :project => project)
tickets = query_result.collect do |ticket|
self.new ticket, project_id
@@ -98,7 +98,7 @@ def self.create(*options)
ticket = self.to_rally(options)
ticket[:project] = project
# Not sure about making the defect the default here, thoughts?
- new_type = options[:type] || :defect
+ new_type = options[:type_as_symbol] || :defect
new_ticket = TicketMaster::Provider::Rally.rally.create(new_type, ticket)
self.new new_ticket
end
View
18 spec/tickets_spec.rb
@@ -58,29 +58,29 @@
end
it "should be able to load all tickets of a given type" do
- tickets = @project.tickets(:type => :defect)
+ tickets = @project.tickets(:type_as_symbol => :defect)
tickets.should be_an_instance_of(Array)
tickets.first.should be_an_instance_of(@klass)
tickets.first.description.should == @ticket_description
tickets.first.project_id.should == @project_id
tickets.collect do |tick|
- tick.type.should == :defect
+ tick.type_as_symbol.should == :defect
end
- tickets = @project.tickets(:type => :task)
+ tickets = @project.tickets(:type_as_symbol => :task)
tickets.should be_an_instance_of(Array)
tickets.first.should be_an_instance_of(@klass)
tickets.first.project_id.should == @project_id
tickets.collect do |tick|
- tick.type.should == :task
+ tick.type_as_symbol.should == :task
end
- tickets = @project.tickets(:type => :hierarchical_requirement)
+ tickets = @project.tickets(:type_as_symbol => :hierarchical_requirement)
tickets.should be_an_instance_of(Array)
tickets.first.should be_an_instance_of(@klass)
tickets.first.project_id.should == @project_id
tickets.collect do |tick|
- tick.type.should == :hierarchical_requirement
+ tick.type_as_symbol.should == :hierarchical_requirement
end
end
@@ -101,13 +101,13 @@
it "should be able to create a new ticket" do
ticket = @project.ticket!({:title => 'Testing', :description => "Here we go"})
ticket.should be_an_instance_of(@klass)
- ticket.type.should == :defect
+ ticket.type_as_symbol.should == :defect
end
it "should be able to create a new ticket" do
- ticket = @project.ticket!({:title => 'TaskTesting', :description => "Here we go tasks", :type => :task, :status => "Defined", :work_product => @project.tickets(:type => :defect).first.oid})
+ ticket = @project.ticket!({:title => 'TaskTesting', :description => "Here we go tasks", :type_as_symbol => :task, :status => "Defined", :work_product => @project.tickets(:type_as_symbol => :defect).first.oid})
ticket.should be_an_instance_of(@klass)
- ticket.type.should == :task
+ ticket.type_as_symbol.should == :task
end

0 comments on commit bd78d1b

Please sign in to comment.
Something went wrong with that request. Please try again.