human_urls 0.1.2 → 0.1.3.pre.alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/human_urls/sluggable.rb +0 -1
- data/lib/human_urls/version.rb +1 -1
- data/test/dummy/log/test.log +72 -0
- data/test/dummy/tmp/generators/db/migrate/20160213021036_add_slug_to_posts.rb +6 -0
- data/test/human_urls/sluggable_test.rb +0 -12
- metadata +6 -6
- data/test/dummy/tmp/generators/db/migrate/20160212014003_add_slug_to_posts.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b7a18ae4c2f218111f90f0d24c2f29b71f71a55
|
4
|
+
data.tar.gz: edeb13366c7d16750ef93cddc82244fa39be910d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47926910380b870dc616cb498a5155b9078ebafc05f71f097de7b9fa1178afb3dc540fc7a38015e621ca62cdbad3298716d16038a5b6a0d4471ac37a73c9330a
|
7
|
+
data.tar.gz: db5bca0240d3a0d809e115b356fda479ede9d485517db28b9b1f66f0e6cfcd157c1595ee904d5913f52454d2a183b1b06cb592dc92ac72d75011eba029b2c357
|
data/lib/human_urls/sluggable.rb
CHANGED
@@ -10,7 +10,6 @@ module HumanUrls
|
|
10
10
|
module ClassMethods
|
11
11
|
def sluggify(slug_param=:slug, generated_from: false)
|
12
12
|
validates_presence_of slug_param
|
13
|
-
validates_uniqueness_of slug_param, case_sensitive: false
|
14
13
|
validates_length_of slug_param, maximum: 244
|
15
14
|
|
16
15
|
define_method(:to_param) do
|
data/lib/human_urls/version.rb
CHANGED
data/test/dummy/log/test.log
CHANGED
@@ -5312,3 +5312,75 @@ HumanUrls::SlugMigrationGeneratorTest: test_generator_creates_proper_migration_w
|
|
5312
5312
|
HumanUrlsTest: test_truth
|
5313
5313
|
-------------------------
|
5314
5314
|
[1m[35m (0.2ms)[0m ROLLBACK
|
5315
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.8ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
5316
|
+
[1m[35m (0.3ms)[0m BEGIN
|
5317
|
+
-------------------------
|
5318
|
+
HumanUrlsTest: test_truth
|
5319
|
+
-------------------------
|
5320
|
+
[1m[36m (0.3ms)[0m [1mROLLBACK[0m
|
5321
|
+
[1m[35m (0.2ms)[0m BEGIN
|
5322
|
+
------------------------------------------------------------------------------------------------------------
|
5323
|
+
HumanUrls::SlugMigrationGeneratorTest: test_generator_creates_proper_migration_when_using_custom_slug_column
|
5324
|
+
------------------------------------------------------------------------------------------------------------
|
5325
|
+
[1m[36m (0.3ms)[0m [1mROLLBACK[0m
|
5326
|
+
[1m[35m (0.2ms)[0m BEGIN
|
5327
|
+
------------------------------------------------------------------------------
|
5328
|
+
HumanUrls::SlugMigrationGeneratorTest: test_generator_creates_proper_migration
|
5329
|
+
------------------------------------------------------------------------------
|
5330
|
+
[1m[36m (0.3ms)[0m [1mROLLBACK[0m
|
5331
|
+
[1m[35m (0.2ms)[0m BEGIN
|
5332
|
+
------------------------------------------------------------------------
|
5333
|
+
SluggableTest: test_slug_properly_formats_string_to_slug_friendly_format
|
5334
|
+
------------------------------------------------------------------------
|
5335
|
+
[1m[36m (0.4ms)[0m [1mSAVEPOINT active_record_1[0m
|
5336
|
+
[1m[35mSQL (3.0ms)[0m INSERT INTO "taggables" ("slug", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["slug", "this-i-my-slug"], ["created_at", "2016-02-13 02:10:36.981768"], ["updated_at", "2016-02-13 02:10:36.981768"]]
|
5337
|
+
[1m[36m (0.3ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
5338
|
+
[1m[35m (0.3ms)[0m ROLLBACK
|
5339
|
+
[1m[36m (0.2ms)[0m [1mBEGIN[0m
|
5340
|
+
----------------------------------------------
|
5341
|
+
SluggableTest: test_#to_param_returns_the_slug
|
5342
|
+
----------------------------------------------
|
5343
|
+
[1m[35m (0.2ms)[0m SAVEPOINT active_record_1
|
5344
|
+
[1m[36mSQL (0.6ms)[0m [1mINSERT INTO "taggables" ("slug", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id"[0m [["slug", "slug"], ["created_at", "2016-02-13 02:10:36.993732"], ["updated_at", "2016-02-13 02:10:36.993732"]]
|
5345
|
+
[1m[35m (0.2ms)[0m RELEASE SAVEPOINT active_record_1
|
5346
|
+
[1m[36m (0.2ms)[0m [1mROLLBACK[0m
|
5347
|
+
[1m[35m (0.2ms)[0m BEGIN
|
5348
|
+
-----------------------------------------------------------------------------------
|
5349
|
+
SluggableTest: test_slug_does_not_update_an_existing_slug_when_source_field_changes
|
5350
|
+
-----------------------------------------------------------------------------------
|
5351
|
+
[1m[36m (0.4ms)[0m [1mSAVEPOINT active_record_1[0m
|
5352
|
+
[1m[35mSQL (0.9ms)[0m INSERT INTO "taggable_w_generated_slugs" ("title", "slug", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["title", "my-title"], ["slug", "my-old-slug"], ["created_at", "2016-02-13 02:10:37.009590"], ["updated_at", "2016-02-13 02:10:37.009590"]]
|
5353
|
+
[1m[36m (0.2ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
5354
|
+
[1m[35m (0.2ms)[0m SAVEPOINT active_record_1
|
5355
|
+
[1m[36mSQL (0.7ms)[0m [1mUPDATE "taggable_w_generated_slugs" SET "title" = $1, "updated_at" = $2 WHERE "taggable_w_generated_slugs"."id" = $3[0m [["title", "Changed Title"], ["updated_at", "2016-02-13 02:10:37.013975"], ["id", 64]]
|
5356
|
+
[1m[35m (0.2ms)[0m RELEASE SAVEPOINT active_record_1
|
5357
|
+
[1m[36m (0.2ms)[0m [1mROLLBACK[0m
|
5358
|
+
[1m[35m (0.2ms)[0m BEGIN
|
5359
|
+
------------------------------------------------------------------------------
|
5360
|
+
SluggableTest: test_slug_properly_updates_an_existing_slug_when_auto_generated
|
5361
|
+
------------------------------------------------------------------------------
|
5362
|
+
[1m[36m (0.2ms)[0m [1mSAVEPOINT active_record_1[0m
|
5363
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "taggable_w_generated_slugs" ("title", "slug", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["title", "my-title"], ["slug", "my-old-slug"], ["created_at", "2016-02-13 02:10:37.023940"], ["updated_at", "2016-02-13 02:10:37.023940"]]
|
5364
|
+
[1m[36m (0.2ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
5365
|
+
[1m[35m (0.2ms)[0m SAVEPOINT active_record_1
|
5366
|
+
[1m[36mSQL (0.5ms)[0m [1mUPDATE "taggable_w_generated_slugs" SET "slug" = $1, "updated_at" = $2 WHERE "taggable_w_generated_slugs"."id" = $3[0m [["slug", "my-new-slug"], ["updated_at", "2016-02-13 02:10:37.026620"], ["id", 65]]
|
5367
|
+
[1m[35m (0.3ms)[0m RELEASE SAVEPOINT active_record_1
|
5368
|
+
[1m[36m (0.2ms)[0m [1mSAVEPOINT active_record_1[0m
|
5369
|
+
[1m[35mSQL (0.9ms)[0m UPDATE "taggable_w_generated_slugs" SET "slug" = $1, "updated_at" = $2 WHERE "taggable_w_generated_slugs"."id" = $3 [["slug", "my-title"], ["updated_at", "2016-02-13 02:10:37.030511"], ["id", 65]]
|
5370
|
+
[1m[36m (0.4ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
5371
|
+
[1m[35m (0.3ms)[0m ROLLBACK
|
5372
|
+
[1m[36m (0.2ms)[0m [1mBEGIN[0m
|
5373
|
+
--------------------------------------------------------------------
|
5374
|
+
SluggableTest: test_.sluggify_can_generate_slug_from_given_attribute
|
5375
|
+
--------------------------------------------------------------------
|
5376
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
5377
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "taggable_w_generated_slugs" ("title", "slug", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id"[0m [["title", "My Title"], ["slug", "my-title"], ["created_at", "2016-02-13 02:10:37.035854"], ["updated_at", "2016-02-13 02:10:37.035854"]]
|
5378
|
+
[1m[35m (0.2ms)[0m RELEASE SAVEPOINT active_record_1
|
5379
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
5380
|
+
[1m[35m (0.1ms)[0m BEGIN
|
5381
|
+
----------------------------------------------
|
5382
|
+
SluggableTest: test_validates_presence_of_slug
|
5383
|
+
----------------------------------------------
|
5384
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
5385
|
+
[1m[35m (0.2ms)[0m ROLLBACK TO SAVEPOINT active_record_1
|
5386
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
@@ -20,18 +20,6 @@ class SluggableTest < ActiveSupport::TestCase
|
|
20
20
|
assert_match(/Validation failed: Slug can't be blank/, exp.message)
|
21
21
|
end
|
22
22
|
|
23
|
-
test "validates unqiueness of slug" do
|
24
|
-
Taggable.create!(slug: "slug")
|
25
|
-
exp = assert_raises { Taggable.create!(slug: "slug") }
|
26
|
-
assert_match(/Slug has already been taken/, exp.message)
|
27
|
-
end
|
28
|
-
|
29
|
-
test "validates unqiueness of slug and isn't case sensitive" do
|
30
|
-
Taggable.create!(slug: "Slug")
|
31
|
-
exp = assert_raises { Taggable.create!(slug: "slug") }
|
32
|
-
assert_match(/Slug has already been taken/, exp.message)
|
33
|
-
end
|
34
|
-
|
35
23
|
test "slug properly formats string to slug friendly format" do
|
36
24
|
taggable = Taggable.create!(slug: "This i$ my SLUG")
|
37
25
|
|
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.
|
4
|
+
version: 0.1.3.pre.alpha.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Klina
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-13 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/
|
125
|
+
- test/dummy/tmp/generators/db/migrate/20160213021036_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
|
@@ -142,9 +142,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
142
|
version: 2.0.0
|
143
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
144
|
requirements:
|
145
|
-
- - "
|
145
|
+
- - ">"
|
146
146
|
- !ruby/object:Gem::Version
|
147
|
-
version:
|
147
|
+
version: 1.3.1
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project:
|
150
150
|
rubygems_version: 2.4.5
|
@@ -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/
|
192
|
+
- test/dummy/tmp/generators/db/migrate/20160213021036_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
|