Sha256: cb93ec4f01f2a2ffcf3664145fdb30ff04a62d73bc8c1467ea45b8dabf6b1d13

Contents?: true

Size: 1.23 KB

Versions: 27

Compression:

Stored size: 1.23 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Castronaut::TicketResult do
  
  it "exposes the given ticket at :ticket" do
    Castronaut::TicketResult.new('ticket').ticket.should == 'ticket'
  end
  
  it "exposes the given message at :message" do
    Castronaut::TicketResult.new('ticket', 'my error').message.should == 'my error'
  end
  
  it "exposes the given message category at :message_category" do
    Castronaut::TicketResult.new('ticket', 'my error', 'message cat').message_category.should == 'message cat'
  end
  
  describe "valid?" do

    it "negates invalid? for it's result" do
      ticket_result = Castronaut::TicketResult.new('ticket', 'msg', 'cat')
      ticket_result.stub!(:invalid?).and_return(false)
      ticket_result.should be_valid
      
      ticket_result.stub!(:invalid?).and_return(true)
      ticket_result.should_not be_valid
    end
  
  end
  
  describe "invalid?" do
    
    Castronaut::TicketResult::InvalidMessageCategories.each do |invalid_category|
    
      it "is invalid if the message category contains #{invalid_category}" do
        Castronaut::TicketResult.new('ticket', 'my error', "BlaBlaBla-#{invalid_category}-AlbAlbAlb").should be_invalid
      end
      
    end
    
  end
  
end

Version data entries

27 entries across 27 versions & 6 rubygems

Version Path
3mix-castronaut-0.5.0.2 spec/castronaut/ticket_result_spec.rb
masover-castronaut-0.4.4.4 spec/castronaut/ticket_result_spec.rb
masover-castronaut-0.4.4.5 spec/castronaut/ticket_result_spec.rb
masover-castronaut-0.5.0.1 spec/castronaut/ticket_result_spec.rb
p8-castronaut-0.6.1.1 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.2.0 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.2.5 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.3.0 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.3.5 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.3.6 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.4.1 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.4.2 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.4.3 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.4.4 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.4.5 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.4.6 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.5.0 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.5.1 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.5.2 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.5.3 spec/castronaut/ticket_result_spec.rb