Sha256: 9cf7fb2dbf3286fea4c67621ad184049b491dc882191feb3739c0ccb2c242ba3

Contents?: true

Size: 1.18 KB

Versions: 16

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'
require 'natives/catalog/validator'

describe Natives::Catalog::Validator do

  describe "#ensure_valid_catalog_groups" do
    let(:validator) { Natives::Catalog::Validator.new }

    it "ensures catalog groups is a hash" do
      expect {
        validator.ensure_valid_catalog_groups({"rubygems" => {} })
      }.not_to raise_error
    end

    it "raises error if catalog groups is not a hash" do
      expect {
        validator.ensure_valid_catalog_groups([])
      }.to raise_error ArgumentError
    end

    it "allows catalog groups to be empty" do
      expect {
        validator.ensure_valid_catalog_groups({})
      }.not_to raise_error
    end

    it "ensures each catalog group's value is a hash" do
      expect {
        validator.ensure_valid_catalog_groups({"rubygems" => {"a" => "b"} })
      }.not_to raise_error
    end

    it "raises error if any catalog group's value is not a hash" do
      expect {
        validator.ensure_valid_catalog_groups({
          "rubygems" => {},
          "npm" => nil,
          "foo" => []
        })
      }.to raise_error(ArgumentError,
          "The following catalog group(s) should be a Hash: npm, foo")
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
natives-0.6.2 spec/natives/catalog/validator_spec.rb
natives-0.6.1 spec/natives/catalog/validator_spec.rb
natives-0.6.0 spec/natives/catalog/validator_spec.rb
natives-0.5.5 spec/natives/catalog/validator_spec.rb
natives-0.5.4 spec/natives/catalog/validator_spec.rb
natives-0.5.3 spec/natives/catalog/validator_spec.rb
natives-0.5.2 spec/natives/catalog/validator_spec.rb
natives-0.5.1 spec/natives/catalog/validator_spec.rb
natives-0.5.0 spec/natives/catalog/validator_spec.rb
natives-catalog-0.3.4 spec/natives/catalog/validator_spec.rb
natives-catalog-0.3.3 spec/natives/catalog/validator_spec.rb
natives-catalog-0.3.2 spec/natives/catalog/validator_spec.rb
natives-catalog-0.3.1 spec/natives/catalog/validator_spec.rb
natives-catalog-0.3.0 spec/natives/catalog/validator_spec.rb
natives-catalog-0.2.1 spec/natives/catalog/validator_spec.rb
natives-catalog-0.2.0 spec/natives/catalog/validator_spec.rb