Sha256: 0424fbb40be27b0b555ebfa78eb61c07b88e59d31ccc9beb999fe448e202030e

Contents?: true

Size: 959 Bytes

Versions: 1

Compression:

Stored size: 959 Bytes

Contents

# encoding: utf-8

describe QueryBuilder::Core::Base do

  let(:klass) { Class.new(described_class) { attribute :foo } }

  describe ".new" do
    shared_examples :object_constructor do
      it "[is immutable]" do
        expect(subject).to be_frozen
      end

      it "[doesn't freeze attributes]" do
        expect { subject }.not_to change { attributes.frozen? }
      end

      it "[initializes #attributes]" do
        expect(subject.attributes).to eql attributes
      end
    end

    it_behaves_like :object_constructor do
      subject { klass.new(attributes) }
      let(:attributes) { { foo: :FOO } }
    end

    it_behaves_like :object_constructor do
      subject { klass.new }
      let(:attributes) { { foo: nil } }
    end
  end # describe .new

  describe "#to_s" do
    subject { klass.new.to_s }

    it "returns empty string" do
      expect(subject).to eql("")
    end
  end # describe #to_s

end # describe QueryBuilder::Core::Base

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
query_builder-0.0.4 spec/unit/core/base_spec.rb