passages 1.2.0 → 1.3.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: c13591a556dd946e20eb8622471a5b5f1528befb
4
- data.tar.gz: 5d6bd5a0b54fe7f5326ba52f6a5e6fc81c3af103
3
+ metadata.gz: cdf91b2b9b795e55d35094069080cae3bc4cb3a3
4
+ data.tar.gz: 01af8a0a8a8eefde4ead9975f30f6d8070573796
5
5
  SHA512:
6
- metadata.gz: fa7d5710fa3fe0bb2ab4eb9074a49df0922adb39bb81863d11e8fbfae84fc461397338100f00b83476b5ee22fe1d4b9f322fa400541b40442ab4165115949fee
7
- data.tar.gz: 09cf9e843ea3466548ce761544cf2730104d2084e1652ba083384ac7ec02c6aea06548a10edb7ea411d94137936efde838e7cbbbb85bb4f0e059a23c76625221
6
+ metadata.gz: d4468e59aa8db907d391ac761ba15dfebf5a693aa3673ac973516ffcfca9af1ae158a4eb35b75b8f9a99c533f922365597ced87e2c036c0561ba52c4990cae99
7
+ data.tar.gz: d38ce30b6db356ac5b49613f26fdefa167941e5e97c31554ee2c2ef811487212e261c2035d3336b06bb5dd8c5f11cddda1fcb55e35bb79fac2fb143e36bd14e7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- passages (1.1.0)
4
+ passages (1.2.0)
5
5
  rails (~> 4.0)
6
6
 
7
7
  GEM
@@ -6,8 +6,6 @@ require 'passages/engine_route_collection'
6
6
 
7
7
  module Passages
8
8
  class RoutesController < ActionController::Base
9
- http_basic_authenticate_with name: Passages.username, password: Passages.password
10
-
11
9
  layout false
12
10
 
13
11
  def routes
data/config/config.rb CHANGED
@@ -1,6 +1,11 @@
1
1
  module Passages
2
2
  class Config
3
3
  attr_accessor :automount
4
+ attr_writer :no_auth
5
+
6
+ def no_auth?
7
+ !!@no_auth
8
+ end
4
9
  end
5
10
 
6
11
  def config
@@ -7,13 +7,9 @@ module Passages
7
7
  ENV['passages_password'] || ENV['PASSAGES_PASSWORD'] || 'password'
8
8
  end
9
9
 
10
- def no_auth=(no_auth)
11
- @no_auth = no_auth
12
- end
13
-
14
10
  def no_auth?
15
- @no_auth.nil? || @no_auth
11
+ Passages.config.no_auth?
16
12
  end
17
13
 
18
- module_function :username, :password, :no_auth=, :no_auth?
14
+ module_function :username, :password, :no_auth?
19
15
  end
@@ -8,6 +8,10 @@ module Passages
8
8
  mount Passages::Engine, at: '/passages'
9
9
  end
10
10
  end
11
+
12
+ unless Passages.config.no_auth?
13
+ Passages::RoutesController.http_basic_authenticate_with name: Passages.username, password: Passages.password
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ module Passages
4
+ describe Config do
5
+ describe '#no_auth?' do
6
+ context '@basic_auth is a truthy value' do
7
+ [true, 'yes', ['1'], { a: :b }].each do |value|
8
+ it "#{ value } returns true" do
9
+ Passages.config.no_auth = value
10
+ expect(Passages.config.no_auth?).to eq(true)
11
+ end
12
+ end
13
+ end
14
+
15
+ context '@basic_auth is a falsey value' do
16
+ [false, nil].each do |value|
17
+ it "#{ value } returns false" do
18
+ Passages.config.no_auth = value
19
+ expect(Passages.config.no_auth?).to eq(false)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -62,4 +62,28 @@ describe Passages do
62
62
  end
63
63
  end
64
64
  end
65
+
66
+ describe '.no_auth?' do
67
+ let(:value) { nil }
68
+
69
+ before do
70
+ Passages.config.no_auth = value
71
+ end
72
+
73
+ context 'Passages.config is set to true' do
74
+ let(:value) { true }
75
+
76
+ it 'returns true' do
77
+ expect(described_class.no_auth?).to eq(true)
78
+ end
79
+ end
80
+
81
+ context 'Passages.config is set to false' do
82
+ let(:value) { false }
83
+
84
+ it 'returns false' do
85
+ expect(described_class.no_auth?).to eq(false)
86
+ end
87
+ end
88
+ end
65
89
  end
data/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Passages
2
2
  MAJOR = 1
3
- MINOR = 2
3
+ MINOR = 3
4
4
  TINY = 0
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].join('.').freeze
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passages
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Yesbeck
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-14 00:00:00.000000000 Z
11
+ date: 2016-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -71,6 +71,7 @@ files:
71
71
  - lib/passages/route.rb
72
72
  - lib/passages/route_collection.rb
73
73
  - passages.gemspec
74
+ - spec/config/config_spec.rb
74
75
  - spec/config/initializers/basic_auth_spec.rb
75
76
  - spec/controllers/passages/routes_controller_spec.rb
76
77
  - spec/lib/passages/engine_route_collection_spec.rb
@@ -114,6 +115,7 @@ signing_key:
114
115
  specification_version: 4
115
116
  summary: Display and search capabilities for Ruby on Rails routes
116
117
  test_files:
118
+ - spec/config/config_spec.rb
117
119
  - spec/config/initializers/basic_auth_spec.rb
118
120
  - spec/controllers/passages/routes_controller_spec.rb
119
121
  - spec/lib/passages/engine_route_collection_spec.rb