human_urls 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
1
+ class AddSlugToPosts< ActiveRecord::Migration
2
+ def change
3
+ add_column :posts, :slug, :string
4
+ add_index :posts, :slug, unique: true
5
+ end
6
+ end
@@ -38,6 +38,18 @@ class SluggableTest < ActiveSupport::TestCase
38
38
  assert_match("this-i-my-slug", taggable.slug)
39
39
  end
40
40
 
41
+ test "slug properly updates an existing slug when auto generated" do
42
+ taggable = TaggableWGeneratedSlug.
43
+ create!(title: "my-title", slug: "my-old-slug")
44
+ taggable.update!(slug: "my-new-slug")
45
+
46
+ assert_match("my-new-slug", taggable.slug)
47
+
48
+ taggable.update!(slug: "")
49
+
50
+ assert_match("my-title", taggable.slug)
51
+ end
52
+
41
53
  test "#to_param returns the slug" do
42
54
  taggable = Taggable.create!(slug: "slug")
43
55
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: human_urls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Klina
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-12 00:00:00.000000000 Z
11
+ date: 2015-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -122,7 +122,7 @@ files:
122
122
  - test/dummy/public/422.html
123
123
  - test/dummy/public/500.html
124
124
  - test/dummy/public/favicon.ico
125
- - test/dummy/tmp/generators/db/migrate/20151112020841_add_slug_to_posts.rb
125
+ - test/dummy/tmp/generators/db/migrate/20151114224559_add_slug_to_posts.rb
126
126
  - test/human_urls/sluggable_test.rb
127
127
  - test/human_urls_test.rb
128
128
  - test/lib/generators/human_urls/slug_migration_generator_test.rb
@@ -189,7 +189,7 @@ test_files:
189
189
  - test/dummy/public/favicon.ico
190
190
  - test/dummy/Rakefile
191
191
  - test/dummy/README.rdoc
192
- - test/dummy/tmp/generators/db/migrate/20151112020841_add_slug_to_posts.rb
192
+ - test/dummy/tmp/generators/db/migrate/20151114224559_add_slug_to_posts.rb
193
193
  - test/human_urls/sluggable_test.rb
194
194
  - test/human_urls_test.rb
195
195
  - test/lib/generators/human_urls/slug_migration_generator_test.rb
@@ -1,6 +0,0 @@
1
- class AddSlugToPosts< ActiveRecord::Migration
2
- def change
3
- add_column :posts, :url, :string
4
- add_index :posts, :url, unique: true
5
- end
6
- end