Permalink
Browse files

More fixes for Ruby warnings

  • Loading branch information...
1 parent 62d5539 commit 7808add1ce87cd03205e1abec8cadfcab2e86a8f @czarneckid czarneckid committed Aug 23, 2012
Showing with 55 additions and 55 deletions.
  1. +1 −1 Rakefile
  2. +3 −3 spec/activity_feed/configuration_spec.rb
  3. +42 −42 spec/activity_feed/feed_spec.rb
  4. +9 −9 spec/activity_feed/item_spec.rb
View
@@ -7,7 +7,7 @@ require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = 'spec/**/*_spec.rb'
spec.rspec_opts = ['--backtrace']
- # spec.ruby_opts = ['-w']
+ spec.ruby_opts = ['-w']
end
task :default => :spec
@@ -4,10 +4,10 @@
describe '#configure' do
it 'should have default attributes' do
ActivityFeed.configure do |configuration|
- configuration.namespace.should == 'activity_feed'
+ configuration.namespace.should eql('activity_feed')
configuration.aggregate.should be_false
- configuration.aggregate_key.should == 'aggregate'
- configuration.page_size.should == 25
+ configuration.aggregate_key.should eql('aggregate')
+ configuration.page_size.should eql(25)
end
end
end
@@ -7,9 +7,9 @@
add_items_to_feed('david')
feed = ActivityFeed.feed('david', 1)
- feed.length.should == 5
- feed[0].to_i.should == 5
- feed[4].to_i.should == 1
+ feed.length.should eql(5)
+ feed[0].to_i.should eql(5)
+ feed[4].to_i.should eql(1)
end
end
@@ -18,9 +18,9 @@
add_items_to_feed('david', 5, true)
feed = ActivityFeed.feed('david', 1, true)
- feed.length.should == 5
- feed[0].to_i.should == 5
- feed[4].to_i.should == 1
+ feed.length.should eql(5)
+ feed[0].to_i.should eql(5)
+ feed[4].to_i.should eql(1)
end
end
end
@@ -31,9 +31,9 @@
add_items_to_feed('david', 30)
feed = ActivityFeed.full_feed('david', false)
- feed.length.should == 30
- feed[0].to_i.should == 30
- feed[29].to_i.should == 1
+ feed.length.should eql(30)
+ feed[0].to_i.should eql(30)
+ feed[29].to_i.should eql(1)
end
end
@@ -42,9 +42,9 @@
add_items_to_feed('david', 30, true)
feed = ActivityFeed.full_feed('david', true)
- feed.length.should == 30
- feed[0].to_i.should == 30
- feed[29].to_i.should == 1
+ feed.length.should eql(30)
+ feed[0].to_i.should eql(30)
+ feed[29].to_i.should eql(1)
end
end
end
@@ -65,9 +65,9 @@
Timecop.return
feed = ActivityFeed.feed_between_timestamps('david', Time.local(2012, 6, 19, 4, 43, 0).to_i, Time.local(2012, 6, 19, 8, 16, 0).to_i)
- feed.length.should == 2
- feed[0].to_i.should == 4
- feed[1].to_i.should == 3
+ feed.length.should eql(2)
+ feed[0].to_i.should eql(4)
+ feed[1].to_i.should eql(3)
end
end
@@ -86,9 +86,9 @@
Timecop.return
feed = ActivityFeed.feed_between_timestamps('david', Time.local(2012, 6, 19, 4, 43, 0).to_i, Time.local(2012, 6, 19, 8, 16, 0).to_i, true)
- feed.length.should == 2
- feed[0].to_i.should == 4
- feed[1].to_i.should == 3
+ feed.length.should eql(2)
+ feed[0].to_i.should eql(4)
+ feed[1].to_i.should eql(3)
end
end
end
@@ -98,26 +98,26 @@
it 'should return the correct number of pages in the activity feed' do
add_items_to_feed('david', Leaderboard::DEFAULT_PAGE_SIZE + 1)
- ActivityFeed.total_pages_in_feed('david').should == 2
- ActivityFeed.total_pages('david').should == 2
+ ActivityFeed.total_pages_in_feed('david').should eql(2)
+ ActivityFeed.total_pages('david').should eql(2)
end
end
describe 'with aggregation' do
it 'should return the correct number of pages in the aggregate activity feed' do
add_items_to_feed('david', Leaderboard::DEFAULT_PAGE_SIZE + 1, true)
- ActivityFeed.total_pages_in_feed('david', true).should == 2
- ActivityFeed.total_pages('david', true).should == 2
+ ActivityFeed.total_pages_in_feed('david', true).should eql(2)
+ ActivityFeed.total_pages('david', true).should eql(2)
end
end
describe 'changing page_size parameter' do
it 'should return the correct number of pages in the activity feed' do
add_items_to_feed('david', 25)
- ActivityFeed.total_pages_in_feed('david', false, 4).should == 7
- ActivityFeed.total_pages('david', false, 4).should == 7
+ ActivityFeed.total_pages_in_feed('david', false, 4).should eql(7)
+ ActivityFeed.total_pages('david', false, 4).should eql(7)
end
end
end
@@ -126,13 +126,13 @@
it 'should remove the activity feeds for a given user ID' do
add_items_to_feed('david', Leaderboard::DEFAULT_PAGE_SIZE + 1, true)
- ActivityFeed.total_items_in_feed('david').should == Leaderboard::DEFAULT_PAGE_SIZE + 1
- ActivityFeed.total_items_in_feed('david', true).should == Leaderboard::DEFAULT_PAGE_SIZE + 1
+ ActivityFeed.total_items_in_feed('david').should eql(Leaderboard::DEFAULT_PAGE_SIZE + 1)
+ ActivityFeed.total_items_in_feed('david', true).should eql(Leaderboard::DEFAULT_PAGE_SIZE + 1)
ActivityFeed.remove_feeds('david')
- ActivityFeed.total_items_in_feed('david').should == 0
- ActivityFeed.total_items_in_feed('david', true).should == 0
+ ActivityFeed.total_items_in_feed('david').should eql(0)
+ ActivityFeed.total_items_in_feed('david', true).should eql(0)
end
end
@@ -141,17 +141,17 @@
it 'should return the correct number of items in the activity feed' do
add_items_to_feed('david', Leaderboard::DEFAULT_PAGE_SIZE + 1)
- ActivityFeed.total_items_in_feed('david').should == Leaderboard::DEFAULT_PAGE_SIZE + 1
- ActivityFeed.total_items('david').should == Leaderboard::DEFAULT_PAGE_SIZE + 1
+ ActivityFeed.total_items_in_feed('david').should eql(Leaderboard::DEFAULT_PAGE_SIZE + 1)
+ ActivityFeed.total_items('david').should eql(Leaderboard::DEFAULT_PAGE_SIZE + 1)
end
end
describe 'with aggregation' do
it 'should return the correct number of items in the aggregate activity feed' do
add_items_to_feed('david', Leaderboard::DEFAULT_PAGE_SIZE + 1, true)
- ActivityFeed.total_items_in_feed('david', true).should == Leaderboard::DEFAULT_PAGE_SIZE + 1
- ActivityFeed.total_items('david', true).should == Leaderboard::DEFAULT_PAGE_SIZE + 1
+ ActivityFeed.total_items_in_feed('david', true).should eql(Leaderboard::DEFAULT_PAGE_SIZE + 1)
+ ActivityFeed.total_items('david', true).should eql(Leaderboard::DEFAULT_PAGE_SIZE + 1)
end
end
end
@@ -173,9 +173,9 @@
ActivityFeed.trim_feed('david', Time.local(2012, 6, 19, 4, 29, 0).to_i, Time.local(2012, 6, 19, 8, 16, 0).to_i)
feed = ActivityFeed.feed('david', 1)
- feed.length.should == 2
- feed[0].to_i.should == 5
- feed[1].to_i.should == 1
+ feed.length.should eql(2)
+ feed[0].to_i.should eql(5)
+ feed[1].to_i.should eql(1)
end
end
@@ -195,9 +195,9 @@
ActivityFeed.trim_feed('david', Time.local(2012, 6, 19, 4, 29, 0).to_i, Time.local(2012, 6, 19, 8, 16, 0).to_i, true)
feed = ActivityFeed.feed('david', 1, true)
- feed.length.should == 2
- feed[0].to_i.should == 5
- feed[1].to_i.should == 1
+ feed.length.should eql(2)
+ feed[0].to_i.should eql(5)
+ feed[1].to_i.should eql(1)
end
end
end
@@ -210,7 +210,7 @@
end
feed = ActivityFeed.feed('david', 1)
- feed.length.should == 0
+ feed.length.should eql(0)
item = ActivityFeed::ActiveRecord::Item.create(
:user_id => 'david',
@@ -221,7 +221,7 @@
)
feed = ActivityFeed.feed('david', 1)
- feed.length.should == 1
+ feed.length.should eql(1)
feed[0].should == item
end
end
@@ -231,7 +231,7 @@
ActivityFeed.item_loader = Proc.new { |id| ActivityFeed::Mongoid::Item.find(id) }
feed = ActivityFeed.feed('david', 1)
- feed.length.should == 0
+ feed.length.should eql(0)
item = ActivityFeed::Mongoid::Item.create(
:user_id => 'david',
@@ -243,7 +243,7 @@
)
feed = ActivityFeed.feed('david', 1)
- feed.length.should == 1
+ feed.length.should eql(1)
feed[0].should == item
end
end
@@ -36,29 +36,29 @@
describe 'without aggregation' do
it 'should remove an item from an activity feed' do
ActivityFeed.redis.exists(ActivityFeed.feed_key('david')).should be_false
- ActivityFeed.redis.zcard(ActivityFeed.feed_key('david')).should == 0
+ ActivityFeed.redis.zcard(ActivityFeed.feed_key('david')).should eql(0)
ActivityFeed.update_item('david', 1, DateTime.now.to_i)
ActivityFeed.redis.exists(ActivityFeed.feed_key('david')).should be_true
- ActivityFeed.redis.zcard(ActivityFeed.feed_key('david')).should == 1
+ ActivityFeed.redis.zcard(ActivityFeed.feed_key('david')).should eql(1)
ActivityFeed.remove_item('david', 1)
- ActivityFeed.redis.zcard(ActivityFeed.feed_key('david')).should == 0
+ ActivityFeed.redis.zcard(ActivityFeed.feed_key('david')).should eql(0)
end
end
describe 'with aggregation' do
it 'should remove an item from an activity feed and the aggregate feed' do
ActivityFeed.redis.exists(ActivityFeed.feed_key('david')).should be_false
ActivityFeed.redis.exists(ActivityFeed.feed_key('david', true)).should be_false
- ActivityFeed.redis.zcard(ActivityFeed.feed_key('david')).should == 0
- ActivityFeed.redis.zcard(ActivityFeed.feed_key('david', true)).should == 0
+ ActivityFeed.redis.zcard(ActivityFeed.feed_key('david')).should eql(0)
+ ActivityFeed.redis.zcard(ActivityFeed.feed_key('david', true)).should eql(0)
ActivityFeed.update_item('david', 1, DateTime.now.to_i, true)
ActivityFeed.redis.exists(ActivityFeed.feed_key('david')).should be_true
ActivityFeed.redis.exists(ActivityFeed.feed_key('david', true)).should be_true
- ActivityFeed.redis.zcard(ActivityFeed.feed_key('david')).should == 1
- ActivityFeed.redis.zcard(ActivityFeed.feed_key('david', true)).should == 1
+ ActivityFeed.redis.zcard(ActivityFeed.feed_key('david')).should eql(1)
+ ActivityFeed.redis.zcard(ActivityFeed.feed_key('david', true)).should eql(1)
ActivityFeed.remove_item('david', 1)
- ActivityFeed.redis.zcard(ActivityFeed.feed_key('david')).should == 0
- ActivityFeed.redis.zcard(ActivityFeed.feed_key('david', true)).should == 0
+ ActivityFeed.redis.zcard(ActivityFeed.feed_key('david')).should eql(0)
+ ActivityFeed.redis.zcard(ActivityFeed.feed_key('david', true)).should eql(0)
end
end
end

0 comments on commit 7808add

Please sign in to comment.