Welcome to mirror list, hosted at ThFree Co, Russian Federation.

app_config_spec.rb « lib « spec - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 96ba4d44130af44ed0635db1bc297e1b0940a3b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Copyright (c) 2010, Diaspora Inc.  This file is
# licensed under the Affero General Public License version 3 or later.  See
# the COPYRIGHT file.

require 'spec_helper'

describe AppConfig do
  describe ".generate_pod_uri" do
    before do
      @environment_vars = AppConfig.config_vars
      AppConfig.config_vars = {}
    end
    after do
      AppConfig.config_vars = @environment_vars
    end
    describe "when pod_url is prefixed with protocol" do
      it "generates a URI with a host for http" do
        AppConfig[:pod_url] = "http://oscar.joindiaspora.com"
        AppConfig.generate_pod_uri
        AppConfig[:pod_uri].host.should == "oscar.joindiaspora.com"
      end
      it "generates a URI with a host for https" do
        AppConfig[:pod_url] = "https://oscar.joindiaspora.com"
        AppConfig.generate_pod_uri
        AppConfig[:pod_uri].host.should == "oscar.joindiaspora.com"
      end
    end
    describe "when pod_url is not prefixed with protocol" do
      it "generates a URI with a host" do
        AppConfig[:pod_url] = "oscar.joindiaspora.com"
        AppConfig.generate_pod_uri
        AppConfig[:pod_uri].host.should == "oscar.joindiaspora.com"
      end
      it "adds http:// to the front of the pod_url" do
        AppConfig[:pod_url] = "oscar.joindiaspora.com"
        AppConfig.generate_pod_uri
        AppConfig[:pod_url].should == "http://oscar.joindiaspora.com"
      end
    end
  end
end