unread 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05f0404c7e8d4778e3c417c8ea555ea8281770ec
4
- data.tar.gz: d528c0105fe90d6e8e354a6828e6edf0fb5d0349
3
+ metadata.gz: d46186ae6d45d389e56f902320bbce46558ac342
4
+ data.tar.gz: 704c5a93c4967d69dd13c0ce550cccfe5af25679
5
5
  SHA512:
6
- metadata.gz: d378c5dec0dde8062d584f012b50552af831d6aac3917e7e9df201a1806b0012a35fd878279ae4bfdbe83ee45b2bda760d2eaa56b798ba061f7b380e3c4aed3a
7
- data.tar.gz: 8f3b85a26665a94e989351320c9ae6ba9b724e035170d6007333e06ae722515417e5685f9ceab0e0718f8c441fb902771ac745f72f404059a9ed0e3d07509cc9
6
+ metadata.gz: 1289afd5a3a6f531ddc2aef5ee8598d58bd0a5b5292deab7a01ed8bd044e64ed79060e53310d682d3f6da88a538e57d2a1b26830e478ddeeb7171da861053c9e
7
+ data.tar.gz: 055f316a97a375a2c6e266e1cbc34a625562d21c904c0c147b2267caaabe5c8d7d59399b3181e9cc39fc332e411a40f0953e486c8542faed0bf576c947491ecc
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'activerecord', '~> 3.1.12'
4
4
  gem 'sqlite3'
5
- gem 'mysql2'
5
+ gem 'mysql2', '~> 0.3.10'
6
6
  gem 'timecop'
7
7
  gem 'rake'
8
8
  gem 'rspec'
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'activerecord', '~> 3.2.17'
4
4
  gem 'sqlite3'
5
- gem 'mysql2'
5
+ gem 'mysql2', '~> 0.3.10'
6
6
  gem 'timecop'
7
7
  gem 'rake'
8
8
  gem 'rspec'
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'activerecord', '~> 4.0.4'
4
4
  gem 'sqlite3'
5
- gem 'mysql2'
5
+ gem 'mysql2', '~> 0.3.10'
6
6
  gem 'timecop'
7
7
  gem 'rake'
8
8
  gem 'rspec'
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'activerecord', '~> 4.1.0'
4
4
  gem 'sqlite3'
5
- gem 'mysql2'
5
+ gem 'mysql2', '~> 0.3.13'
6
6
  gem 'timecop'
7
7
  gem 'rake'
8
8
  gem 'rspec'
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'activerecord', '~> 4.2.0'
4
4
  gem 'sqlite3'
5
- gem 'mysql2'
5
+ gem 'mysql2', '~> 0.3.13'
6
6
  gem 'timecop'
7
7
  gem 'rake'
8
8
  gem 'rspec'
@@ -2,16 +2,13 @@ module Unread
2
2
  module Reader
3
3
  module ClassMethods
4
4
  def assert_readable(readable)
5
- assert_readable_class
6
-
7
- unless ReadMark.readable_classes.include?(readable.class)
8
- raise ArgumentError, "Class #{readable.class.name} is not registered by acts_as_readable."
5
+ unless readable.respond_to?(:mark_as_read!)
6
+ raise ArgumentError, "Class #{readable.class} is not registered by acts_as_readable."
9
7
  end
10
- raise ArgumentError, "The given #{readable.class.name} has no id." unless readable.id
11
- end
12
8
 
13
- def assert_readable_class
14
- raise RuntimeError, 'There is no class using acts_as_readable.' unless ReadMark.readable_classes.try(:any?)
9
+ unless readable.id
10
+ raise ArgumentError, "The given #{readable.class} has no id."
11
+ end
15
12
  end
16
13
  end
17
14
 
@@ -1,3 +1,3 @@
1
1
  module Unread
2
- VERSION = '0.6.2'
2
+ VERSION = '0.6.3'
3
3
  end
@@ -35,7 +35,7 @@ describe Unread::Base do
35
35
  end
36
36
 
37
37
  it "should add class to ReadMark.readable_classes" do
38
- expect(ReadMark.readable_classes).to eq [ Email ]
38
+ expect(ReadMark.readable_classes).to eq [ Document ]
39
39
  end
40
40
 
41
41
  it "should use default options" do
@@ -1,4 +1,7 @@
1
- class Email < ActiveRecord::Base
2
- self.primary_key = 'messageid'
1
+ class Document < ActiveRecord::Base
2
+ self.primary_key = 'uid'
3
3
  acts_as_readable :on => :updated_at
4
4
  end
5
+
6
+ class Email < Document
7
+ end
@@ -10,6 +10,6 @@ describe ReadMark do
10
10
  end
11
11
 
12
12
  it "should have readable_classes" do
13
- expect(ReadMark.readable_classes).to eq [Email]
13
+ expect(ReadMark.readable_classes).to eq [Document]
14
14
  end
15
15
  end
@@ -157,14 +157,13 @@ describe Unread::Readable do
157
157
  end
158
158
  end
159
159
 
160
-
161
160
  describe :with_read_marks_for do
162
161
  it "should return readables" do
163
162
  expect(Email.with_read_marks_for(@reader).to_a).to eq([@email1, @email2])
164
163
  end
165
164
 
166
165
  it "should be countable" do
167
- expect(Email.with_read_marks_for(@reader).count(:messageid)).to eq(2)
166
+ expect(Email.with_read_marks_for(@reader).count(:uid)).to eq(2)
168
167
  end
169
168
 
170
169
  it "should not allow invalid parameter" do
@@ -70,7 +70,8 @@ def setup_db
70
70
  t.string :name
71
71
  end
72
72
 
73
- create_table :emails, :primary_key => 'messageid', :force => true do |t|
73
+ create_table :documents, :primary_key => 'uid', :force => true do |t|
74
+ t.string :type
74
75
  t.string :subject
75
76
  t.text :content
76
77
  t.datetime :created_at
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unread
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Georg Ledermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-09 00:00:00.000000000 Z
11
+ date: 2015-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord