Sha256: 19996aedfc7c654707eb95f8d3b382d8b6ce6ba18490d5cb201cc269a43b6c98

Contents?: true

Size: 1.75 KB

Versions: 83

Compression:

Stored size: 1.75 KB

Contents

require 'spec_helper'

describe Tenon::Contact do
  describe '#toggle_read!' do
    let(:contact) { Tenon::Contact.new(read: read) }
    context 'when a read is true' do
      let(:read) { true }
      it 'should set read to false and save the contact' do
        expect(contact).to receive(:read=).with(false)
        expect(contact).to receive(:save)
        contact.toggle_read!
      end
    end

    context 'when read is false' do
      let(:read) { false }
      it 'should set read to true and save the contact' do
        expect(contact).to receive(:read=).with(true)
        expect(contact).to receive(:save)
        contact.toggle_read!
      end
    end
  end

  describe '#toggle_replied!' do
    let(:contact) { Tenon::Contact.new(replied: replied) }
    context 'when a replied is true' do
      let(:replied) { true }
      it 'should set replied to false and save the contact' do
        expect(contact).to receive(:replied=).with(false)
        expect(contact).to receive(:save)
        contact.toggle_replied!
      end
    end

    context 'when replied is false' do
      let(:replied) { false }
      it 'should set replied to true and save the contact' do
        expect(contact).to receive(:replied=).with(true)
        expect(contact).to receive(:save)
        contact.toggle_replied!
      end
    end
  end

  describe '#pooh_in_the_honey?' do
    let(:contact) { Tenon::Contact.new(address: address) }
    context 'when address field is submitted empty' do
      let(:address) { '' }
      it 'should return false' do
        contact.pooh_in_the_honey?
      end
    end
    context 'when address field is submitted filled' do
      let(:address) { '162 Locke St South' }
      it 'should return true' do
        contact.pooh_in_the_honey?
      end
    end
  end

end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
tenon-1.1.8 spec/models/tenon/contact_spec.rb
tenon-1.1.7 spec/models/tenon/contact_spec.rb
tenon-1.1.6 spec/models/tenon/contact_spec.rb
tenon-1.1.5 spec/models/tenon/contact_spec.rb
tenon-1.1.4 spec/models/tenon/contact_spec.rb
tenon-1.1.3 spec/models/tenon/contact_spec.rb
tenon-1.1.2 spec/models/tenon/contact_spec.rb
tenon-1.1.1 spec/models/tenon/contact_spec.rb
tenon-1.0.76 spec/models/tenon/contact_spec.rb
tenon-1.0.75 spec/models/tenon/contact_spec.rb
tenon-1.0.74 spec/models/tenon/contact_spec.rb
tenon-1.0.73 spec/models/tenon/contact_spec.rb
tenon-1.0.72 spec/models/tenon/contact_spec.rb
tenon-1.0.71 spec/models/tenon/contact_spec.rb
tenon-1.0.70 spec/models/tenon/contact_spec.rb
tenon-1.0.69 spec/models/tenon/contact_spec.rb
tenon-1.0.68 spec/models/tenon/contact_spec.rb
tenon-1.0.67 spec/models/tenon/contact_spec.rb
tenon-1.0.66 spec/models/tenon/contact_spec.rb
tenon-1.0.65 spec/models/tenon/contact_spec.rb