Sha256: b33174a0b2b25b79eff86cd7b911090666000431c0aebcaf71ab98cf600fe047

Contents?: true

Size: 831 Bytes

Versions: 23

Compression:

Stored size: 831 Bytes

Contents

shared_examples_for "a model with first-class properties" do
  describe "properties" do
    let(:instance) { FactoryGirl.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

23 entries across 23 versions & 1 rubygems

Version Path
g5_updatable-0.20.3.pre.1 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.10.3 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.10.2 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.10.1 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.10.0 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.9.0 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.8.0 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.7.2 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.7.1 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.7.0 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.6.1 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.6.0 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.5.1 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.5.0 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.4.3 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.4.2 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.4.1 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.4.0 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.3.5 spec/support/shared_examples_for_first_class_properties_json.rb
g5_updatable-0.3.4 spec/support/shared_examples_for_first_class_properties_json.rb