Sha256: 9abcf8b235cd72c1bd70f7e10a1cc097d62267b75bbfc9095ca56e214caafd91

Contents?: true

Size: 1.43 KB

Versions: 6

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'

describe Ridley::BootstrapBinding do
  let(:host) { "reset.riotgames.com" }
  let(:options) do
    {
      server_url: "https://api.opscode.com/organizations/vialstudios",
      validator_client: "chef-validator",
      validator_path: fixtures_path.join("reset.pem").to_s,
      encrypted_data_bag_secret_path: fixtures_path.join("reset.pem").to_s,
      chef_version: "11.4.0"
    }
  end

  describe "ClassMethods" do
    subject do
      Class.new do
        include Ridley::BootstrapBinding
      end
    end

    describe ":included" do
      context "when a class includes Ridley::BootstrapBinding" do
        it "should have a validate_options class method`" do
          subject.methods.should include(:validate_options)
        end
      end
    end

    describe ":validate_options" do
      context "when server_url is not specified" do
        let(:options) { Hash.new }

        it "raises an ArgumentError" do
          expect {
            subject.validate_options(options)
          }.to raise_error(Ridley::Errors::ArgumentError)
        end
      end
    end

    context "when validator_path is not specified" do
      let(:options) do
        {
          server_url: "https://api.opscode.com/organizations/vialstudios"
        }
      end

      it "raises an ArgumentError" do
        expect {
          subject.validate_options(options)
        }.to raise_error(Ridley::Errors::ArgumentError)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ridley-0.10.2 spec/unit/ridley/mixin/bootstrap_binding_spec.rb
ridley-0.10.1 spec/unit/ridley/mixin/bootstrap_binding_spec.rb
ridley-0.10.0 spec/unit/ridley/mixin/bootstrap_binding_spec.rb
ridley-0.10.0.rc3 spec/unit/ridley/mixin/bootstrap_binding_spec.rb
ridley-0.10.0.rc2 spec/unit/ridley/mixin/bootstrap_binding_spec.rb
ridley-0.10.0.rc1 spec/unit/ridley/mixin/bootstrap_binding_spec.rb