Sha256: b10c07f8474b228aa6ca8d719620cf363bcd317947e6752464d6b1935c899837

Contents?: true

Size: 955 Bytes

Versions: 16

Compression:

Stored size: 955 Bytes

Contents

require "spec_helper"

describe Her::Collection do
  let(:items) { [1, 2, 3, 4] }
  let(:metadata) { { name: "Testname" } }
  let(:errors) { { name: ["not_present"] } }

  describe "#new" do
    context "without parameters" do
      subject { Her::Collection.new }

      it { is_expected.to eq([]) }

      describe "#metadata" do
        subject { super().metadata }
        it { is_expected.to eq({}) }
      end

      describe "#errors" do
        subject { super().errors }
        it { is_expected.to eq({}) }
      end
    end

    context "with parameters" do
      subject { Her::Collection.new(items, metadata, errors) }

      it { is_expected.to eq([1, 2, 3, 4]) }

      describe "#metadata" do
        subject { super().metadata }
        it { is_expected.to eq(name: "Testname") }
      end

      describe "#errors" do
        subject { super().errors }
        it { is_expected.to eq(name: ["not_present"]) }
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
her-1.1.1 spec/collection_spec.rb
her-1.1.0 spec/collection_spec.rb
her-0.10.4 spec/collection_spec.rb
her-1.0.3 spec/collection_spec.rb
her-0.10.3 spec/collection_spec.rb
her-1.0.2 spec/collection_spec.rb
her-0.10.2 spec/collection_spec.rb
her-1.0.1 spec/collection_spec.rb
her-1.0.0 spec/collection_spec.rb
her-0.10.1 spec/collection_spec.rb
her-0.10.0 spec/collection_spec.rb
her-0.9.0 spec/collection_spec.rb
her-0.8.6 spec/collection_spec.rb
her-0.8.5 spec/collection_spec.rb
her-0.8.4 spec/collection_spec.rb
her-0.8.3 spec/collection_spec.rb