Sha256: d32a8f6a2d45ea858754bbc6092c11eb0e879568cc2308bde1fd2c04b144f5b3

Contents?: true

Size: 904 Bytes

Versions: 4

Compression:

Stored size: 904 Bytes

Contents

# encoding: UTF-8

require 'spec_helper'

describe Contactology::Issues do
  let(:issues) { Contactology::Issues.new }
  subject { issues }

  it 'is empty by default' do
    issues.should be_empty
  end

  it 'holds Contactology::Issue objects' do
    issues = Contactology::Issues.new('issues' => [Factory.attributes_for(:issue)])
    issues.should_not be_empty
    issues.all? { |i| i.kind_of?(Contactology::Issue) }.should be_true
  end

  it 'converts pushed objects to Issue instances' do
    expect {
      issues << Factory.attributes_for(:issue)
    }.to change(issues, :size).by(1)

    issues.all? { |i| i.kind_of? Contactology::Issue }.should be_true
  end

  context '#score' do
    it 'defaults to 0' do
      Contactology::Issues.new.score.should == 0
    end

    it 'may be set during initialization' do
      Contactology::Issues.new('score' => 95).score.should == 95
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
contactology-0.1.2 spec/models/contactology/issues_spec.rb
contactology-0.1.1 spec/models/contactology/issues_spec.rb
contactology-0.1.0 spec/models/contactology/issues_spec.rb
contactology-0.0.2 spec/models/contactology/issues_spec.rb