Sha256: cbbe99018222dcacc04fb1253f37ff8613f3d016e6683362207bdc6837b38a8d

Contents?: true

Size: 701 Bytes

Versions: 2

Compression:

Stored size: 701 Bytes

Contents

require 'acts_as_votable'
require 'spec_helper'

describe ActsAsVotable::Alias do

  before(:each) do
    clean_database
    @votable = Votable.new(:name => 'votable with aliases')
    @votable.save

    @voter = Voter.new(:name => 'a voter')
    @voter.save
  end

  it "should alias a bunch of functions" do
    @votable.respond_to?(:upvotes).should be true
    @votable.respond_to?(:ups).should be true
    @votable.respond_to?(:dislikes).should be true
  end

  it "should only alias voting words that are strings" do
    @votable.respond_to?('1s'.to_sym).should be false
  end

  it "should add callable functions" do
    @votable.vote :voter => @voter
    @votable.likes.should == 1
  end


end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
acts_as_votable-0.0.5 spec/alias_spec.rb
acts_as_votable-0.0.4 spec/alias_spec.rb