Sha256: 553d78a5d6ca52f380b847f1290cf8a1b2e1446bc51f1ccb50a63c2250193613

Contents?: true

Size: 1023 Bytes

Versions: 2

Compression:

Stored size: 1023 Bytes

Contents

require 'spec_helper'

describe Trackerific::Services do
  describe "#[]=" do
    context "with a Trackerific::Services::Base" do
      it "should add service" do
        Trackerific::Services[:test] = TestService
        Trackerific::Services[:test].should eq TestService
      end
    end

    context "with a class other than Trackerific::Services::Base" do
      it "should raise an ArgumentError" do
        expect {
          Trackerific::Services[:string] = String
        }.to raise_error ArgumentError
      end
    end
  end

  describe "#[]" do
    it "should find registered services" do
      Trackerific::Services[:another_test_service].should eq AnotherTestService
    end

    it "should return nil for unknown services" do
      Trackerific::Services[:not_found].should be_nil
    end
  end

  describe "#find_by_package_id" do
    let(:id) { "TEST" }
    subject { Trackerific::Services.find_by_package_id(id) }
    it { should include TestService }
    it { should include AnotherTestService }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trackerific-0.7.1 spec/lib/trackerific/services_spec.rb
trackerific-0.7.0 spec/lib/trackerific/services_spec.rb