slugworth 1.2.1 → 1.2.2

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
- SHA1:
3
- metadata.gz: 29c5a2617fdb5cb5bfebeb4545eeb25e19833dba
4
- data.tar.gz: 4667dd9a4eab4e2934a22694fe730bb239da6f60
2
+ SHA256:
3
+ metadata.gz: b2eddb3e353d9f21b578d73fc6d1be2225610b181ff8b894040ba0e01b5aaffa
4
+ data.tar.gz: d39977db71c156734bcd5ea278cf3bcae87260555cb3c235f584decb4abb71a5
5
5
  SHA512:
6
- metadata.gz: 2695d24b686191d58b56ffd5e04e2083b5cc059be663fc6a5a433a096de361a9a060b339f8f67471dcae66439bc5004026a02b69ad502a9cfed69544f0c34473
7
- data.tar.gz: 112887759a1197cbc69e74e06597cb5ae5f062a4143b31a09c31ac9883f2334d2610d22ae4553201c9eed94928e66459f7aefb27a26a96a68eafe32a106ba97b
6
+ metadata.gz: 9b81795147c0714e607a86afad35a78bd21716761b105f95efb1e25f851d53fe2a0181a0863001d0eb9096a2fd3531f6dd35d5ad3e3613cf744c55ed439d2fe3
7
+ data.tar.gz: 15496a654fc906d5b070d359e9d874d7030a0510e43bbb912cb16400504260feee62da0afcf79dca72a2ff3541c2f09044f0068855c85e4383e2e572cc2d3a57
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in slugworth.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  ![Slugworth](http://f.cl.ly/items/3T1K3g040S0u2l0G0d3V/slugworth_header.png)
2
2
 
3
3
  [![Gem Version](http://img.shields.io/gem/v/slugworth.svg?style=flat)](http://badge.fury.io/rb/slugworth)
4
- [![Build Status](http://img.shields.io/travis/mattpolito/slugworth/master.svg?style=flat)](https://travis-ci.org/mattpolito/slugworth)
5
- [![Code Climate](http://img.shields.io/codeclimate/github/mattpolito/slugworth.svg?style=flat)](https://codeclimate.com/github/mattpolito/slugworth)
4
+ [![Build Status](https://img.shields.io/github/workflow/status/mattpolito/slugworth/CI)](https://github.com/mattpolito/slugworth/actions?query=workflow%3ACI)
6
5
 
7
6
  Simple slug functionality for your ActiveRecord objects
8
7
 
@@ -124,3 +123,10 @@ This will add the same specs to your model that get run on Slugworth itself!
124
123
  * [Rye Mason][] for the fantastic heading image.
125
124
 
126
125
  [Rye Mason]: https://github.com/ryenotbread
126
+
127
+ ## About
128
+
129
+ [![Hashrocket logo](https://hashrocket.com/hashrocket_logo.svg)](https://hashrocket.com)
130
+
131
+ Slugworth is supported by the team at [Hashrocket, a
132
+ multidisciplinary design and development consultancy](https://hashrocket.com). If you'd like to [work with us](https://hashrocket.com/contact-us/hire-us) or [join our team](https://hashrocket.com/contact-us/jobs), don't hesitate to get in touch.
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
- require 'rspec/core/rake_task'
2
+ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec path: ".."
4
+
5
+ gem "rails", "5.2.4.4"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec path: ".."
4
+
5
+ gem "rails", "6.0.3.4"
@@ -10,10 +10,10 @@ module Slugworth
10
10
 
11
11
  module ClassMethods
12
12
  def slugged_with(slug_attribute, opts = {})
13
- self.slug_attribute = slug_attribute
14
- self.slug_scope = opts.delete(:scope)
13
+ self.slug_attribute = slug_attribute
14
+ self.slug_scope = opts.delete(:scope)
15
15
  self.slug_incremental = opts.delete(:incremental)
16
- self.slug_updatable = opts.delete(:updatable)
16
+ self.slug_updatable = opts.delete(:updatable)
17
17
  validates_uniqueness_of :slug, scope: slug_scope
18
18
  end
19
19
 
@@ -26,7 +26,9 @@ module Slugworth
26
26
  end
27
27
  end
28
28
 
29
- def to_param; slug; end
29
+ def to_param
30
+ slug
31
+ end
30
32
 
31
33
  private
32
34
 
@@ -1,3 +1,3 @@
1
1
  module Slugworth
2
- VERSION = "1.2.1".freeze
2
+ VERSION = "1.2.2".freeze
3
3
  end
@@ -1,13 +1,13 @@
1
1
  shared_examples_for :has_slug_functionality do
2
2
  describe "#slug" do
3
3
  context "when no slug is set" do
4
- specify 'slug is generated with slug attribute' do
5
- obj = described_class.new(described_class.slug_attribute => 'Generated slug')
4
+ specify "slug is generated with slug attribute" do
5
+ obj = described_class.new(described_class.slug_attribute => "Generated slug")
6
6
  obj.valid?
7
- expect(obj.slug).to eq('generated-slug')
7
+ expect(obj.slug).to eq("generated-slug")
8
8
  end
9
9
 
10
- specify 'slug is not generated with no slug attribute' do
10
+ specify "slug is not generated with no slug attribute" do
11
11
  obj = described_class.new
12
12
  obj.valid?
13
13
  expect(obj.slug).to be_nil
@@ -15,54 +15,54 @@ shared_examples_for :has_slug_functionality do
15
15
  end
16
16
 
17
17
  context "when the slug is set" do
18
- specify 'slug is set to passed value' do
19
- obj = described_class.new(slug: 'passed-slug')
18
+ specify "slug is set to passed value" do
19
+ obj = described_class.new(slug: "passed-slug")
20
20
  obj.valid?
21
- expect(obj.slug).to eq('passed-slug')
21
+ expect(obj.slug).to eq("passed-slug")
22
22
  end
23
23
  end
24
24
 
25
25
  context "when slug is already taken" do
26
26
  before do
27
- existing = described_class.new(slug: 'taken-slug')
27
+ existing = described_class.new(slug: "taken-slug")
28
28
  existing.save(validate: false)
29
29
  end
30
30
 
31
31
  specify "object is not valid" do
32
- obj = described_class.new(slug: 'taken-slug')
32
+ obj = described_class.new(slug: "taken-slug")
33
33
  obj.valid?
34
34
  expect(obj.errors[:slug]).to_not be_empty
35
35
  end
36
36
  end
37
37
  end
38
38
 
39
- describe '#to_param' do
40
- specify 'parameter uses slug' do
41
- obj = described_class.new(slug: 'passed-slug')
42
- expect(obj.to_param).to eq('passed-slug')
39
+ describe "#to_param" do
40
+ specify "parameter uses slug" do
41
+ obj = described_class.new(slug: "passed-slug")
42
+ expect(obj.to_param).to eq("passed-slug")
43
43
  end
44
44
  end
45
45
 
46
46
  describe ".find_by_slug" do
47
- context 'when record is available to be found' do
47
+ context "when record is available to be found" do
48
48
  before do
49
- record = described_class.new(slug: 'named-slug')
49
+ record = described_class.new(slug: "named-slug")
50
50
  record.save(validate: false)
51
51
  end
52
52
 
53
- specify 'record is returned' do
54
- record = described_class.find_by_slug('named-slug')
53
+ specify "record is returned" do
54
+ record = described_class.find_by_slug("named-slug")
55
55
  expect(record).to be_present
56
56
  end
57
57
  end
58
58
 
59
- context 'when record is not found' do
60
- specify 'nil is returned' do
61
- expect(described_class.find_by_slug('named-slug')).to eq(nil)
59
+ context "when record is not found" do
60
+ specify "nil is returned" do
61
+ expect(described_class.find_by_slug("named-slug")).to eq(nil)
62
62
  end
63
63
 
64
- specify 'error is raised' do
65
- expect{ described_class.find_by_slug!('named-slug') }.to raise_error(ActiveRecord::RecordNotFound)
64
+ specify "error is raised" do
65
+ expect { described_class.find_by_slug!("named-slug") }.to raise_error(ActiveRecord::RecordNotFound)
66
66
  end
67
67
  end
68
68
  end
@@ -70,18 +70,18 @@ end
70
70
 
71
71
  shared_examples_for :has_updatable_slug_functionality do
72
72
  describe "#slug :updatable" do
73
- let!(:existing) { described_class.create(described_class.slug_attribute => 'Name') }
73
+ let!(:existing) { described_class.create(described_class.slug_attribute => "Name") }
74
74
  context "when attribute is changed" do
75
75
  specify "updates the slug" do
76
- existing[described_class.slug_attribute] = 'New Name'
76
+ existing[described_class.slug_attribute] = "New Name"
77
77
  expect(existing).to be_valid
78
- expect(existing.slug).to eq('new-name')
78
+ expect(existing.slug).to eq("new-name")
79
79
  end
80
80
  end
81
81
  context "when attribute is not changed" do
82
82
  specify "does not update the slug" do
83
83
  expect(existing).to be_valid
84
- expect(existing.slug).to eq('name')
84
+ expect(existing.slug).to eq("name")
85
85
  end
86
86
  end
87
87
  end
@@ -91,37 +91,37 @@ shared_examples_for :has_incremental_slug_functionality do
91
91
  describe "#slug :incremental" do
92
92
  context "when slug is already taken" do
93
93
  before do
94
- existing = described_class.new(slug: 'taken-slug')
94
+ existing = described_class.new(slug: "taken-slug")
95
95
  existing.save(validate: false)
96
96
  end
97
97
 
98
98
  specify "increments the slug" do
99
- obj = described_class.new(described_class.slug_attribute => 'Taken Slug')
99
+ obj = described_class.new(described_class.slug_attribute => "Taken Slug")
100
100
  expect(obj).to be_valid
101
- expect(obj.slug).to eq('taken-slug-1')
101
+ expect(obj.slug).to eq("taken-slug-1")
102
102
  end
103
103
  end
104
104
  context "when incremented slug is already taken" do
105
105
  before do
106
- existing = described_class.new(slug: 'taken-slug')
106
+ existing = described_class.new(slug: "taken-slug")
107
107
  existing.save(validate: false)
108
- existing = described_class.new(slug: 'taken-slug-1')
108
+ existing = described_class.new(slug: "taken-slug-1")
109
109
  existing.save(validate: false)
110
110
  end
111
111
 
112
112
  specify "increments the slug" do
113
- obj = described_class.new(described_class.slug_attribute => 'Taken Slug')
113
+ obj = described_class.new(described_class.slug_attribute => "Taken Slug")
114
114
  expect(obj).to be_valid
115
- expect(obj.slug).to eq('taken-slug-2')
115
+ expect(obj.slug).to eq("taken-slug-2")
116
116
  end
117
117
  end
118
118
  context "when existing slug is reset" do
119
- let!(:existing) { described_class.create(described_class.slug_attribute => 'New Name') }
119
+ let!(:existing) { described_class.create(described_class.slug_attribute => "New Name") }
120
120
 
121
121
  specify "does not increment the slug" do
122
122
  existing.slug = nil
123
123
  expect(existing).to be_valid
124
- expect(existing.slug).to eq('new-name')
124
+ expect(existing.slug).to eq("new-name")
125
125
  end
126
126
  end
127
127
  end
@@ -131,12 +131,12 @@ shared_examples_for :has_scoped_slug_functionality do
131
131
  describe "#slug :scope" do
132
132
  context "when slug is already taken on same scope" do
133
133
  before do
134
- existing = described_class.new(slug: 'taken-slug', described_class.slug_scope => 1)
134
+ existing = described_class.new(:slug => "taken-slug", described_class.slug_scope => 1)
135
135
  existing.save(validate: false)
136
136
  end
137
137
 
138
138
  specify "object is not valid" do
139
- obj = described_class.new(slug: 'taken-slug', described_class.slug_scope => 1)
139
+ obj = described_class.new(:slug => "taken-slug", described_class.slug_scope => 1)
140
140
  expect(obj).to_not be_valid
141
141
  expect(obj.errors[:slug]).to_not be_empty
142
142
  end
@@ -144,12 +144,12 @@ shared_examples_for :has_scoped_slug_functionality do
144
144
 
145
145
  context "when slug is already taken on another scope" do
146
146
  before do
147
- existing = described_class.new(slug: 'taken-slug', described_class.slug_scope => 1)
147
+ existing = described_class.new(:slug => "taken-slug", described_class.slug_scope => 1)
148
148
  existing.save(validate: false)
149
149
  end
150
150
 
151
151
  specify "object is valid" do
152
- obj = described_class.new(slug: 'taken-slug', described_class.slug_scope => 2)
152
+ obj = described_class.new(:slug => "taken-slug", described_class.slug_scope => 2)
153
153
  expect(obj).to be_valid
154
154
  end
155
155
  end
@@ -160,40 +160,40 @@ shared_examples_for :has_incremental_scoped_slug_functionality do
160
160
  describe "#slug :incremental" do
161
161
  context "when slug is already taken" do
162
162
  before do
163
- existing = described_class.new(slug: 'taken-slug', described_class.slug_scope => 1)
163
+ existing = described_class.new(:slug => "taken-slug", described_class.slug_scope => 1)
164
164
  existing.save(validate: false)
165
165
  end
166
166
 
167
167
  specify "increments the slug" do
168
- obj = described_class.new(described_class.slug_attribute => 'Taken Slug', described_class.slug_scope => 1)
168
+ obj = described_class.new(described_class.slug_attribute => "Taken Slug", described_class.slug_scope => 1)
169
169
  expect(obj).to be_valid
170
- expect(obj.slug).to eq('taken-slug-1')
170
+ expect(obj.slug).to eq("taken-slug-1")
171
171
  end
172
172
  end
173
173
  context "when incremented slug is already taken" do
174
174
  before do
175
- existing = described_class.new(slug: 'taken-slug', described_class.slug_scope => 1)
175
+ existing = described_class.new(:slug => "taken-slug", described_class.slug_scope => 1)
176
176
  existing.save(validate: false)
177
- existing = described_class.new(slug: 'taken-slug-1', described_class.slug_scope => 1)
177
+ existing = described_class.new(:slug => "taken-slug-1", described_class.slug_scope => 1)
178
178
  existing.save(validate: false)
179
179
  end
180
180
 
181
181
  specify "increments the slug" do
182
- obj = described_class.new(described_class.slug_attribute => 'Taken Slug', described_class.slug_scope => 1)
182
+ obj = described_class.new(described_class.slug_attribute => "Taken Slug", described_class.slug_scope => 1)
183
183
  expect(obj).to be_valid
184
- expect(obj.slug).to eq('taken-slug-2')
184
+ expect(obj.slug).to eq("taken-slug-2")
185
185
  end
186
186
  end
187
187
  context "when slug is already taken in another scope" do
188
188
  before do
189
- existing = described_class.new(slug: 'taken-slug', described_class.slug_scope => 1)
189
+ existing = described_class.new(:slug => "taken-slug", described_class.slug_scope => 1)
190
190
  existing.save(validate: false)
191
191
  end
192
192
 
193
193
  specify "does not increment the slug" do
194
- obj = described_class.new(described_class.slug_attribute => 'Taken Slug', described_class.slug_scope => 2)
194
+ obj = described_class.new(described_class.slug_attribute => "Taken Slug", described_class.slug_scope => 2)
195
195
  expect(obj).to be_valid
196
- expect(obj.slug).to eq('taken-slug')
196
+ expect(obj.slug).to eq("taken-slug")
197
197
  end
198
198
  end
199
199
  end
@@ -1,29 +1,30 @@
1
- # coding: utf-8
2
1
  lib = File.expand_path("../lib", __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require "slugworth/version"
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = "slugworth"
8
- spec.version = Slugworth::VERSION
9
- spec.authors = ["Matt Polito"]
10
- spec.email = ["matt.polito@gmail.com"]
11
- spec.description = %q{Easy slug functionality}
12
- spec.summary = %q{Easy slug functionality}
13
- spec.homepage = "https://github.com/mattpolito/slugworth"
14
- spec.license = "MIT"
6
+ spec.name = "slugworth"
7
+ spec.version = Slugworth::VERSION
8
+ spec.authors = ["Matt Polito"]
9
+ spec.email = ["matt.polito@gmail.com"]
10
+ spec.description = "Easy slug functionality"
11
+ spec.summary = "Easy slug functionality"
12
+ spec.homepage = "https://github.com/mattpolito/slugworth"
13
+ spec.license = "MIT"
15
14
 
16
- spec.files = `git ls-files`.split($/)
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
16
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|.github)/}) }
17
+ end
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
19
  spec.require_paths = ["lib"]
19
20
 
20
- spec.required_ruby_version = ">= 1.9.2"
21
+ spec.required_ruby_version = ">= 2.6"
21
22
 
22
- spec.add_development_dependency "bundler", "~> 1.3"
23
23
  spec.add_development_dependency "rake"
24
- spec.add_development_dependency "rspec", "~> 3.3"
25
- spec.add_development_dependency "activerecord", "~> 4.0.0"
24
+ spec.add_development_dependency "rspec", "~> 3.0"
25
+ spec.add_development_dependency "activerecord", ">= 4.0"
26
26
  spec.add_development_dependency "pry"
27
- spec.add_development_dependency "database_cleaner", "~> 1.0.1"
27
+ spec.add_development_dependency "database_cleaner", "~> 1.0"
28
28
  spec.add_development_dependency "sqlite3"
29
+ spec.add_development_dependency "standard"
29
30
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slugworth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Polito
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-09 00:00:00.000000000 Z
11
+ date: 2021-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.3'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.3'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -44,28 +30,28 @@ dependencies:
44
30
  requirements:
45
31
  - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: '3.3'
33
+ version: '3.0'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: '3.3'
40
+ version: '3.0'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: activerecord
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - "~>"
45
+ - - ">="
60
46
  - !ruby/object:Gem::Version
61
- version: 4.0.0
47
+ version: '4.0'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - "~>"
52
+ - - ">="
67
53
  - !ruby/object:Gem::Version
68
- version: 4.0.0
54
+ version: '4.0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: pry
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +72,14 @@ dependencies:
86
72
  requirements:
87
73
  - - "~>"
88
74
  - !ruby/object:Gem::Version
89
- version: 1.0.1
75
+ version: '1.0'
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
80
  - - "~>"
95
81
  - !ruby/object:Gem::Version
96
- version: 1.0.1
82
+ version: '1.0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: sqlite3
99
85
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +94,20 @@ dependencies:
108
94
  - - ">="
109
95
  - !ruby/object:Gem::Version
110
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: standard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
111
  description: Easy slug functionality
112
112
  email:
113
113
  - matt.polito@gmail.com
@@ -121,17 +121,17 @@ files:
121
121
  - LICENSE.txt
122
122
  - README.md
123
123
  - Rakefile
124
+ - gemfiles/Gemfile.rails-5.2.4.4
125
+ - gemfiles/Gemfile.rails-6.0.3.4
124
126
  - lib/slugworth.rb
125
127
  - lib/slugworth/version.rb
126
128
  - lib/slugworth_shared_examples.rb
127
129
  - slugworth.gemspec
128
- - spec/sluggle_spec.rb
129
- - spec/spec_helper.rb
130
130
  homepage: https://github.com/mattpolito/slugworth
131
131
  licenses:
132
132
  - MIT
133
133
  metadata: {}
134
- post_install_message:
134
+ post_install_message:
135
135
  rdoc_options: []
136
136
  require_paths:
137
137
  - lib
@@ -139,18 +139,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
139
139
  requirements:
140
140
  - - ">="
141
141
  - !ruby/object:Gem::Version
142
- version: 1.9.2
142
+ version: '2.6'
143
143
  required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  requirements:
145
145
  - - ">="
146
146
  - !ruby/object:Gem::Version
147
147
  version: '0'
148
148
  requirements: []
149
- rubyforge_project:
150
- rubygems_version: 2.4.6
151
- signing_key:
149
+ rubygems_version: 3.2.3
150
+ signing_key:
152
151
  specification_version: 4
153
152
  summary: Easy slug functionality
154
- test_files:
155
- - spec/sluggle_spec.rb
156
- - spec/spec_helper.rb
153
+ test_files: []
@@ -1,56 +0,0 @@
1
- require 'spec_helper'
2
- require 'slugworth_shared_examples'
3
- require 'slugworth'
4
-
5
- ActiveRecord::Base.connection.execute(
6
- %{CREATE TABLE users (id INTEGER PRIMARY KEY, name STRING, slug STRING, age INTEGER);}
7
- )
8
-
9
- class User < ActiveRecord::Base
10
- include Slugworth
11
- slugged_with :name
12
- end
13
-
14
- describe User do
15
- it_behaves_like :has_slug_functionality
16
- end
17
-
18
- class IncrementalUser < ActiveRecord::Base
19
- self.table_name = 'users'
20
- include Slugworth
21
- slugged_with :name, incremental: true
22
- end
23
-
24
- describe IncrementalUser do
25
- it_behaves_like :has_incremental_slug_functionality
26
- end
27
-
28
- class UpdatableUser < ActiveRecord::Base
29
- self.table_name = 'users'
30
- include Slugworth
31
- slugged_with :name, updatable: true
32
- end
33
-
34
- describe UpdatableUser do
35
- it_behaves_like :has_updatable_slug_functionality
36
- end
37
-
38
- class ScopedUser < ActiveRecord::Base
39
- self.table_name = 'users'
40
- include Slugworth
41
- slugged_with :name, scope: :age
42
- end
43
-
44
- describe ScopedUser do
45
- it_behaves_like :has_scoped_slug_functionality
46
- end
47
-
48
- class IncrementalScopedUser < ActiveRecord::Base
49
- self.table_name = 'users'
50
- include Slugworth
51
- slugged_with :name, scope: :age, incremental: true
52
- end
53
-
54
- describe IncrementalScopedUser do
55
- it_behaves_like :has_incremental_scoped_slug_functionality
56
- end
@@ -1,24 +0,0 @@
1
- require 'rspec'
2
- require 'database_cleaner'
3
- require 'active_record'
4
-
5
- ActiveRecord::Base.establish_connection(
6
- adapter: 'sqlite3', database: ':memory:'
7
- )
8
-
9
- RSpec.configure do |config|
10
- config.order = "random"
11
-
12
- config.before(:suite) do
13
- DatabaseCleaner.clean_with(:truncation)
14
- end
15
-
16
- config.before(:each) do
17
- DatabaseCleaner.strategy = :transaction
18
- DatabaseCleaner.start
19
- end
20
-
21
- config.after(:each) do
22
- DatabaseCleaner.clean
23
- end
24
- end