pco-url 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7d83f7b0622788c8066d64acf56f40f10bd9db7
4
- data.tar.gz: 1ad717341534953c53535c6c646b3d31475d483a
3
+ metadata.gz: 76f3a85257c51534d6c3c3b7cff02ef4e7ed031c
4
+ data.tar.gz: ed00adc04d8cf9cee80436b6d1202d8865d395cf
5
5
  SHA512:
6
- metadata.gz: b8d5a4fb5507e25211a0f53c7685b1e838cee30af3d3e73c465664217b81cf406ca4ca9ae9a666c37aca4b964a3a13f0cc96249ff9c4fbde4d09689a9ae6b5c2
7
- data.tar.gz: 4732298a1bd72dabf8f1ff85036d58017d2edb79019fab65177483a19ba881086989914f97416677adfdec5bdb335c638c0fa01486002f1d517f44ce508ae063
6
+ metadata.gz: 18af49899e23166c8725c1e0c74cae5f4b4399b09dc274df17f33198684cf7921382e53766ed743d02e6550e6a975e6a33f0f468dfaad3b76dddf061fe8b83d1
7
+ data.tar.gz: 52248aba5e80184092128fd36984cf5047a60222d45e311448c3170506a632d5cbd2d4103532ed427d8dd55cc9c80ca1daa94d598d43b156037e89b881f48583
data/lib/pco/url.rb CHANGED
@@ -2,19 +2,23 @@ require "pco/url/version"
2
2
 
3
3
  module PCO
4
4
  class URL
5
- Applications = [
6
- :accounts,
7
- :avatars,
8
- :services,
9
- :check_ins,
10
- :people,
11
- :registrations,
12
- :resources
13
- ]
14
5
 
15
6
  class << self
7
+ def applications
8
+ @applications ||= [
9
+ :accounts,
10
+ :avatars,
11
+ :services,
12
+ :check_ins,
13
+ :people,
14
+ :registrations,
15
+ :resources
16
+ ]
17
+ end
18
+ attr_writer :applications
19
+
16
20
  def method_missing(method_name)
17
- if Applications.include? method_name
21
+ if applications.include? method_name
18
22
  app_name = method_name.to_s.gsub("_", "-")
19
23
  env_var = method_name.to_s.upcase + "_URL"
20
24
 
@@ -1,5 +1,5 @@
1
1
  module PCO
2
2
  class URL
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
data/spec/pco_url_spec.rb CHANGED
@@ -7,7 +7,7 @@ describe PCO::URL do
7
7
  Rails.env = "development"
8
8
  end
9
9
 
10
- PCO::URL::Applications.map(&:to_s).each do |app|
10
+ PCO::URL.applications.map(&:to_s).each do |app|
11
11
  it "has an #{app} URL" do
12
12
  expect(PCO::URL.send(app)).to eq("http://#{app.gsub('_','-')}.pco.dev")
13
13
  end
@@ -19,7 +19,7 @@ describe PCO::URL do
19
19
  Rails.env = "staging"
20
20
  end
21
21
 
22
- PCO::URL::Applications.map(&:to_s).each do |app|
22
+ PCO::URL.applications.map(&:to_s).each do |app|
23
23
  it "has an #{app} URL" do
24
24
  expect(PCO::URL.send(app)).to eq("https://#{app.gsub('_','-')}-staging.planningcenteronline.com")
25
25
  end
@@ -31,7 +31,7 @@ describe PCO::URL do
31
31
  Rails.env = "production"
32
32
  end
33
33
 
34
- PCO::URL::Applications.map(&:to_s).each do |app|
34
+ PCO::URL.applications.map(&:to_s).each do |app|
35
35
  it "has an #{app} URL" do
36
36
  expect(PCO::URL.send(app)).to eq("https://#{app.gsub('_','-')}.planningcenteronline.com")
37
37
  end
@@ -43,7 +43,7 @@ describe PCO::URL do
43
43
  Rails.env = "test"
44
44
  end
45
45
 
46
- PCO::URL::Applications.map(&:to_s).each do |app|
46
+ PCO::URL.applications.map(&:to_s).each do |app|
47
47
  it "has an #{app} URL" do
48
48
  expect(PCO::URL.send(app)).to eq("http://#{app.gsub('_','-')}.pco.test")
49
49
  end
@@ -87,4 +87,25 @@ describe PCO::URL do
87
87
  end
88
88
  end
89
89
  end
90
+
91
+ describe "custom applications" do
92
+ before do
93
+ Rails.env = "development"
94
+ ENV["DEPLOY_ENV"] = nil
95
+ end
96
+
97
+ describe "adding an app" do
98
+ it "adds a URL method for bazinga" do
99
+ PCO::URL.applications += [:bazinga]
100
+ expect(PCO::URL.bazinga).to eq("http://bazinga.pco.dev")
101
+ end
102
+ end
103
+
104
+ describe "removing an app" do
105
+ it "removes the URL method for accounts" do
106
+ PCO::URL.applications -= [:accounts]
107
+ expect{PCO::URL.accounts}.to raise_error(NoMethodError)
108
+ end
109
+ end
110
+ end
90
111
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pco-url
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Miller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-16 00:00:00.000000000 Z
11
+ date: 2014-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler