require 'spec_helper'

class User
  include Recommendable
end

class Movie; end

describe Recommendable do
  it 'defines a list of recommendables' do
    expect(User._recommendables).to eq({})
  end

  describe '.recommended' do
    it 'raises a NameError if the recommendable has no associated class' do
      expect { User.recommended(:books) }.to raise_error
    end

    it 'creates an Association for the recommended class' do
      User.recommended(:movies)

      expect(User._recommendables[:movies]).to be_instance_of(Recommendable::Association)
    end
  end

  after do
    User._recommendables.clear
  end
end

require 'spec_helper'

class User
  include Recommendable
end

class Movie; end

describe Recommendable do
  it 'defines a list of recommendables' do
    expect(User._recommendables).to eq({})
  end

  describe '.recommended' do
    before { User.recommended(:movies) }

    it 'raises a NameError if the recommendable has no associated class' do
      expect { User.recommended(:books) }.to raise_error
    end

    it 'creates an Association for the recommended class' do
      expect(User._recommendables[:movies]).to be_instance_of(
        Recommendable::Association
      )
    end

    it 'allows accesing an association' do
      expect(User.reflect_on_recommendable(:movies)).to eq(
        User._recommendables[:movies]
      )
    end
  end

  after do
    User._recommendables.clear
  end
end

Add missing test for reflect_on_recommendable
Add missing test for reflect_on_recommendable

Signed-off-by: David Celis <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@davidcel.is>
