Sha256: fd90ddbca0e7d18a6707aa290cdb87caa1a52208b20673cce87c2c3d27cb70f1

Contents?: true

Size: 873 Bytes

Versions: 1

Compression:

Stored size: 873 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe Mongo::Voteable::Tasks do
  describe 'Mongo::Voteable::Tasks.init_stats' do
    before :all do
      @post1 = Post.create!
      @post2 = Post.create!
    end

    it 'after create votes has default value' do
      @post1.votes.should == Mongo::Voteable::Votes::DEFAULT_ATTRIBUTES
      @post2.votes.should == Mongo::Voteable::Votes::DEFAULT_ATTRIBUTES
    end
    
    it 'reset votes data' do
      @post1.votes = nil
      @post1.save

      @post2.votes = nil
      @post2.save
    end
    
    it 'init_stats recover votes default value' do
      Mongo::Voteable::Tasks.init_stats

      @post1.reload
      @post2.reload
    
      @post1.votes.should == Mongo::Voteable::Votes::DEFAULT_ATTRIBUTES
      @post2.votes.should == Mongo::Voteable::Votes::DEFAULT_ATTRIBUTES
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voteable_mongo-0.8.1 spec/voteable_mongo/tasks_spec.rb