Sha256: feb1b281d7cfe560f2d61e7a5013eaea2c87728530e1850b0fa1e56cf8a19263

Contents?: true

Size: 830 Bytes

Versions: 1

Compression:

Stored size: 830 Bytes

Contents

shared_examples_for "a model with first-class properties" do
  describe "properties" do
    let(:instance) { FactoryBot.build(instance_factory_name, properties: { key: "value" }) }

    context "when properties are on an instance from the database" do
      before do
        instance.save!
      end
      subject { instance.class.find(instance.id) }

      its(:key) { should eq("value") }
    end

    context "when properties were set on an in-memory instance" do
      context "trying to access an existing property" do
        subject { instance.key }
        it { should eq("value") }
      end

      context "trying to access an nonexistent property" do
        subject { instance.bad }

        it "blows up normally" do
          expect { subject }.to raise_error(NoMethodError)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
g5_updatable-1.0.2.pre.1 spec/support/shared_examples_for_first_class_properties_json.rb