cirandas.net

ref: master

spec/concerns/metadata_scopes_spec.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
require 'spec_helper'

shared_examples_for "having metadata" do
  let(:model) { described_class } # the class that includes the concern

  it "fetchs by metadata key and value" do
    instance = fast_create(model)
    instance.metadata['cool'] = 'nice'
    instance.save!
    expect(model.with_metadata(cool: 'nice')).to eq([instance])
  end
end