activist 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activist (0.0.4)
4
+ activist (0.0.5)
5
5
  activesupport (~> 3.0)
6
6
  redis (~> 2.2)
7
7
  redis-namespace (= 0.10.0)
@@ -16,7 +16,7 @@ module Activist
16
16
 
17
17
  def all(options={})
18
18
  options[:offset] ||= 0
19
- options[:limit] ||= size.to_i
19
+ options[:limit] ||= size
20
20
  activities = Redis.execute.lrange(to_key, options[:offset], options[:offset] + options[:limit])
21
21
  ::ActivistStatus.where(:id => activities)
22
22
  end
@@ -1,3 +1,3 @@
1
1
  module Activist
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -1,14 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Activist do
4
- before :all do
5
- @region = Region.create!(:name => 'Mazovia')
6
- @kate = User.create!(:name => 'Kate', :regions => Region.all)
7
- @john = User.create!(:name => 'John', :regions => Region.all)
8
- @note = Note.create!(:note => 'Note by Kate', :user => @kate)
4
+ after do
5
+ Activist::Redis.execute.flushall
9
6
  end
10
7
 
11
8
  context 'actor' do
9
+ before do
10
+ @region = Region.create!(:name => 'Mazovia')
11
+ @kate = User.create!(:name => 'Kate', :regions => Region.all)
12
+ end
13
+
12
14
  it 'should create streams for actor' do
13
15
  @kate.public_stream.should be_kind_of Activist::Stream
14
16
  @kate.regional_stream.should be_kind_of Activist::Stream
@@ -17,6 +19,12 @@ describe Activist do
17
19
  end
18
20
 
19
21
  context 'action' do
22
+ before do
23
+ @region = Region.create!(:name => 'Mazovia')
24
+ @kate = User.create!(:name => 'Kate', :regions => Region.all)
25
+ @note = Note.create!(:note => 'Note by Kate', :user => @kate)
26
+ end
27
+
20
28
  it 'should define activist methods' do
21
29
  @note.public_methods.should include(:activist_regional_after_create)
22
30
  @note.public_methods.should include(:activist_private_after_create)
@@ -29,16 +37,19 @@ describe Activist do
29
37
  it 'should define activist instance methods' do
30
38
  @note.public_methods.should include(:activity)
31
39
  end
32
-
33
- it 'should not pass' do
34
- size = @kate.regional_stream.size
35
- @empty = Note.create!(:note => '', :user => @kate)
36
- @kate.regional_stream.size.should == size
37
- @present = Note.create!(:note => 'Some note', :user => @kate)
38
- @kate.regional_stream.size.should == size + 1
39
- end
40
40
  end
41
41
 
42
42
  context 'stream' do
43
+ before do
44
+ @region = Region.create!(:name => 'Mazovia')
45
+ @kate = User.create!(:name => 'Kate', :regions => Region.all)
46
+ end
47
+
48
+ it 'should be able to paginate' do
49
+ 20.times { |n| Note.create!(:note => "Note' #{n}", :user => @kate) }
50
+ @kate.private_stream.all(:offset => 0, :limit => 9).size.should == 10
51
+ @kate.private_stream.all(:offset => 10, :limit => 9).size.should == 10
52
+ @kate.private_stream.all(:offset => 20, :limit => 9).size.should == 0
53
+ end
43
54
  end
44
55
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: activist
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - "Adrian Duli\xC4\x87"