Sha256: 8988f70386f9e851369a0dc13c9ca72cd5385f9d601c96c2662535cfac87e19d
Contents?: true
Size: 937 Bytes
Versions: 3
Compression:
Stored size: 937 Bytes
Contents
require "spec_helper" describe Findable::Associations::ActiveRecordExt do # ActiveRecord models let(:user) { User.first } let(:user2) { User.second } let(:status) { Status.take } # Findable models let(:image) { Image.take } describe "#has_many" do it { expect(user.purchase_histories).to be_kind_of(Findable::Collection) } it { expect(user.purchase_histories.first).to be_kind_of(PurchaseHistory) } it { expect(user.comments).to be_kind_of(ActiveRecord::Relation) } it { expect(user.comments.first).to be_kind_of(Comment) } end describe "#has_one" do it { expect(user.image).to be_kind_of(Image) } it { expect(user.status).to be_kind_of(Status) } end describe "#belongs_to" do it { expect(image.user).to be_kind_of(User) } it { expect(status.user).to be_kind_of(User) } it { image.user = user2 expect(image).to have_attributes(user_id: user2.id) } end end
Version data entries
3 entries across 3 versions & 1 rubygems