Sha256: 79554692d5f617510ad145b3f4a7a55749a226db026ab3dfec3a4a213e35910f

Contents?: true

Size: 1.83 KB

Versions: 9

Compression:

Stored size: 1.83 KB

Contents

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

describe "RulesEngine::Publish::Publisher" do

  describe "setting the publisher" do
    it "should set the publisher as a instance of a class" do
      mock_publisher = mock('mock_publisher')
      RulesEngine::Publish.publisher = mock_publisher
      RulesEngine::Publish.publisher.should == mock_publisher
    end

    it "should set the publisher to the database plan publisher" do
      RulesEngine::Publish.publisher = :db_publisher
      RulesEngine::Publish.publisher.should be_instance_of(RulesEngine::Publish::DbPublisher)
    end
  end
  
  describe "getting the publisher" do
    it "should throw an exception if the publisher is not set" do
      RulesEngine::Publish.publisher = nil
      
      lambda {
        RulesEngine::Publish.publisher
      }.should raise_error
    end        
  end
  
  describe "publishing a plan" do
    it "should throw an error if not overwritten" do
      lambda {
        RulesEngine::Publish::Publisher.new.publish('code', 'version_tag', 'data')
      }.should raise_error
    end
  end

  describe "getting a plan" do
    it "should throw an error if not overwritten" do
      lambda {
        RulesEngine::Publish::Publisher.new.get('code', '1.0.0.1')
      }.should raise_error
    end
  end

  describe "getting the history" do
    it "should throw an error if not overwritten" do
      lambda {
        RulesEngine::Publish::Publisher.new.history('code', {:dummy => "option"})
      }.should raise_error
    end
  end
  
  describe "removing a plan" do
    it "should throw an error if not overwritten" do
      lambda {
        RulesEngine::Publish::Publisher.new.remove('code')
      }.should raise_error
      
      lambda {
        RulesEngine::Publish::Publisher.new.remove('code', 1)
      }.should raise_error
      
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rules_engine-0.2.0 spec/rules_engine/publish/publisher_spec.rb
rules_engine-0.1.10 spec/rules_engine/publish/publisher_spec.rb
rules_engine-0.1.9 spec/rules_engine/publish/publisher_spec.rb
rules_engine-0.1.8 spec/rules_engine/publish/publisher_spec.rb
rules_engine-0.1.7 spec/rules_engine/publish/publisher_spec.rb
rules_engine-0.1.6 spec/rules_engine/publish/publisher_spec.rb
rules_engine-0.1.5 spec/rules_engine/publish/publisher_spec.rb
rules_engine-0.1.4 spec/rules_engine/publish/publisher_spec.rb
rules_engine-0.1.3 spec/rules_engine/publish/publisher_spec.rb