simple_slug 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 38033c0b797c80a5f1ea79325d95605f9f35dae9
4
+ data.tar.gz: 9bcc30728ffaaa925711bf374b94d359579a84aa
5
+ SHA512:
6
+ metadata.gz: 2a2135bcbc5a5aa951989a6a073c692598ff1bbb7b73195347be469a749c14a1f65a24e93f9cbc553f12632dcf39b7cf8223cacb64e6c3c275cab6db0e82ce8e
7
+ data.tar.gz: 74200571bf0ca1c83747b034920c07fe432f24d9afb977caf89c61de3fe406bca3d5478ff4f208da967c668fb8de414c7fc6ee88fa7338e3d8e3ccd0648cd26e
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .ruby-gemset
7
+ .ruby-version
8
+ .rvmrc
9
+ .idea
10
+ .rspec
11
+ Gemfile.lock
12
+ InstalledFiles
13
+ _yardoc
14
+ coverage
15
+ doc/
16
+ lib/bundler/man
17
+ pkg
18
+ rdoc
19
+ spec/reports
20
+ test/tmp
21
+ test/version_tmp
22
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in simple_slug.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Alex Leschenko
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # SimpleSlug
2
+
3
+ This is not a "bulldozer", this is just friendly id generator for ActiveRecord.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'simple_slug'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install simple_slug
18
+
19
+ ## Usage
20
+
21
+ Add basic slugs to your model:
22
+
23
+ ```ruby
24
+ class User < ActiveRecord::Base
25
+ simple_slug :full_name
26
+ end
27
+ ```
28
+
29
+ Or with custom slug column and history:
30
+
31
+ ```ruby
32
+ class User < ActiveRecord::Base
33
+ simple_slug :full_name, slug_column: 'my_slug_column', history: true
34
+ end
35
+ ```
36
+
37
+ ## Contributing
38
+
39
+ 1. Fork it ( http://github.com/<my-github-username>/simple_slug/fork )
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,13 @@
1
+ class CreateSimpleSlugHistorySlug < ActiveRecord::Migration
2
+ def change
3
+ create_table :simple_slug_history_slug do |t|
4
+ t.string :slug, null: false
5
+ t.integer :sluggable_id, null: false
6
+ t.string :sluggable_type, limit: 50, null: false
7
+ t.datetime :created_at
8
+ end
9
+
10
+ add_index :simple_slug_history_slug, [:slug, :sluggable_type], unique: true
11
+ add_index :simple_slug_history_slug, [:sluggable_type, :sluggable_id]
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module SimpleSlug
2
+ class HistorySlug < ActiveRecord::Base
3
+ belongs_to :sluggable, polymorphic: true
4
+ end
5
+ end
@@ -0,0 +1,113 @@
1
+ module SimpleSlug
2
+ module ModelAddition
3
+ def self.included(base)
4
+ base.send :extend, SingletonMethods
5
+ end
6
+
7
+ module SingletonMethods
8
+ def simple_slug(*args)
9
+ class_attribute :simple_slug_options, instance_writer: false
10
+ options = args.extract_options!
11
+ self.simple_slug_options = options.reverse_merge(slug_column: SimpleSlug.slug_column, slug_method: args)
12
+
13
+ include InstanceMethods
14
+ extend ClassMethods
15
+
16
+ before_validation :simple_slug_generate, if: :should_generate_new_slug?
17
+ validates simple_slug_options[:slug_column],
18
+ presence: true,
19
+ exclusion: {in: SimpleSlug.excludes},
20
+ format: {without: SimpleSlug.exclude_regexp}
21
+ if simple_slug_options[:history]
22
+ after_save :simple_slug_create_history_slug
23
+ after_destroy :simple_slug_cleanup_history
24
+ include InstanceHistoryMethods
25
+ end
26
+ end
27
+ end
28
+
29
+ module ClassMethods
30
+ def simple_slug_find(id_param)
31
+ return unless id_param
32
+ if id_param.is_a?(Integer) || id_param =~ /\A\d+\z/
33
+ find(id_param)
34
+ else
35
+ finder_method = simple_slug_options[:history] ? :find_by : :find_by!
36
+ send(finder_method, simple_slug_options[:slug_column] => id_param) or find(::SimpleSlug::HistorySlug.find_by!(slug: id_param).sluggable_id)
37
+ end
38
+ end
39
+
40
+ alias_method :friendly_find, :simple_slug_find
41
+ end
42
+
43
+ module InstanceMethods
44
+ def to_param
45
+ send(simple_slug_options[:slug_column]).presence || super
46
+ end
47
+
48
+ def should_generate_new_slug?
49
+ send(simple_slug_options[:slug_column]).blank? || simple_slug_options[:history]
50
+ end
51
+
52
+ def simple_slug_generate
53
+ simple_slug = simple_slug_normalize(simple_slug_base)
54
+ return true if simple_slug == send(simple_slug_options[:slug_column]).to_s.sub(/--\d+\z/, '')
55
+ resolved_simple_slug = simple_slug_resolve(simple_slug)
56
+ send "#{simple_slug_options[:slug_column]}=", resolved_simple_slug
57
+ end
58
+
59
+ def simple_slug_base
60
+ simple_slug_options[:slug_method].map{|m| send(m).to_s }.reject(&:blank?).join(' ')
61
+ end
62
+
63
+ def simple_slug_normalize(base)
64
+ normalized = I18n.transliterate(base).parameterize('-').downcase
65
+ normalized.to_s =~ /\A\d+/ ? "_#{normalized}" : normalized
66
+ end
67
+
68
+ def simple_slug_resolve(slug_value)
69
+ if simple_slug_exists?(slug_value)
70
+ loop do
71
+ slug_value_with_suffix = simple_slug_next(slug_value)
72
+ break slug_value_with_suffix unless simple_slug_exists?(slug_value_with_suffix)
73
+ end
74
+ else
75
+ slug_value
76
+ end
77
+ end
78
+
79
+ def simple_slug_next(slug_value)
80
+ "#{slug_value}--#{rand(99999)}"
81
+ end
82
+
83
+ def simple_slug_exists?(slug_value)
84
+ simple_slug_base_exists?(slug_value) || simple_slug_history_exists?(slug_value)
85
+ end
86
+
87
+ def simple_slug_base_exists?(slug_value)
88
+ base_scope = self.class.unscoped.where(simple_slug_options[:slug_column] => slug_value)
89
+ base_scope = base_scope.where('id != ?', id) if persisted?
90
+ base_scope.exists?
91
+ end
92
+
93
+ def simple_slug_history_exists?(slug_value)
94
+ return false unless simple_slug_options[:history]
95
+ base_scope = ::SimpleSlug::HistorySlug.where(sluggable_type: self.class.name, slug: slug_value)
96
+ base_scope = base_scope.where('sluggable_id != ?', id) if persisted?
97
+ base_scope.exists?
98
+ end
99
+ end
100
+
101
+ module InstanceHistoryMethods
102
+ def simple_slug_cleanup_history
103
+ ::SimpleSlug::HistorySlug.where(sluggable_type: self.class.name, sluggable_id: id).delete_all
104
+ end
105
+
106
+ def simple_slug_create_history_slug
107
+ return true unless slug_changed?
108
+ ::SimpleSlug::HistorySlug.where(sluggable_type: self.class.name, sluggable_id: id, slug: send(simple_slug_options[:slug_column])).first_or_create
109
+ end
110
+ end
111
+
112
+ end
113
+ end
@@ -0,0 +1,11 @@
1
+ module SimpleSlug
2
+ class Railtie < Rails::Railtie
3
+ initializer 'simple_slug.model_additions' do
4
+
5
+ ActiveSupport.on_load :active_record do
6
+ include SimpleSlug::ModelAddition
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module SimpleSlug
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,22 @@
1
+ require 'simple_slug/version'
2
+ require 'active_support/core_ext'
3
+ require 'simple_slug/model_addition'
4
+ require 'simple_slug/railtie' if Object.const_defined?(:Rails)
5
+
6
+ module SimpleSlug
7
+ autoload :HistorySlug, 'simple_slug/history_slug'
8
+
9
+ mattr_accessor :excludes
10
+ @@excludes = %w(new edit show index session login logout sign_in sign_out users admin stylesheets assets javascripts images)
11
+
12
+ mattr_accessor :exclude_regexp
13
+ @@exclude_regexp = /\A\d+\z/
14
+
15
+ mattr_accessor :slug_column
16
+ @@slug_column = 'slug'
17
+
18
+ def self.setup
19
+ yield self
20
+ end
21
+
22
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'simple_slug/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'simple_slug'
8
+ spec.version = SimpleSlug::VERSION
9
+ spec.authors = ['Alex Leschenko']
10
+ spec.email = ['leschenko.al@gmail.com']
11
+ spec.summary = %q{Simple slug generator with history.}
12
+ spec.description = %q{This is not a "bulldozer. This is just friendly id generator fo ActiveRecord."}
13
+ spec.homepage = 'https://github.com/leschenko/simple_slug'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'activerecord', '~> 4.0.0'
22
+ spec.add_dependency 'i18n', '~> 0.6.0'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.5'
25
+ spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'rspec'
27
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe SimpleSlug do
4
+ context 'defaults' do
5
+ it 'slug column' do
6
+ SimpleSlug.slug_column.should == 'slug'
7
+ end
8
+
9
+ it 'excludes' do
10
+ SimpleSlug.excludes.should include('new', 'edit')
11
+ end
12
+
13
+ it 'exclude regexps' do
14
+ SimpleSlug.exclude_regexp.should == /\A\d+\z/
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,54 @@
1
+ require 'spec_helper'
2
+
3
+ class SlugHistoryRspecModel < RspecActiveModelBase
4
+ simple_slug :name, history: true
5
+ end
6
+
7
+ describe 'slug history' do
8
+ describe 'history records handling' do
9
+ before do
10
+ SlugHistoryRspecModel.any_instance.stub(:simple_slug_exists?).and_return(false)
11
+ end
12
+
13
+ it 'create' do
14
+ relation = double
15
+ ::SimpleSlug::HistorySlug.should_receive(:where).once.ordered.with(sluggable_type: 'SlugHistoryRspecModel', sluggable_id: 1, slug: 'hello').and_return(relation)
16
+ relation.should_receive(:first_or_create)
17
+ SlugHistoryRspecModel.create(id: 1, name: 'Hello')
18
+ end
19
+
20
+ it 'cleanup' do
21
+ relation = double
22
+ relation.stub(:first_or_create)
23
+ ::SimpleSlug::HistorySlug.stub(:where).and_return(relation)
24
+ relation.should_receive(:delete_all)
25
+ SlugHistoryRspecModel.create(name: 'Hello', id: 1).destroy
26
+ end
27
+ end
28
+
29
+ describe 'conflicts' do
30
+ it 'history slug exists' do
31
+ record = SlugGenerationRspecModel.new(name: 'Hi')
32
+ record.stub(:simple_slug_base_exists?).and_return(false)
33
+ record.should_receive(:simple_slug_history_exists?).once.ordered.and_return(true)
34
+ record.should_receive(:simple_slug_history_exists?).once.ordered.and_return(false)
35
+ record.save
36
+ record.slug.should start_with('hi--')
37
+ end
38
+ end
39
+
40
+ describe '#friendly_find' do
41
+ before do
42
+ SlugHistoryRspecModel.stub(:find_by)
43
+ end
44
+
45
+ it 'find from history' do
46
+ record = double('history')
47
+ record.stub(:sluggable_id).and_return(1)
48
+ ::SimpleSlug::HistorySlug.should_receive(:find_by!).with(slug: 'title').and_return(record)
49
+ SlugHistoryRspecModel.should_receive(:find).with(1).and_return(record)
50
+ SlugHistoryRspecModel.friendly_find('title')
51
+ end
52
+ end
53
+
54
+ end
@@ -0,0 +1,78 @@
1
+ require 'spec_helper'
2
+
3
+ class SlugGenerationRspecModel < RspecActiveModelBase
4
+ simple_slug :name
5
+ end
6
+
7
+ describe SimpleSlug::ModelAddition do
8
+ describe 'slug generation' do
9
+ before do
10
+ SlugGenerationRspecModel.any_instance.stub(:simple_slug_exists?).and_return(false)
11
+ end
12
+
13
+ it 'after save' do
14
+ SlugGenerationRspecModel.create(name: 'Hello').slug.should == 'hello'
15
+ end
16
+
17
+ it 'skip excludes' do
18
+ SlugGenerationRspecModel.new(name: 'new').should_not be_valid
19
+ end
20
+
21
+ it 'skip integers' do
22
+ SlugGenerationRspecModel.new(name: '123').should_not be_valid
23
+ end
24
+
25
+ it 'skip slug generation' do
26
+ SlugGenerationRspecModel.any_instance.stub(:should_generate_new_slug?).and_return(false)
27
+ SlugGenerationRspecModel.create(name: 'Hello').slug.should be_blank
28
+ end
29
+ end
30
+
31
+ describe 'resolve conflicts' do
32
+ it 'duplicate slug' do
33
+ record = SlugGenerationRspecModel.new(name: 'Hi')
34
+ record.should_receive(:simple_slug_exists?).once.ordered.with('hi').and_return(true)
35
+ record.should_receive(:simple_slug_exists?).once.ordered.with(/hi--\d+/).and_return(false)
36
+ record.save
37
+ record.slug.should start_with('hi--')
38
+ end
39
+
40
+ it 'numeric slug' do
41
+ record = SlugGenerationRspecModel.new(name: '123')
42
+ record.should_receive(:simple_slug_exists?).with('_123').and_return(false)
43
+ record.save
44
+ record.slug.should == '_123'
45
+ end
46
+ end
47
+
48
+ describe '#to_param' do
49
+ before do
50
+ SlugGenerationRspecModel.any_instance.stub(:simple_slug_exists?).and_return(false)
51
+ end
52
+
53
+ it 'slug if exists' do
54
+ SlugGenerationRspecModel.create(name: 'Hello').to_param.should == 'hello'
55
+ end
56
+
57
+ it 'id without slug' do
58
+ SlugGenerationRspecModel.create(id: 1).to_param.should == '1'
59
+ end
60
+ end
61
+
62
+ describe '#friendly_find' do
63
+ it '#find if integer like' do
64
+ SlugGenerationRspecModel.should_receive(:find).with(1)
65
+ SlugGenerationRspecModel.friendly_find(1)
66
+ end
67
+
68
+ it '#find if numeric string' do
69
+ SlugGenerationRspecModel.should_receive(:find).with('1')
70
+ SlugGenerationRspecModel.friendly_find('1')
71
+ end
72
+
73
+ it 'find by slug' do
74
+ SlugGenerationRspecModel.should_receive(:find_by!).with('slug' => 'title').and_return(double)
75
+ SlugGenerationRspecModel.friendly_find('title')
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,45 @@
1
+ require 'active_record'
2
+ require 'i18n'
3
+ require 'active_support/core_ext'
4
+ require 'simple_slug'
5
+
6
+ # just silence warning
7
+ I18n.enforce_available_locales = false
8
+
9
+ class RspecActiveModelBase
10
+ include ActiveModel::Model
11
+ include ActiveModel::AttributeMethods
12
+ extend ActiveModel::Callbacks
13
+
14
+ include SimpleSlug::ModelAddition
15
+
16
+ define_model_callbacks :validation, :save, :destroy
17
+
18
+ attr_accessor :id, :slug, :name, :created_at
19
+
20
+ def self.create(attributes, *)
21
+ record = new(attributes)
22
+ record.save
23
+ record
24
+ end
25
+
26
+ def save
27
+ run_callbacks(:validation) { run_callbacks(:save) { } }
28
+ end
29
+
30
+ def destroy
31
+ run_callbacks(:destroy) { @destroyed = true }
32
+ end
33
+
34
+ def persisted?
35
+ true
36
+ end
37
+
38
+ def slug_changed?
39
+ slug.present?
40
+ end
41
+
42
+ def destroyed?
43
+ !!@destroyed
44
+ end
45
+ end
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simple_slug
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Alex Leschenko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: i18n
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.6.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.6.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: This is not a "bulldozer. This is just friendly id generator fo ActiveRecord."
84
+ email:
85
+ - leschenko.al@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - Gemfile
92
+ - LICENSE.txt
93
+ - README.md
94
+ - Rakefile
95
+ - db/migrate/20140113000001_create_simple_slug_history_slug.rb
96
+ - lib/simple_slug.rb
97
+ - lib/simple_slug/history_slug.rb
98
+ - lib/simple_slug/model_addition.rb
99
+ - lib/simple_slug/railtie.rb
100
+ - lib/simple_slug/version.rb
101
+ - simple_slug.gemspec
102
+ - spec/simple_slug/base_spec.rb
103
+ - spec/simple_slug/history_spec.rb
104
+ - spec/simple_slug/model_addition_spec.rb
105
+ - spec/spec_helper.rb
106
+ homepage: https://github.com/leschenko/simple_slug
107
+ licenses:
108
+ - MIT
109
+ metadata: {}
110
+ post_install_message:
111
+ rdoc_options: []
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ requirements: []
125
+ rubyforge_project:
126
+ rubygems_version: 2.2.0.rc.1
127
+ signing_key:
128
+ specification_version: 4
129
+ summary: Simple slug generator with history.
130
+ test_files:
131
+ - spec/simple_slug/base_spec.rb
132
+ - spec/simple_slug/history_spec.rb
133
+ - spec/simple_slug/model_addition_spec.rb
134
+ - spec/spec_helper.rb