require 'spec_helper'
describe Likeable::Like do
  before do
    @time = Time.now
  end
  describe 'attributes' do
    it 'stores target, user, and created_at' do
      like = Likeable::Like.new(:target => @target, :user => @user, :time => @time)
      like.user.should        eq(@user)
      like.target.should      eq(@target)
      # Times often fail equality checks due to microsec precision
      like.created_at.should  be_close(@time, 1)
    end

    it 'converts float time to propper Time object' do
      like = Likeable::Like.new(:time => @time.to_f)
      like.created_at.should be_close(@time, 1)
    end
  end
end

require 'spec_helper'
describe Likeable::Like do
  before do
    @time = Time.now
  end
  describe 'attributes' do
    it 'stores target, user, and created_at' do
      like = Likeable::Like.new(:target => @target, :user => @user, :time => @time)
      like.user.should        eq(@user)
      like.target.should      eq(@target)
      # Times often fail equality checks due to microsec precision
      like.created_at.should  be_within(1).of(@time)
    end

    it 'converts float time to propper Time object' do
      like = Likeable::Like.new(:time => @time.to_f)
      like.created_at.should be_within(1).of(@time)
    end
  end
end

Fix matcher deprecation warning on time specs.
Fix matcher deprecation warning on time specs.
