Sha256: 9503cac9e425969f0ec0a3dff6828ea65fa4f43b813a8e37c3fd278560dd4928

Contents?: true

Size: 1.67 KB

Versions: 8

Compression:

Stored size: 1.67 KB

Contents

require "spec_helper"

describe Arrthorizer::Context do
  describe :initialize do
    context "when a Hash is provided" do
      let(:attributes) { { a: 2 } }

      it "copies the keys into the new Context object" do
        context = Arrthorizer::Context.new(attributes)

        expect(context.a).to eq 2
      end
    end

    context "when an OpenStruct is provided" do
      let(:attributes) { OpenStruct.new(a: 2) }

      it "copies the keys into the new Context object" do
        context = Arrthorizer::Context.new(attributes)

        expect(context.a).to eq 2
      end
    end

    context "when an Arrthorizer::Context is provided" do
      let(:attributes) { Arrthorizer::Context.new(a: 2) }

      it "copies the keys into the new Context object" do
        context = Arrthorizer::Context.new(attributes)

        expect(context.a).to eq 2
      end
    end
  end

  describe "DSL-style initialization" do
    context "when a Hash is provided" do
      let(:attributes) { { a: 2 } }

      it "copies the keys into the new Context object" do
        context = Arrthorizer::Context(attributes)

        expect(context.a).to eq 2
      end
    end

    context "when an OpenStruct is provided" do
      let(:attributes) { OpenStruct.new(a: 2) }

      it "copies the keys into the new Context object" do
        context = Arrthorizer::Context(attributes)

        expect(context.a).to eq 2
      end
    end

    context "when an Arrthorizer::Context is provided" do
      let(:attributes) { Arrthorizer::Context(a: 2) }

      it "copies the keys into the new Context object" do
        context = Arrthorizer::Context(attributes)

        expect(context.a).to eq 2
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
arrthorizer-0.4.2 spec/context/initialize_spec.rb
arrthorizer-0.4.1 spec/context/initialize_spec.rb
arrthorizer-0.3.2 spec/context/initialize_spec.rb
arrthorizer-0.3.1 spec/context/initialize_spec.rb
arrthorizer-0.3.0 spec/context/initialize_spec.rb
arrthorizer-0.2.1 spec/context/initialize_spec.rb
arrthorizer-0.2.0 spec/context/initialize_spec.rb
arrthorizer-0.1.3 spec/context/initialize_spec.rb