Sha256: b0b085554bd575c55ce1764e6b4ede79b11c2ec711d3d583ab60f95440757758
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 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.user).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 [ Email ] end it "should use default options" do expect(Email.readable_options).to eq({ :on => :updated_at }) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
unread-0.6.2 | spec/base_spec.rb |
unread-0.6.1 | spec/base_spec.rb |
unread-0.6.0 | spec/base_spec.rb |