Sha256: 842ec73f716247d85fa23ec0dcd338f85899e8ad52a8804ecf59c2b778c04734

Contents?: true

Size: 766 Bytes

Versions: 1

Compression:

Stored size: 766 Bytes

Contents

shared_context "FindableModels" do
  before { class Tag < Findable::Base; end }
  after { Object.send(:remove_const, "Tag") }

  let(:findable_model) { Tag }
  let(:findable_instance) { Tag.new }
end

shared_context "AssociationModels" do
  before do
    class Group < Findable::Base; end
    class Tag < Findable::Base; end
    class Info < Findable::Base; end
    Group.has_many :tags
    Group.has_one :info
    Tag.belongs_to :group
    Info.belongs_to :group

    Group.query.import([{id: 1, name: "group1"}])
    Tag.query.import([
      {id: 1, name: "tag1", group_id: 1},
      {id: 2, name: "tag2", group_id: 1},
    ])
    Info.query.import([{id: 1, group_id: 1}])
  end

  after { %w(Group Tag Info).each {|name| Object.send(:remove_const, name) } }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
findable-0.1.1 spec/support/shard_contexts.rb