Sha256: 9e6088ab5084051022698981784ac37b1f1113b51fec6ad5469c52cffbb4b34b

Contents?: true

Size: 826 Bytes

Versions: 1

Compression:

Stored size: 826 Bytes

Contents

require "spec_helper"

describe "Adapter" do
  include_context "users and tasks" do
    before(:all) do
      Class.new(ROM::Adapter::Memory) do
        def self.schemes
          [:memory]
        end

        def extend_relation_class(klass)
          klass.class_eval do
            def self.freaking_awesome?
              true
            end
          end
        end

        def extend_relation_instance(relation)
          relation.instance_eval do
            def freaking_cool?
              true
            end
          end
        end
      end
    end
  end

  before do
    setup.relation(:users)
  end

  it "can extend relation class" do
    expect(rom.relations.users.class).to be_freaking_awesome
  end

  it "can extend relation instance" do
    expect(rom.relations.users).to be_freaking_cool
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rom-0.5.0 spec/integration/adapters/extending_relations_spec.rb