Sha256: ff125bf75cc2936de985a87d4029f4d329f2dc91c57f198a03cf1f0458561fff

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'
module Axel
  describe "Uri" do
    subject { Uri.new base_url }
    let(:base_url) { "http://user-service.stage.com/users" }

    before do
      subject.stub config: {
        dev: {
          host: ".dev",
          scheme: "http"
        },
        stage: {
          host: ->(base, n) { "#{base}.stage#{n}.com" },
          scheme: "https"
        },
        prod: {
          host: ".your-platform.com",
          scheme: "https"
        }
      }
    end
    it "to dev switches out the stage URI for .dev" do
      subject.to(:dev).to_s.should == "http://user-service.dev/users"
    end

    it "for stage" do
      subject.to(:stage).to_s.should == "https://user-service.stage.com/users"
    end

    it "for stage n" do
      subject.to(:stage, 2).to_s.should == "https://user-service.stage2.com/users"
    end

    it "for prod" do
      subject.to(:prod).to_s.should == "https://user-service.your-platform.com/users"
    end

    its(:dashed_app_name) { should == "user-service" }
    its(:app_name) { should == "User Service" }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axel-0.0.1 spec/lib/axel/uri_spec.rb