pjdavis-roart 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +3 -0
- data/Rakefile +1 -1
- data/lib/roart/connection.rb +4 -0
- data/lib/roart/history.rb +115 -0
- data/lib/roart/roart.rb +13 -0
- data/lib/roart/ticket.rb +14 -16
- data/lib/roart/ticket_page.rb +23 -0
- data/lib/roart.rb +1 -1
- data/roart.gemspec +4 -4
- data/spec/roart/history_spec.rb +59 -0
- data/spec/roart/ticket_page_spec.rb +22 -0
- data/spec/roart/ticket_spec.rb +34 -0
- data/spec/test_data/full_history.txt +126 -0
- data/spec/test_data/single_history.txt +26 -0
- metadata +8 -2
    
        data/History.txt
    CHANGED
    
    | @@ -1,2 +1,5 @@ | |
| 1 | 
            +
            == 0.1.1 / 2009-08-17
         | 
| 2 | 
            +
            Added History functionality. #histories now loads an array of history objects into memory and you can access them like you would a regular array. A few connivence methods (last, count) have also been added.
         | 
| 3 | 
            +
             | 
| 1 4 | 
             
            == 0.1.0 / 2009-08-13
         | 
| 2 5 | 
             
            Initial Commit. Base functionality added. Can search for tickets, and see all info on tickets. Ticket History not yet implemented.
         | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/lib/roart/connection.rb
    CHANGED
    
    
| @@ -0,0 +1,115 @@ | |
| 1 | 
            +
            module Roart
         | 
| 2 | 
            +
              
         | 
| 3 | 
            +
              module Histories
         | 
| 4 | 
            +
                
         | 
| 5 | 
            +
                DefaultAttributes = %w(creator type description content created)
         | 
| 6 | 
            +
                RequiredAttributes = %w(creator type)
         | 
| 7 | 
            +
              
         | 
| 8 | 
            +
              end
         | 
| 9 | 
            +
              
         | 
| 10 | 
            +
              class HistoryArray < Array
         | 
| 11 | 
            +
                
         | 
| 12 | 
            +
                def ticket
         | 
| 13 | 
            +
                  @default_options[:ticket]
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
                
         | 
| 16 | 
            +
                def all
         | 
| 17 | 
            +
                  self
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
                
         | 
| 20 | 
            +
                def count
         | 
| 21 | 
            +
                  self.size
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
                
         | 
| 24 | 
            +
                def last
         | 
| 25 | 
            +
                  self[self.size - 1]
         | 
| 26 | 
            +
                end
         | 
| 27 | 
            +
                
         | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
              
         | 
| 30 | 
            +
              class History
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            #TODO Figure out why i can't include Roart::MethodFunctions
         | 
| 33 | 
            +
                def add_methods!
         | 
| 34 | 
            +
                  @attributes.each do |key, value|
         | 
| 35 | 
            +
                    (class << self; self; end).send :define_method, key do
         | 
| 36 | 
            +
                      return value
         | 
| 37 | 
            +
                    end
         | 
| 38 | 
            +
                  end 
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
                
         | 
| 41 | 
            +
                class << self
         | 
| 42 | 
            +
                
         | 
| 43 | 
            +
                  def default(options)
         | 
| 44 | 
            +
                    history = self.dup
         | 
| 45 | 
            +
                    history.instance_variable_set("@default_options", options)
         | 
| 46 | 
            +
                    history.all
         | 
| 47 | 
            +
                  end
         | 
| 48 | 
            +
                
         | 
| 49 | 
            +
                  def ticket
         | 
| 50 | 
            +
                    @default_options[:ticket]
         | 
| 51 | 
            +
                  end
         | 
| 52 | 
            +
                
         | 
| 53 | 
            +
                  def all
         | 
| 54 | 
            +
                    @histories ||= get_all
         | 
| 55 | 
            +
                  end
         | 
| 56 | 
            +
                  
         | 
| 57 | 
            +
                  def default_options
         | 
| 58 | 
            +
                    @default_options
         | 
| 59 | 
            +
                  end
         | 
| 60 | 
            +
                  
         | 
| 61 | 
            +
                  protected
         | 
| 62 | 
            +
                  
         | 
| 63 | 
            +
                  def instantiate(attrs)
         | 
| 64 | 
            +
                    object = nil
         | 
| 65 | 
            +
                    if attrs.is_a?(Array)
         | 
| 66 | 
            +
                      array = Array.new
         | 
