require 'spec_helper' describe Mailstro::Configuration do subject(:configuration) { Mailstro::Configuration.new } it "has a default api endpoint" do configuration.api_endpoint.should == "https://api.mailstroapp.com/v1" end describe "#validate!" do it "raises an error if an api_key is nil" do expect { subject.validate! }.to raise_error(Mailstro::Error::ConfigurationError) end end describe ".configure" do after do Mailstro.configuration = Mailstro::Configuration.new end it "allows you to pass a block to configure Mailstro" do Mailstro.configure do |config| config.api_key = 'x' config.api_endpoint = 'mailstro.dev' end Mailstro.configuration.api_endpoint.should == 'mailstro.dev' end end end