Sha256: 3ba9d66cba49866c884f8f495048253e7674d0b289c5261883942439e27f4120

Contents?: true

Size: 1.4 KB

Versions: 5

Compression:

Stored size: 1.4 KB

Contents

require File.join(File.dirname(__FILE__), %w[ .. spec_helper])

describe 'ticket page' do
  
  describe 'ticket hash' do
    
    it 'should convert an array to a hash' do
      array = ["id : 10", "subject : asdf"]
      array.extend(Roart::TicketPage)
      hash = array.to_hash
      hash.has_key?(:id).should be_true
      hash[:id].should == 10
      hash[:subject].should == 'asdf'
    end
  
  end
  
  describe 'search array' do
    
    before do
      @array = ["123 : Subject", "234 : Subject"]
      @array.extend(Roart::TicketPage)
      @array = @array.to_search_array
    end
    
    it 'should make an array of search results' do
      @array.size.should == 2
    end
    
    it 'should put search elements into the search array' do
      @array.first[:id].should == 123
      @array.last[:id].should == 234
    end
    
  end
  
  describe 'ticket history hash' do
    
    before do
      @page = File.open(File.join(File.dirname(__FILE__), %w[ .. test_data single_history.txt])).readlines.join
      @page = @page.split("\n")
      @page.extend(Roart::TicketPage)
    end
    
    it 'should give back the hash of history' do
      @page.to_history_hash.class.should == Hash
    end
    
    it 'should have some content' do
      @page.to_history_hash[:content].should_not be_nil
    end
    
    it 'should have the create type' do
      @page.to_history_hash[:type].should == 'Create'
    end
    
  end
  
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
pjdavis-roart-0.1.3 spec/roart/ticket_page_spec.rb
pjdavis-roart-0.1.4 spec/roart/ticket_page_spec.rb
roart-0.1.5 spec/roart/ticket_page_spec.rb
threetee-roart-0.1.4 spec/roart/ticket_page_spec.rb
roart-0.1.4 spec/roart/ticket_page_spec.rb