| 67 | 
            +
                      attrs.each do |attr|
         | 
| 68 | 
            +
                        object = self.allocate
         | 
| 69 | 
            +
                        object.instance_variable_set("@attributes", attr.merge(self.default_options))
         | 
| 70 | 
            +
                        object.send("add_methods!")
         | 
| 71 | 
            +
                        array << object
         | 
| 72 | 
            +
                      end
         | 
| 73 | 
            +
                      return array
         | 
| 74 | 
            +
                    elsif attrs.is_a?(Hash)
         | 
| 75 | 
            +
                      object = self.allocate
         | 
| 76 | 
            +
                      object.instance_variable_set("@attributes", attrs.merge(self.default_options))
         | 
| 77 | 
            +
                      object.send("add_methods!")
         | 
| 78 | 
            +
                    end
         | 
| 79 | 
            +
                    object
         | 
| 80 | 
            +
                  end
         | 
| 81 | 
            +
                  
         | 
| 82 | 
            +
                  def get_all
         | 
| 83 | 
            +
                    page = get_page
         | 
| 84 | 
            +
                    raise TicketSystemError, "Can't get history." unless page
         | 
| 85 | 
            +
                    raise TicketSystemInterfaceError, "Error getting history for Ticket: #{ticket.id}." unless page.split("\n")[0].include?("200")
         | 
| 86 | 
            +
                    history_array = get_histories_from_page(page)
         | 
| 87 | 
            +
                    history_array
         | 
| 88 | 
            +
                  end
         | 
| 89 | 
            +
                  
         | 
| 90 | 
            +
                  def get_histories_from_page(page)
         | 
| 91 | 
            +
                    full_history = HistoryArray.new
         | 
| 92 | 
            +
                    for history in page.split(/^--$/)
         | 
| 93 | 
            +
                      history = history.split("\n")
         | 
| 94 | 
            +
                      history.extend(Roart::TicketPage)
         | 
| 95 | 
            +
                      full_history << self.instantiate(history.to_history_hash)
         | 
| 96 | 
            +
                    end
         | 
| 97 | 
            +
                    full_history.instance_variable_set("@default_options", @default_options)
         | 
| 98 | 
            +
                    full_history
         | 
| 99 | 
            +
                  end
         | 
| 100 | 
            +
                  
         | 
| 101 | 
            +
                  def get_page
         | 
| 102 | 
            +
                    @default_options[:ticket].class.connection.get(uri_for(@default_options[:ticket]))
         | 
| 103 | 
            +
                  end
         | 
| 104 | 
            +
                  
         | 
| 105 | 
            +
                  def uri_for(ticket)
         | 
| 106 | 
            +
                    uri = self.default_options[:ticket].class.connection.rest_path + "ticket/#{ticket.id}/history?format=l"
         | 
| 107 | 
            +
                  end
         | 
| 108 | 
            +
                  
         | 
| 109 | 
            +
                end
         | 
| 110 | 
            +
                
         | 
| 111 | 
            +
                protected 
         | 
| 112 | 
            +
                
         | 
| 113 | 
            +
              end
         | 
| 114 | 
            +
              
         | 
| 115 | 
            +
            end
         | 
    
        data/lib/roart/roart.rb
    CHANGED
    
    
    
        data/lib/roart/ticket.rb
    CHANGED
    
    | @@ -8,6 +8,8 @@ module Roart | |
| 8 8 | 
             
              end
         | 
| 9 9 |  | 
| 10 10 | 
             
              class Ticket
         | 
| 11 | 
            +
                
         | 
| 12 | 
            +
                include Roart::MethodFunctions
         | 
| 11 13 |  | 
| 12 14 | 
             
                def initialize(attributes)
         | 
| 13 15 | 
             
                  Roart::check_keys!(attributes, Roart::Tickets::RequiredAttributes)
         | 
| @@ -32,6 +34,12 @@ module Roart | |
| 32 34 | 
             
                  end
         | 
| 33 35 | 
             
                end
         | 
| 34 36 |  | 
| 37 | 
            +
                #loads the ticket history from rt
         | 
| 38 | 
            +
                #
         | 
| 39 | 
            +
                def histories
         | 
| 40 | 
            +
                  @histories ||= Roart::History.default(:ticket => self)
         | 
| 41 | 
            +
                end
         | 
| 42 | 
            +
                
         | 
| 35 43 | 
             
                class << self #class methods
         | 
| 36 44 |  | 
| 37 45 | 
             
                  # Gives or Sets the connection object for the RT Server.
         | 
