titler 0.4.4 → 1.0.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: 51c3b8c39cea79ca4a980b8e94d9340b767c2eba
4
- data.tar.gz: 120347193ab92790dbce2ef753961a0c71f20ced
3
+ metadata.gz: 7640ad0f1e74af13977c990d48e0a415e9da53cb
4
+ data.tar.gz: 7f0252467cf3b2fdb2b5ea59890bcae8498e30ce
5
5
  SHA512:
6
- metadata.gz: b805ae7d3553b134a6965eb7671fab6c489c38d1c3b5d3f924ccc7181d6361a1869fdfd029dcdcf48a5246147647ac3b7524897cd1f1e4c9d69193c9a45936d7
7
- data.tar.gz: d497dcba674cb65fb0ee88e4b432872ef0801f97c9e93120d0dca686dbab0cc93b6f40e137194c8f0709ff4aab50d16613c7d1d2b8c35fb11980403613bb67d2
6
+ metadata.gz: 05a2ba2169caa18b33702128119b92d28223a355bad6a8cab97482a797488476c4060b86fbe099e2ce59b4167044eb1282e4bd8755c67d7cb1c102e50d825adb
7
+ data.tar.gz: d4436a7b16d2e63d37dd77cbbd190d4ea11fba23f73175029292657c6685befd72b047b69afb74185be0f89ce5bef5d96722052c4a29736b42ed8bb5ecf3e598
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Robert Travis Pierce
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -20,7 +20,7 @@ module Titler
20
20
  @i18n = i18n
21
21
  @title_as_set = title_as_set
22
22
  @context = context
23
- @configuration = Configuration.new
23
+ @configuration = Titler.configuration
24
24
  end
25
25
 
26
26
  def to_s
@@ -1,3 +1,3 @@
1
1
  module Titler
2
- VERSION = '0.4.4'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -1,12 +1,28 @@
1
1
  require 'spec_helper'
2
2
  require 'titler'
3
3
 
4
+ class ManagerController; end
5
+
4
6
  module Titler
5
7
  describe Configuration do
6
8
 
7
9
  context 'with configuration block' do
8
- it 'returns the use_env_prefix' do
9
- expect(Titler.configuration.use_env_prefix).to be true
10
+ it 'uses the options in the configuration block instead of defaults' do
11
+ Titler.configure do |config|
12
+ config.admin_controller = ManagerController
13
+ config.admin_name = 'Manager'
14
+ config.app_name_position = 'prepend'
15
+ config.delimiter = ' | '
16
+ config.use_app_tagline = false
17
+ config.use_env_prefix = false
18
+ end
19
+
20
+ expect(Titler.configuration.admin_controller).to eq ManagerController
21
+ expect(Titler.configuration.admin_name).to eq 'Manager'
22
+ expect(Titler.configuration.app_name_position).to eq 'prepend'
23
+ expect(Titler.configuration.delimiter).to eq ' | '
24
+ expect(Titler.configuration.use_app_tagline).to eq false
25
+ expect(Titler.configuration.use_env_prefix).to eq false
10
26
  end
11
27
  end
12
28
 
@@ -95,6 +95,19 @@ describe Titler::TitlerHelper do
95
95
 
96
96
  # Configuration Values Context ----------------------------------------------------
97
97
  context 'when titler configuration values exist' do
98
+ it 'uses the options in the configuration block instead of defaults' do
99
+ controller = MockController.new
100
+ stub_rails(controller, 'production', nil)
101
+ load_translations({})
102
+
103
+ Titler.configure do |config|
104
+ config.delimiter = ' | '
105
+ end
106
+
107
+ expect(titler_helper.titler).to include('|')
108
+
109
+ Titler.reset
110
+ end
98
111
  end
99
112
 
100
113
  def stub_rails(controller, env_str, content_for)
@@ -116,8 +129,6 @@ describe Titler::TitlerHelper do
116
129
  I18n.backend.store_translations(:en, { titler: titles })
117
130
  end
118
131
 
119
- # TODO: Can this be right? I'm using what is essentially a private method from inside titler to
120
- # set up tests for titler. Just for the sake of saving some lines of code.
121
132
  def env_prefix
122
133
  Rails.env.production? ? '' : "(#{Rails.env[0,1].upcase}) "
123
134
  end
@@ -170,13 +181,4 @@ describe Titler::TitlerHelper do
170
181
  def titler_helper
171
182
  @titler_helper ||= Class.new { include Titler::TitlerHelper }.new
172
183
  end
173
-
174
- # def helper
175
- # Helper.new
176
- # end
177
- #
178
- # class Helper
179
- # include Singleton
180
- # include ActionView::Helpers::CaptureHelper
181
- # end
182
184
  end
data/titler.gemspec CHANGED
@@ -6,7 +6,7 @@ require 'titler/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "titler"
8
8
  spec.version = Titler::VERSION
9
- spec.authors = ["Robert Travis Pierce"]
9
+ spec.authors = ["Robert Travis Pierce", "Jonathan Allured"]
10
10
  spec.email = ["robert@roberttravispierce.com"]
11
11
 
12
12
  spec.summary = %q{Titler is a ruby gem that automaticaly gives you useful and consistent page titles for your Rails application.}
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: titler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Travis Pierce
8
+ - Jonathan Allured
8
9
  autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
- date: 2017-07-10 00:00:00.000000000 Z
12
+ date: 2017-07-14 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rails
@@ -236,6 +237,7 @@ files:
236
237
  - ".ruby-version"
237
238
  - ".travis.yml"
238
239
  - Gemfile
240
+ - LICENSE
239
241
  - README.md
240
242
  - Rakefile
241
243
  - app/helpers/titler/titler_helper.rb