acts_as_slugable 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +2 -0
- data/lib/acts_as_slugable.rb +6 -86
- data/lib/acts_as_slugable/acts_as_slugable_4.rb +89 -0
- data/lib/acts_as_slugable/acts_as_slugable_5.rb +83 -0
- data/lib/acts_as_slugable/version.rb +1 -1
- data/lib/arel/3.0/visitors.rb +15 -0
- data/test/debug.log +4081 -0
- data/test/fixtures/page.rb +1 -1
- data/test/slugable_test.rb +12 -4
- metadata +25 -8
data/test/fixtures/page.rb
CHANGED
data/test/slugable_test.rb
CHANGED
@@ -30,11 +30,11 @@ class ActsAsSlugableTest < ActiveSupport::TestCase
|
|
30
30
|
test 'model_still_runs_validations' do
|
31
31
|
pg = Page.create(title: nil)
|
32
32
|
assert !pg.valid?
|
33
|
-
assert pg.errors
|
33
|
+
assert pg.errors[:title]
|
34
34
|
|
35
35
|
pg = Page.create(title: '')
|
36
36
|
assert !pg.valid?
|
37
|
-
assert pg.errors
|
37
|
+
assert pg.errors[:title]
|
38
38
|
end
|
39
39
|
|
40
40
|
# Test the update method
|
@@ -48,11 +48,19 @@ class ActsAsSlugableTest < ActiveSupport::TestCase
|
|
48
48
|
assert_equal 'original-page', pg.url_slug
|
49
49
|
|
50
50
|
# update, with title and nil slug
|
51
|
-
pg.
|
51
|
+
if pg.respond_to?(:update)
|
52
|
+
pg.update(title: 'Updated title and slug to nil', url_slug: nil)
|
53
|
+
else
|
54
|
+
pg.update_attributes(title: 'Updated title and slug to nil', url_slug: nil)
|
55
|
+
end
|
52
56
|
assert_equal 'updated-title-and-slug-to-nil', pg.url_slug
|
53
57
|
|
54
58
|
# update, with empty slug
|
55
|
-
pg.
|
59
|
+
if pg.respond_to?(:update)
|
60
|
+
pg.update(title: 'Updated title and slug to empty', url_slug: '')
|
61
|
+
else
|
62
|
+
pg.update_attributes(title: 'Updated title and slug to empty', url_slug: '')
|
63
|
+
end
|
56
64
|
assert_equal 'updated-title-and-slug-to-empty', pg.url_slug
|
57
65
|
end
|
58
66
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_slugable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arne De Herdt
|
@@ -14,16 +14,16 @@ dependencies:
|
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sqlite3
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,8 +52,22 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
|
56
|
-
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: appraisal
|
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
|
+
description: Originally a Rails 2 plugin, this Gem ports that functionality to newer
|
70
|
+
Rails versions.
|
57
71
|
email:
|
58
72
|
- arne.de.herdt@gmail.com
|
59
73
|
executables: []
|
@@ -64,7 +78,10 @@ files:
|
|
64
78
|
- README.rdoc
|
65
79
|
- Rakefile
|
66
80
|
- lib/acts_as_slugable.rb
|
81
|
+
- lib/acts_as_slugable/acts_as_slugable_4.rb
|
82
|
+
- lib/acts_as_slugable/acts_as_slugable_5.rb
|
67
83
|
- lib/acts_as_slugable/version.rb
|
84
|
+
- lib/arel/3.0/visitors.rb
|
68
85
|
- lib/tasks/slugable_tasks.rake
|
69
86
|
- test/database.yml
|
70
87
|
- test/debug.log
|
@@ -94,7 +111,7 @@ requirements: []
|
|
94
111
|
rubygems_version: 3.0.3
|
95
112
|
signing_key:
|
96
113
|
specification_version: 4
|
97
|
-
summary:
|
114
|
+
summary: Generates a URL slug based on specific fields of the model implementing this.
|
98
115
|
test_files:
|
99
116
|
- test/test_helper.rb
|
100
117
|
- test/debug.log
|