pco-url 1.1.0 → 1.2.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: 76f3a85257c51534d6c3c3b7cff02ef4e7ed031c
4
- data.tar.gz: ed00adc04d8cf9cee80436b6d1202d8865d395cf
3
+ metadata.gz: ffffc4ec52600a23d033d2b75f4a7f0bc74db900
4
+ data.tar.gz: 7cd6fae8170dc6493aaffc2ad12ad776142cefcc
5
5
  SHA512:
6
- metadata.gz: 18af49899e23166c8725c1e0c74cae5f4b4399b09dc274df17f33198684cf7921382e53766ed743d02e6550e6a975e6a33f0f468dfaad3b76dddf061fe8b83d1
7
- data.tar.gz: 52248aba5e80184092128fd36984cf5047a60222d45e311448c3170506a632d5cbd2d4103532ed427d8dd55cc9c80ca1daa94d598d43b156037e89b881f48583
6
+ metadata.gz: fffaf131fa4586c17340d679e0545a314167dea60c1c027cac95b87ef0ad663295259e89d5a61b6fba0e337f96febd86e3ac6c49b64aecfffbf02dfa1f101c09
7
+ data.tar.gz: 67595608b41b2d9ea1493dac83bb938986f5def9834b6a6dd5328017bb4f59b4847068cce870b310f69907dc5f80a8ce46725c21010494d38457be4660924f8d
@@ -1,5 +1,5 @@
1
1
  module PCO
2
2
  class URL
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
data/lib/pco/url.rb CHANGED
@@ -4,29 +4,12 @@ module PCO
4
4
  class URL
5
5
 
6
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
-
20
7
  def method_missing(method_name)
21
- if applications.include? method_name
22
- app_name = method_name.to_s.gsub("_", "-")
23
- env_var = method_name.to_s.upcase + "_URL"
8
+ app_name = method_name.to_s.gsub("_", "-")
9
+ env_var = method_name.to_s.upcase + "_URL"
24
10
 
25
- # Try "CHECK_INS_URL" then url_for_app("check-ins")
26
- ENV[env_var] || url_for_app(app_name)
27
- else
28
- super
29
- end
11
+ # Try "CHECK_INS_URL" then url_for_app("check-ins")
12
+ ENV[env_var] || url_for_app(app_name)
30
13
  end
31
14
 
32
15
  private
@@ -48,5 +31,6 @@ module PCO
48
31
  end
49
32
  end
50
33
  end
34
+
51
35
  end
52
36
  end
data/spec/pco_url_spec.rb CHANGED
@@ -1,5 +1,15 @@
1
1
  require "spec_helper"
2
2
 
3
+ Applications = [
4
+ :accounts,
5
+ :avatars,
6
+ :services,
7
+ :check_ins,
8
+ :people,
9
+ :registrations,
10
+ :resources
11
+ ]
12
+
3
13
  describe PCO::URL do
4
14
  describe "defaults" do
5
15
  describe "development" do
@@ -7,7 +17,7 @@ describe PCO::URL do
7
17
  Rails.env = "development"
8
18
  end
9
19
 
10
- PCO::URL.applications.map(&:to_s).each do |app|
20
+ Applications.map(&:to_s).each do |app|
11
21
  it "has an #{app} URL" do
12
22
  expect(PCO::URL.send(app)).to eq("http://#{app.gsub('_','-')}.pco.dev")
13
23
  end
@@ -19,7 +29,7 @@ describe PCO::URL do
19
29
  Rails.env = "staging"
20
30
  end
21
31
 
22
- PCO::URL.applications.map(&:to_s).each do |app|
32
+ Applications.map(&:to_s).each do |app|
23
33
  it "has an #{app} URL" do
24
34
  expect(PCO::URL.send(app)).to eq("https://#{app.gsub('_','-')}-staging.planningcenteronline.com")
25
35
  end
@@ -31,7 +41,7 @@ describe PCO::URL do
31
41
  Rails.env = "production"
32
42
  end
33
43
 
34
- PCO::URL.applications.map(&:to_s).each do |app|
44
+ Applications.map(&:to_s).each do |app|
35
45
  it "has an #{app} URL" do
36
46
  expect(PCO::URL.send(app)).to eq("https://#{app.gsub('_','-')}.planningcenteronline.com")
37
47
  end
@@ -43,7 +53,7 @@ describe PCO::URL do
43
53
  Rails.env = "test"
44
54
  end
45
55
 
46
- PCO::URL.applications.map(&:to_s).each do |app|
56
+ Applications.map(&:to_s).each do |app|
47
57
  it "has an #{app} URL" do
48
58
  expect(PCO::URL.send(app)).to eq("http://#{app.gsub('_','-')}.pco.test")
49
59
  end
@@ -88,24 +98,4 @@ describe PCO::URL do
88
98
  end
89
99
  end
90
100
 
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
111
101
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pco-url
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Miller