Sha256: 9fc8ec5b8b545cf35875519c78ba23eb8585a17ab91658373e5da126daed4926

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

describe Qa::Authorities::LocalSubauthority do

  let :test do
    class TestClass
      include Qa::Authorities::LocalSubauthority
    end
    TestClass.new
  end

  describe "#sub_authorities_path" do
    before do
      @original_path = AUTHORITIES_CONFIG[:local_path]
    end
    after do
      AUTHORITIES_CONFIG[:local_path] = @original_path
    end
    context "configured with a full path" do
      before do
        AUTHORITIES_CONFIG[:local_path] = "/full/path"
      end
      it "returns a full path" do
        expect(test.sub_authorities_path).to eq(AUTHORITIES_CONFIG[:local_path])
      end
    end
    context "configured with a relative path" do
      before do
        AUTHORITIES_CONFIG[:local_path] = "relative/path"
      end
      it "returns a path relative to the Rails applicaition" do
        expect(test.sub_authorities_path).to eq(File.join(Rails.root, AUTHORITIES_CONFIG[:local_path]))
      end
    end
  end

  describe "#names" do  
    it "returns a list of yaml files" do
      expect(test.names).to include("authority_A", "authority_B", "authority_C", "authority_D", "states")
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
qa-0.4.2 spec/lib/authorities_local_subauthorities_spec.rb
qa-0.4.1 spec/lib/authorities_local_subauthorities_spec.rb
qa-0.4.0 spec/lib/authorities_local_subauthorities_spec.rb