protocool 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/protocool.rb +3 -0
- data/lib/protocool/version.rb +1 -1
- data/spec/lib/protocool_spec.rb +20 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d54fbad2e7add40919d9d4fe3d6bff6f222822aa
|
4
|
+
data.tar.gz: 91e1b34f2ad776b21c4a73cb44f5de7c10e4f757
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84c719f093e7f244edb02a54fb63fb39d53a96a892fcb32e1fdc41ff705e35205eec73d2f155badaa5c1009f2f92fb8ccd18fe289ff2cc0be2419cbf7a067bf4
|
7
|
+
data.tar.gz: cefe98d0996d40ed31c18f552448f9d39ade65635eb745dc3ef4c22ea609f92db0ecbf7c794516c685c398ac04d2a5372d6397c13c8572bf484fefd5f98e20ee
|
data/lib/protocool.rb
CHANGED
@@ -13,6 +13,9 @@ module Protocool
|
|
13
13
|
private
|
14
14
|
|
15
15
|
def use_ssl?
|
16
|
+
# Allow the user to override any defaults
|
17
|
+
# This is useful for booting a Rails app with production environment locally
|
18
|
+
return false if ENV['PROTOCOOL_FORCE_INSECURE'] == 'true'
|
16
19
|
# Let the Rails config decide
|
17
20
|
return true if Rails.respond_to?(:application) && Rails.application.config.force_ssl
|
18
21
|
# Otherwise use default
|
data/lib/protocool/version.rb
CHANGED
data/spec/lib/protocool_spec.rb
CHANGED
@@ -105,5 +105,25 @@ describe Protocool do
|
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
+
context 'with force_ssl in non-dev and non-test mode but overriding manually' do
|
109
|
+
before do
|
110
|
+
Rails.stub_chain(:application, :config, :force_ssl).and_return true
|
111
|
+
Rails.stub!(:env).and_return mock(:environment, development?: false, test?: false)
|
112
|
+
stub_const 'ENV', {'PROTOCOOL_FORCE_INSECURE' => 'true'}
|
113
|
+
end
|
114
|
+
|
115
|
+
describe '.https' do
|
116
|
+
it 'uses TLS' do
|
117
|
+
protocool.https.should == 'http'
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe '.protocol' do
|
122
|
+
it 'uses TLS' do
|
123
|
+
protocool.protocol.should == 'http://'
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
108
128
|
end
|
109
129
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protocool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bukowskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -88,10 +88,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
90
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.
|
91
|
+
rubygems_version: 2.5.1
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: Decides whether to use TLS encryption or not on a per-environment basis in
|
95
95
|
Rails.
|
96
96
|
test_files: []
|
97
|
-
has_rdoc:
|