spec/unit/berkshelf/api/rest_gateway_spec.rb in berkshelf-api-1.4.0 vs spec/unit/berkshelf/api/rest_gateway_spec.rb in berkshelf-api-2.0.0
- old
+ new
@@ -1,20 +1,41 @@
require 'spec_helper'
require 'berkshelf/api/rest_gateway'
-describe Berkshelf::API::RESTGateway do
- describe "ClassMethods" do
- describe "::new" do
- let(:options) { Hash.new }
+module Berkshelf
+ module API
+ describe RESTGateway do
+ let(:options) { {} }
subject { described_class.new(options) }
- its(:host) { should eql(described_class::DEFAULT_OPTIONS[:host]) }
- its(:port) { should eql(described_class::DEFAULT_OPTIONS[:port]) }
- its(:app) { should be_a(Berkshelf::API::RackApp) }
+ describe '.new' do
+ context 'when given a different port' do
+ before do
+ options[:port] = 26210
+ end
- context "given a different port" do
- before { options[:port] = 26210 }
- its(:port) { should eql(26210) }
+ it 'uses the correct port' do
+ expect(subject.port).to eq(26210)
+ end
+ end
+ end
+
+ describe '#host' do
+ it 'has the default value' do
+ expect(subject.host).to eq(described_class::DEFAULT_OPTIONS[:host])
+ end
+ end
+
+ describe '#port' do
+ it 'has the default value' do
+ expect(subject.port).to eq(described_class::DEFAULT_OPTIONS[:port])
+ end
+ end
+
+ describe '#app' do
+ it 'has the default value' do
+ expect(subject.app).to be_a(RackApp)
+ end
end
end
end
end