Sha256: a7953f51a8d9e9c25911be479a3c91c007d810356a1b6a505e2033ad49fe2140

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

describe Idid::Configuration do
  subject { Idid::Configuration.new('project' => project, 'email' => email, 'delivery' => delivery) }
  let(:email) { 'foo@example.com' }
  let(:project) { 'foobar' }
  let(:delivery) { {:method => :sendmail} }

  its('project') { should eq project }
  its('email')   { should eq email   }

  context "when any of the options are missing" do
    before do
      Idid::Configuration.any_instance.stub(:read_config) { nil }
    end

    it 'raises ArgumentError if no email option is passed' do
      expect { Idid::Configuration.new('project' => project, 'delivery' => delivery) }.
        to raise_error(ArgumentError, /email/)
    end

    it 'raises ArgumentError if no project option is passed' do
      expect { Idid::Configuration.new('email' => email, 'delivery' => delivery) }.
        to raise_error(ArgumentError, /project/)
    end

    it 'raises ArgumentError if no delivery option is passed' do
      expect { Idid::Configuration.new('email' => email, 'project' => project) }.
        to raise_error(ArgumentError, /delivery/)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
idid-0.0.4 spec/idid/configuration_spec.rb