Sha256: c46c5f2ed52214d9a6f239b801ed5059cea0b15bf88320578a4623b4dc2efe26

Contents?: true

Size: 825 Bytes

Versions: 4

Compression:

Stored size: 825 Bytes

Contents

require 'spec_helper'

describe ReputationIntermediateValue do

  before(:each) { 
    rule = ReputationRule.create!(:name => "foo")
    user = User.create!(:name => "bob")
    ReputationIntermediateValue.create!(:rule => rule, :user => user, :name => "foo")
  }

  it { should belong_to :user }
  it { should belong_to :rule }
    
  it { should validate_presence_of :user }
  it { should validate_presence_of :rule }
  it { should validate_numericality_of :value }

  it { should validate_uniqueness_of( :name ).scoped_to(:user_id, :rule_id) }

  it { should allow_mass_assignment_of :user }
  it { should allow_mass_assignment_of :rule }
  it { should allow_mass_assignment_of :name }
  it { should allow_mass_assignment_of :value }
  
  it "should set value to 0 by default" do
    subject.value.should eql 0
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
reputation-0.0.5 spec/models/intermediate_value_spec.rb
reputation-0.0.4 spec/models/intermediate_value_spec.rb
reputation-0.0.3 spec/models/intermediate_value_spec.rb
reputation-0.0.2 spec/models/intermediate_value_spec.rb