Sha256: a243675873a01f53dd0fd55653c5940dec38ac05a8d3d0853e73df57c8abd7e7
Contents?: true
Size: 1.12 KB
Versions: 5
Compression:
Stored size: 1.12 KB
Contents
require 'spec_helper' describe Unread::Base do before :each do @email = Email.create! wait @reader = Reader.create! :name => 'John' end describe :acts_as_reader do it "should create global read mark" do expect(@reader.read_marks.count).to eq 1 expect(@reader.read_marks.global.count).to eq 1 end it "should define association for ReadMark" do expect(@reader.read_marks.first.reader).to eq(@reader) end it "should reset read_marks for created reader" do expect(Email.unread_by(@reader)).to be_empty end it "should memoize read_mark_global" do expect { rm1 = @reader.read_mark_global(Email) rm2 = @reader.read_mark_global(Email) }.to perform_queries(1) end end describe :acts_as_readable do it "should define association" do expect(@email.read_marks.count).to eq 0 end it "should add class to ReadMark.readable_classes" do expect(ReadMark.readable_classes).to eq [ Document ] end it "should use default options" do expect(Email.readable_options).to eq({ :on => :updated_at }) end end end
Version data entries
5 entries across 5 versions & 1 rubygems