spec/lib/rallycat/update_spec.rb in rallycat-0.2.0 vs spec/lib/rallycat/update_spec.rb in rallycat-0.3.0
- old
+ new
@@ -80,16 +80,42 @@
update = Rallycat::Update.new(@api)
message = update.task(task_num, state: 'Completed', owner: 'Freddy Fender')
message.should include('Task (TA6666) was assigned to "Freddy Fender"')
end
- # require "pry"; binding.pry
post_request = responder.requests[4] # this is the request that actually updates the task
post_request.should be_post
post_request.url.should == 'https://rally1.rallydev.com/slm/webservice/1.17/task/12345'
body = post_request.body.tap(&:rewind).read
body.should include('<State>Completed</State>')
body.should include('<Owner>fred.fender@testing.com</Owner>')
end
+ end
+
+ it 'raises when the user could not be found' do
+ responder = RallyTaskUpdateResponder.new
+
+ Artifice.activate_with responder do
+ task_num = "TA6666"
+ update = Rallycat::Update.new(@api)
+
+ lambda {
+ update.task(task_num, state: 'Completed', owner: 'Norman Notreal')
+ }.should raise_error(Rallycat::Update::UserNotFound, 'User (Norman Notreal) does not exist.')
+ end
+ end
+
+ it 'raises when the task could not be found' do
+ responder = RallyNoResultsResponder.new
+
+ Artifice.activate_with responder do
+ task_num = "TA6666"
+ update = Rallycat::Update.new(@api)
+
+ lambda {
+ update.task(task_num, state: 'Completed')
+ }.should raise_error(Rallycat::Update::TaskNotFound, 'Task (TA6666) does not exist.')
+ end
+
end
end
\ No newline at end of file