Sha256: c0bd777d066f1458e247a09fda38db37ea438d4de819c865f81e5ea02c622ece

Contents?: true

Size: 1.14 KB

Versions: 6

Compression:

Stored size: 1.14 KB

Contents

require "spec_helper"

describe Arrthorizer::Context do
  describe :merge do
    let(:base_hash) { { key: 'value' } }
    let(:base_context) { Arrthorizer::Context.new(base_hash) }
    let(:other_hash) { { other_key: 'other_value' } }
    let(:merged_hash) { base_hash.merge(other_hash) }

    shared_examples_for "the return value of Arrthorizer::Context#merge" do
      it "returns an Arrthorizer::Context" do
        result.should be_an Arrthorizer::Context
      end

      describe "the returned Arrthorizer::Context" do
        it "contains the merged contents" do
          merged_hash.each_pair do |key, value|
            result.send(key).should == value
          end
        end
      end
    end

    context "when another Arrthorizer::Context is provided" do
      let(:other_context) { Arrthorizer::Context.new(other_hash) }
      let(:result) { base_context.merge(other_context) }

      include_examples "the return value of Arrthorizer::Context#merge"
    end

    context "when a Hash is provided" do
      let(:result) { base_context.merge(other_hash) }

      include_examples "the return value of Arrthorizer::Context#merge"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
arrthorizer-0.1.3 spec/context/merge_spec.rb
arrthorizer-0.1.2 spec/context/merge_spec.rb
arrthorizer-0.1.1 spec/context/merge_spec.rb
arrthorizer-0.1.0 spec/context/merge_spec.rb
arrthorizer-0.1.0.pre2 spec/context/merge_spec.rb
arrthorizer-0.1.0.pre spec/context/merge_spec.rb