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
relevance-castronaut-0.5.4 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.6.0 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.6.1 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.7.4 spec/castronaut/ticket_result_spec.rb
relevance-castronaut-0.7.5 spec/castronaut/ticket_result_spec.rb
nbudin-castronaut-0.7.5 spec/castronaut/ticket_result_spec.rb
factorylabs-castronaut-0.7.5 spec/castronaut/ticket_result_spec.rb