| @@ -96,20 +104,20 @@ module Roart | |
| 96 104 |  | 
| 97 105 | 
             
                  protected
         | 
| 98 106 |  | 
| 99 | 
            -
                  def instantiate( | 
| 107 | 
            +
                  def instantiate(attrs)
         | 
| 100 108 | 
             
                    object = nil
         | 
| 101 | 
            -
                    if  | 
| 109 | 
            +
                    if attrs.is_a?(Array)
         | 
| 102 110 | 
             
                      array = Array.new
         | 
| 103 | 
            -
                       | 
| 111 | 
            +
                      attrs.each do |attr|
         | 
| 104 112 | 
             
                        object = self.allocate
         | 
| 105 | 
            -
                        object.instance_variable_set("@attributes",  | 
| 113 | 
            +
                        object.instance_variable_set("@attributes", attr)
         | 
| 106 114 | 
             
                        object.send("add_methods!")
         | 
| 107 115 | 
             
                        array << object
         | 
| 108 116 | 
             
                      end
         | 
| 109 117 | 
             
                      return array
         | 
| 110 | 
            -
                    elsif  | 
| 118 | 
            +
                    elsif attrs.is_a?(Hash)
         | 
| 111 119 | 
             
                      object = self.allocate
         | 
| 112 | 
            -
                      object.instance_variable_set("@attributes",  | 
| 120 | 
            +
                      object.instance_variable_set("@attributes", attrs)
         | 
| 113 121 | 
             
                      object.send("add_methods!")
         | 
| 114 122 | 
             
                    end
         | 
| 115 123 | 
             
                    object
         | 
| @@ -264,16 +272,6 @@ module Roart | |
| 264 272 | 
             
                  end
         | 
| 265 273 |  | 
| 266 274 | 
             
                end
         | 
| 267 | 
            -
                  
         | 
| 268 | 
            -
                protected
         | 
| 269 | 
            -
                
         | 
| 270 | 
            -
                def add_methods!
         | 
| 271 | 
            -
                  @attributes.each do |key, value|
         | 
| 272 | 
            -
                    (class << self; self; end).send :define_method, key do
         | 
| 273 | 
            -
                      return value
         | 
| 274 | 
            -
                    end
         | 
| 275 | 
            -
                  end 
         | 
| 276 | 
            -
                end
         | 
| 277 275 |  | 
| 278 276 | 
             
              end
         | 
| 279 277 |  | 
    
        data/lib/roart/ticket_page.rb
    CHANGED
    
    | @@ -1,6 +1,8 @@ | |
| 1 1 | 
             
            module Roart
         | 
| 2 2 |  | 
| 3 3 | 
             
              module TicketPage
         | 
| 4 | 
            +
                
         | 
| 5 | 
            +
                IntKeys = %w[id]
         | 
| 4 6 |  | 
| 5 7 | 
             
                def to_hash
         | 
| 6 8 | 
             
                  hash = Hash.new
         | 
| @@ -32,6 +34,27 @@ module Roart | |
| 32 34 | 
             
                  end
         | 
| 33 35 | 
             
                  array
         | 
| 34 36 | 
             
                end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
            # TODO: Don't throw away attachments (/^ {13})
         | 
| 39 | 
            +
                def to_history_hash
         | 
| 40 | 
            +
                  hash = Hash.new
         | 
| 41 | 
            +
                  self.delete_if{|x| !x.include?(":") && !x.match(/^ {9}/) && !x.match(/^ {13}/)}
         | 
| 42 | 
            +
                  self.each do |ln|
         | 
| 43 | 
            +
                    if ln.match(/^ {9}/) && !ln.match(/^ {13}/)
         | 
| 44 | 
            +
                      hash[:content] << "\n" + ln.strip if hash[:content]
         | 
| 45 | 
            +
                    elsif ln.match(/^ {13}/)
         | 
| 46 | 
            +
                      hash[:attachments] << "\n" + ln.strip if hash[:attachments]
         | 
| 47 | 
            +
                    else
         | 
| 48 | 
            +
                      ln = ln.split(":")
         | 
| 49 | 
            +
                      unless ln.size == 1 || ln.first == 'Ticket' # we don't want to override the ticket method.
         | 
| 50 | 
            +
                        key = ln.delete_at(0).strip.underscore
         | 
| 51 | 
            +
                        value = ln.join(":").strip
         | 
| 52 | 
            +
                        hash[key.to_sym] = IntKeys.include?(key) ? value.to_i : value
         | 
| 53 | 
            +
                      end
         | 
| 54 | 
            +
                    end
         | 
| 55 | 
            +
                  end
         | 
| 56 | 
            +
                  hash
         | 
| 57 | 
            +
                end
         | 
| 35 58 |  | 
| 36 59 | 
             
              end
         | 
| 37 60 |  | 
    
        data/lib/roart.rb
    CHANGED
    
    
    
        data/roart.gemspec
    CHANGED
    
    | @@ -2,15 +2,15 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            Gem::Specification.new do |s|
         | 
| 4 4 | 
             
              s.name = %q{roart}
         | 
| 5 | 
            -
              s.version = "0.1. | 
| 5 | 
            +
              s.version = "0.1.1"
         | 
| 6 6 |  | 
| 7 7 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 8 8 | 
             
              s.authors = ["PJ Davis"]
         | 
| 9 | 
            -
              s.date = %q{2009-08- | 
| 9 | 
            +
              s.date = %q{2009-08-17}
         | 
| 10 10 | 
             
              s.description = %q{Interface for working with Request Tracker (RT) tickets inspired by ActiveRecord.}
         | 
| 11 11 | 
             
              s.email = %q{pj.davis@gmail.com}
         | 
| 12 | 
            -
              s.extra_rdoc_files = ["History.txt", "README.rdoc"]
         | 
| 13 | 
            -
              s.files = ["History.txt", "README.rdoc", "Rakefile", "lib/roart.rb", "lib/roart/connection.rb", "lib/roart/core/array.rb", "lib/roart/core/string.rb", "lib/roart/errors.rb", "lib/roart/roart.rb", "lib/roart/ticket.rb", "lib/roart/ticket_page.rb", "roart.gemspec", "spec/roart/connection_spec.rb", "spec/roart/core/array_spec.rb", "spec/roart/core/string_spec.rb", "spec/roart/roart_spec.rb", "spec/roart/ticket_page_spec.rb", "spec/roart/ticket_spec.rb", "spec/roart_spec.rb", "spec/spec_helper.rb", "test/test_roart.rb"]
         | 
| 12 | 
            +
              s.extra_rdoc_files = ["History.txt", "README.rdoc", "spec/test_data/full_history.txt", "spec/test_data/single_history.txt"]
         | 
| 13 | 
            +
              s.files = ["History.txt", "README.rdoc", "Rakefile", "lib/roart.rb", "lib/roart/connection.rb", "lib/roart/core/array.rb", "lib/roart/core/string.rb", "lib/roart/errors.rb", "lib/roart/history.rb", "lib/roart/roart.rb", "lib/roart/ticket.rb", "lib/roart/ticket_page.rb", "roart.gemspec", "spec/roart/connection_spec.rb", "spec/roart/core/array_spec.rb", "spec/roart/core/string_spec.rb", "spec/roart/history_spec.rb", "spec/roart/roart_spec.rb", "spec/roart/ticket_page_spec.rb", "spec/roart/ticket_spec.rb", "spec/roart_spec.rb", "spec/spec_helper.rb", "spec/test_data/full_history.txt", "spec/test_data/single_history.txt", "test/test_roart.rb"]
         | 
| 14 14 | 
             
              s.has_rdoc = true
         | 
| 15 15 | 
             
              s.homepage = %q{http://github.com/pjdavis/roart}
         | 
| 16 16 | 
             
              s.rdoc_options = ["--main", "README.rdoc"]
         | 
| @@ -0,0 +1,59 @@ | |
| 1 | 
            +
            require File.join(File.dirname(__FILE__), %w[ .. spec_helper])
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe "History" do
         | 
| 4 | 
            +
              
         | 
| 5 | 
            +
              it 'should have a ticket' do
         | 
| 6 | 
            +
                search_array = ['1:subject']
         | 
| 7 | 
            +
                search_array.extend(Roart::TicketPage)
         | 
| 8 | 
            +
                full_ticket = Roart::Ticket.send(:instantiate, {:id => 1, :subject => 'subject', :full => true})
         | 
| 9 | 
            +
                @ticket = Roart::Ticket.send(:instantiate, search_array.to_search_array ).first
         | 
| 10 | 
            +
                Roart::History.should_receive(:get_page).and_return('200')    
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                history = @ticket.histories
         | 
| 13 | 
            +
                history.ticket.should == @ticket
         | 
| 14 | 
            +
                
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
              
         | 
| 17 | 
            +
              describe 'getting ticket history' do
         | 
| 18 | 
            +
                
         | 
| 19 | 
            +
                it 'should create the crect URI' do
         | 
| 20 | 
            +
                  connection = mock('connection', :rest_path => 'REST/1.0/')
         | 
| 21 | 
            +
                  myclass = mock('class', :connection => connection)
         | 
| 22 | 
            +
                  ticket = mock(:ticket, :id => 1, :class => myclass)
         | 
| 23 | 
            +
                  hash = mock(:options_hash, :[] => ticket)
         | 
| 24 | 
            +
                  Roart::History.should_receive(:default_options).and_return(hash)
         | 
| 25 | 
            +
                  Roart::History.send(:uri_for, ticket).should == 'REST/1.0/ticket/1/history?format=l'
         | 
| 26 | 
            +
                end
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
              
         | 
| 29 | 
            +
              describe 'reading history pages' do
         | 
| 30 | 
            +
                
         | 
| 31 | 
            +
                before do
         | 
| 32 | 
            +
                  @page = File.open(File.join(File.dirname(__FILE__), %w[ .. test_data full_history.txt])).readlines.join
         | 
| 33 | 
            +
                  Roart::History.should_receive(:get_page).and_return(@page)
         | 
| 34 | 
            +
                  @histories = Roart::History.default(:ticket => @ticket)
         | 
| 35 | 
            +
                end
         | 
| 36 | 
            +
                
         | 
| 37 | 
            +
                it 'should have the right number of histories' do
         | 
| 38 | 
            +
                  @histories.size.should == 5
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
                
         | 
| 41 | 
            +
                it 'should have a ticket' do
         | 
| 42 | 
            +
                  @histories.first.ticket.should == @ticket
         | 
| 43 | 
            +
                end
         | 
| 44 | 
            +
                
         | 
| 45 | 
            +
                it 'should have an id' do
         | 
| 46 | 
            +
                  @histories.first.id.should == 34725
         | 
| 47 | 
            +
                end
         | 
| 48 | 
            +
                
         | 
| 49 | 
            +
                it 'should return itself for all' do
         | 
| 50 | 
            +
                  @histories.all.should == @histories
         | 
| 51 | 
            +
                end
         | 
| 52 | 
            +
                
         | 
| 53 | 
            +
                it 'should return the ticket' do
         | 
| 54 | 
            +
                  @histories.ticket.should == @ticket
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
                
         | 
| 57 | 
            +
              end
         | 
| 58 | 
            +
              
         | 
| 59 | 
            +
            end 
         | 
| @@ -46,4 +46,26 @@ describe 'ticket page' do | |
| 46 46 |  | 
| 47 47 | 
             
              end
         | 
| 48 48 |  | 
| 49 | 
            +
              describe 'ticket history hash' do
         | 
| 50 | 
            +
                
         | 
| 51 | 
            +
                before do
         | 
| 52 | 
            +
                  @page = File.open(File.join(File.dirname(__FILE__), %w[ .. test_data single_history.txt])).readlines.join
         | 
| 53 | 
            +
                  @page = @page.split("\n")
         | 
| 54 | 
            +
                  @page.extend(Roart::TicketPage)
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
                
         | 
| 57 | 
            +
                it 'should give back the hash of history' do
         | 
| 58 | 
            +
                  @page.to_history_hash.class.should == Hash
         | 
| 59 | 
            +
                end
         | 
| 60 | 
            +
                
         | 
| 61 | 
            +
                it 'should have some content' do
         | 
| 62 | 
            +
                  @page.to_history_hash[:content].should_not be_nil
         | 
| 63 | 
            +
                end
         | 
| 64 | 
            +
                
         | 
| 65 | 
            +
                it 'should have the create type' do
         | 
| 66 | 
            +
                  @page.to_history_hash[:type].should == 'Create'
         | 
| 67 | 
            +
                end
         | 
| 68 | 
            +
                
         | 
| 69 | 
            +
              end
         | 
| 70 | 
            +
              
         | 
| 49 71 | 
             
            end
         | 
    
        data/spec/roart/ticket_spec.rb
    CHANGED
    
    | @@ -296,4 +296,38 @@ describe "Ticket" do | |
| 296 296 |  | 
| 297 297 | 
             
              end
         | 
| 298 298 |  | 
| 299 | 
            +
              describe 'histories' do
         | 
| 300 | 
            +
                
         | 
| 301 | 
            +
                before(:each) do
         | 
| 302 | 
            +
                  search_array = ['1:subject']
         | 
| 303 | 
            +
                  search_array.extend(Roart::TicketPage)
         | 
| 304 | 
            +
                  full_ticket = Roart::Ticket.send(:instantiate, {:id => 1, :subject => 'subject', :full => true})
         | 
| 305 | 
            +
                  @mock_connection.should_receive(:get).with('uri').and_return('200')
         | 
| 306 | 
            +
                  @ticket = Roart::Ticket.send(:instantiate, search_array.to_search_array).first
         | 
| 307 | 
            +
                  @ticket.class.should_receive(:connection).and_return(@mock_connection)
         | 
| 308 | 
            +
                  Roart::History.should_receive(:uri_for).with(@ticket).and_return('uri')
         | 
| 309 | 
            +
                end
         | 
| 310 | 
            +
                
         | 
| 311 | 
            +
                it 'should return history objects' do
         | 
| 312 | 
            +
                  @ticket.histories.class.should == Roart::HistoryArray
         | 
| 313 | 
            +
                end
         | 
| 314 | 
            +
                
         | 
| 315 | 
            +
                it 'should have a default of the ticket id' do
         | 
| 316 | 
            +
                  @ticket.histories.ticket.should == @ticket
         | 
| 317 | 
            +
                end
         | 
| 318 | 
            +
                
         | 
| 319 | 
            +
                it 'should only spawn 1 dup class for each ticket' do
         | 
| 320 | 
            +
                  @ticket.histories.should === @ticket.histories
         | 
| 321 | 
            +
                end
         | 
| 322 | 
            +
                
         | 
| 323 | 
            +
                it 'should have a last history that is equal to the last value' do
         | 
| 324 | 
            +
                  @ticket.histories.last.should == @ticket.histories[@ticket.histories.size - 1]
         | 
| 325 | 
            +
                end
         | 
| 326 | 
            +
                
         | 
| 327 | 
            +
                it 'should have count, which is equal to size' do
         | 
| 328 | 
            +
                  @ticket.histories.count.should == @ticket.histories.size
         | 
| 329 | 
            +
                end
         | 
| 330 | 
            +
                
         | 
| 331 | 
            +
              end
         | 
| 332 | 
            +
              
         | 
| 299 333 | 
             
            end
         | 
| @@ -0,0 +1,126 @@ | |
| 1 | 
            +
            RT/3.6.6 200 Ok
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # 5/5 (id/34725/total)
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            id: 34725
         | 
| 6 | 
            +
            Ticket: 12345
         | 
| 7 | 
            +
            TimeTaken: 0
         | 
| 8 | 
            +
            Type: Create
         | 
| 9 | 
            +
            Field: 
         | 
| 10 | 
            +
            OldValue: 
         | 
| 11 | 
            +
            NewValue: 
         | 
| 12 | 
            +
            Data: 
         | 
| 13 | 
            +
            Description: Ticket created by Dallas-stezuohc@LEESSUMMITHONDA.COM
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            Content: Now you can get big real fast at an affordable price
         | 
| 16 | 
            +
                     http://www.lameppe.com/
         | 
| 17 | 
            +
             | 
| 18 | 
            +
             | 
| 19 | 
            +
            Creator: Dallas-stezuohc@LEESSUMMITHONDA.COM
         | 
| 20 | 
            +
            Created: 2008-06-03 09:24:32
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            Attachments: 
         | 
| 23 | 
            +
                         16377: untitled (77b)
         | 
| 24 | 
            +
                         16379: untitled (248b)
         | 
| 25 | 
            +
             | 
| 26 | 
            +
             | 
| 27 | 
            +
            --
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            # 5/5 (id/34727/total)
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            id: 34727
         | 
| 32 | 
            +
            Ticket: 12345
         | 
| 33 | 
            +
            TimeTaken: 0
         | 
| 34 | 
            +
            Type: EmailRecord
         | 
| 35 | 
            +
            Field: 
         | 
| 36 | 
            +
            OldValue: 
         | 
| 37 | 
            +
            NewValue: 
         | 
| 38 | 
            +
            Data: <rt-3.6.6-50432-1212485073-937.12345-456-0@somewhere.com>
         | 
| 39 | 
            +
            Description: Outgoing email recorded by RT_System
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            Content: 
         | 
| 42 | 
            +
                     Greetings,
         | 
| 43 | 
            +
                     
         | 
| 44 | 
            +
                     This message has been automatically generated in response to the creation of a trouble ticket at Somewhere Technical Support regarding:
         | 
| 45 | 
            +
                     	"SUPPORT EMAIL: Somewhere- 2 pills a day and you will be good"
         | 
| 46 | 
            +
                     
         | 
| 47 | 
            +
                     There is no need to reply to this message right now.  Your ticket has been
         | 
| 48 | 
            +
                     assigned an ID of [RequestTracker #12345].
         | 
| 49 | 
            +
                     
         | 
| 50 | 
            +
                     Please include the ID in the subject line, or "reply" to this message, for all future correspondence about this issue.
         | 
| 51 | 
            +
                     
         | 
| 52 | 
            +
                     You can also call us 24 hours a day, 7 days a week.
         | 
| 53 | 
            +
                     
         | 
| 54 | 
            +
                     We appreciate your business!
         | 
| 55 | 
            +
                     
         | 
| 56 | 
            +
                     Sincerely,
         | 
| 57 | 
            +
                     
         | 
| 58 | 
            +
                     Somewhere Technical Support Team
         | 
| 59 | 
            +
                     
         | 
| 60 | 
            +
                     Thank you,
         | 
| 61 | 
            +
                     support@somewhere.com
         | 
| 62 | 
            +
                     1-800-468-3474
         | 
| 63 | 
            +
                     
         | 
| 64 | 
            +
                     -------------------------------------------------------------------------
         | 
| 65 | 
            +
                     Now you can get big real fast at an affordable price
         | 
| 66 | 
            +
                     http://www.lameppe.com/
         | 
| 67 | 
            +
             | 
| 68 | 
            +
             | 
| 69 | 
            +
            Creator: RT_System
         | 
| 70 | 
            +
            Created: 2008-06-03 09:24:33
         | 
| 71 | 
            +
            Attachments: 
         | 
| 72 | 
            +
             | 
| 73 | 
            +
            --
         | 
| 74 | 
            +
             | 
| 75 | 
            +
            # 5/5 (id/34871/total)
         | 
| 76 | 
            +
             | 
| 77 | 
            +
            id: 34871
         | 
| 78 | 
            +
            Ticket: 12345
         | 
| 79 | 
            +
            TimeTaken: 0
         | 
| 80 | 
            +
            Type: Take
         | 
| 81 | 
            +
            Field: Owner
         | 
| 82 | 
            +
            OldValue: 10
         | 
| 83 | 
            +
            NewValue: 527
         | 
| 84 | 
            +
            Data: 
         | 
| 85 | 
            +
            Description: Taken by someone
         | 
| 86 | 
            +
            Content: This transaction appears to have no content
         | 
| 87 | 
            +
            Creator: someone
         | 
| 88 | 
            +
            Created: 2008-06-03 10:39:16
         | 
| 89 | 
            +
            Attachments: 
         | 
| 90 | 
            +
             | 
| 91 | 
            +
            --
         | 
| 92 | 
            +
             | 
| 93 | 
            +
            # 5/5 (id/34883/total)
         | 
| 94 | 
            +
             | 
| 95 | 
            +
            id: 34883
         | 
| 96 | 
            +
            Ticket: 12345
         | 
| 97 | 
            +
            TimeTaken: 0
         | 
| 98 | 
            +
            Type: Comment
         | 
| 99 | 
            +
            Field: 
         | 
| 100 | 
            +
            OldValue: 
         | 
| 101 | 
            +
            NewValue: 
         | 
| 102 | 
            +
            Data: No Subject
         | 
| 103 | 
            +
            Description: Comments added by someone
         | 
| 104 | 
            +
            Content: SPAM
         | 
| 105 | 
            +
            Creator: someone
         | 
| 106 | 
            +
            Created: 2008-06-03 10:39:49
         | 
| 107 | 
            +
            Attachments: 
         | 
| 108 | 
            +
             | 
| 109 | 
            +
            --
         | 
| 110 | 
            +
             | 
| 111 | 
            +
            # 5/5 (id/34885/total)
         | 
| 112 | 
            +
             | 
| 113 | 
            +
            id: 34885
         | 
| 114 | 
            +
            Ticket: 12345
         | 
| 115 | 
            +
            TimeTaken: 0
         | 
| 116 | 
            +
            Type: Status
         | 
| 117 | 
            +
            Field: Status
         | 
| 118 | 
            +
            OldValue: new
         | 
| 119 | 
            +
            NewValue: deleted
         | 
| 120 | 
            +
            Data: 
         | 
| 121 | 
            +
            Description: Ticket deleted by someone
         | 
| 122 | 
            +
            Content: This transaction appears to have no content
         | 
| 123 | 
            +
            Creator: someone
         | 
| 124 | 
            +
            Created: 2008-06-03 10:39:50
         | 
| 125 | 
            +
            Attachments: 
         | 
| 126 | 
            +
             | 
| @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            RT/3.6.6 200 Ok
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # 5/5 (id/34725/total)
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            id: 34725
         | 
| 6 | 
            +
            Ticket: 12345
         | 
| 7 | 
            +
            TimeTaken: 0
         | 
| 8 | 
            +
            Type: Create
         | 
| 9 | 
            +
            Field: 
         | 
| 10 | 
            +
            OldValue: 
         | 
| 11 | 
            +
            NewValue: 
         | 
| 12 | 
            +
            Data: 
         | 
| 13 | 
            +
            Description: Ticket created by Dallas-stezuohc@LEESSUMMITHONDA.COM
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            Content: Now you can get big real fast at an affordable price
         | 
| 16 | 
            +
                     http://www.lameppe.com/
         | 
| 17 | 
            +
             | 
| 18 | 
            +
             | 
| 19 | 
            +
            Creator: Dallas-stezuohc@LEESSUMMITHONDA.COM
         | 
| 20 | 
            +
            Created: 2008-06-03 09:24:32
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            Attachments: 
         | 
| 23 | 
            +
                         16377: untitled (77b)
         | 
| 24 | 
            +
                         16379: untitled (248b)
         | 
| 25 | 
            +
             | 
| 26 | 
            +
             | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: pjdavis-roart
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors: 
         | 
| 7 7 | 
             
            - PJ Davis
         | 
| @@ -9,7 +9,7 @@ autorequire: | |
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 11 |  | 
| 12 | 
            -
            date: 2009-08- | 
| 12 | 
            +
            date: 2009-08-17 00:00:00 -07:00
         | 
| 13 13 | 
             
            default_executable: 
         | 
| 14 14 | 
             
            dependencies: 
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -41,6 +41,8 @@ extensions: [] | |
| 41 41 | 
             
            extra_rdoc_files: 
         | 
| 42 42 | 
             
            - History.txt
         | 
| 43 43 | 
             
            - README.rdoc
         | 
| 44 | 
            +
            - spec/test_data/full_history.txt
         | 
| 45 | 
            +
            - spec/test_data/single_history.txt
         | 
| 44 46 | 
             
            files: 
         | 
| 45 47 | 
             
            - History.txt
         | 
| 46 48 | 
             
            - README.rdoc
         | 
| @@ -50,6 +52,7 @@ files: | |
| 50 52 | 
             
            - lib/roart/core/array.rb
         | 
| 51 53 | 
             
            - lib/roart/core/string.rb
         | 
| 52 54 | 
             
            - lib/roart/errors.rb
         | 
| 55 | 
            +
            - lib/roart/history.rb
         | 
| 53 56 | 
             
            - lib/roart/roart.rb
         | 
| 54 57 | 
             
            - lib/roart/ticket.rb
         | 
| 55 58 | 
             
            - lib/roart/ticket_page.rb
         | 
| @@ -57,11 +60,14 @@ files: | |
| 57 60 | 
             
            - spec/roart/connection_spec.rb
         | 
| 58 61 | 
             
            - spec/roart/core/array_spec.rb
         | 
| 59 62 | 
             
            - spec/roart/core/string_spec.rb
         | 
| 63 | 
            +
            - spec/roart/history_spec.rb
         | 
| 60 64 | 
             
            - spec/roart/roart_spec.rb
         | 
| 61 65 | 
             
            - spec/roart/ticket_page_spec.rb
         | 
| 62 66 | 
             
            - spec/roart/ticket_spec.rb
         | 
| 63 67 | 
             
            - spec/roart_spec.rb
         | 
| 64 68 | 
             
            - spec/spec_helper.rb
         | 
| 69 | 
            +
            - spec/test_data/full_history.txt
         | 
| 70 | 
            +
            - spec/test_data/single_history.txt
         | 
| 65 71 | 
             
            - test/test_roart.rb
         | 
| 66 72 | 
             
            has_rdoc: true
         | 
| 67 73 | 
             
            homepage: http://github.com/pjdavis/roart
         |