slugs 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/test/records_test.rb CHANGED
@@ -1,20 +1,20 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class RecordsTest < ActiveSupport::TestCase
4
-
5
- test "should not break validation" do
4
+
5
+ test 'validation' do
6
6
  assert Without.new.valid?
7
7
  assert Simple.new.valid?
8
8
  assert Translatable.new.valid?
9
9
  end
10
10
 
11
- test "should not break models" do
11
+ test 'models' do
12
12
  assert_equal 'name', without.name
13
13
  assert_equal without, Without.find('1')
14
14
  assert_equal without, Without.find(1)
15
15
  end
16
16
 
17
- test "should create slug" do
17
+ test 'slug creation' do
18
18
  assert_equal 'name', simple.slug
19
19
  assert_equal simple, Simple.find('name')
20
20
 
@@ -22,7 +22,7 @@ class RecordsTest < ActiveSupport::TestCase
22
22
  assert_equal translatable, Translatable.find('translatable-name')
23
23
  end
24
24
 
25
- test "should update slug" do
25
+ test 'slug edition' do
26
26
  simple.name = 'new name'
27
27
  simple.save!
28
28
  assert_equal 'new-name', simple.slug
@@ -34,7 +34,7 @@ class RecordsTest < ActiveSupport::TestCase
34
34
  assert_equal translatable, Translatable.find('new-translatable-name')
35
35
  end
36
36
 
37
- test "should not alter direct assigned slug" do
37
+ test 'direct assigned slug' do
38
38
  simple.slug = 'direct slug'
39
39
  simple.save!
40
40
  assert_equal 'direct slug', simple.slug
@@ -46,7 +46,7 @@ class RecordsTest < ActiveSupport::TestCase
46
46
  assert_equal translatable, Translatable.find('translatable direct slug')
47
47
  end
48
48
 
49
- test "records should not be readonly" do
49
+ test 'not readonly records' do
50
50
  Simple.create! name: 'editable'
51
51
  assert !Simple.find('editable').readonly?
52
52
 
@@ -54,7 +54,7 @@ class RecordsTest < ActiveSupport::TestCase
54
54
  assert !Translatable.find('editable').readonly?
55
55
  end
56
56
 
57
- test "should assign index for same slugs" do
57
+ test 'index assignment to equal slugs' do
58
58
  first = Simple.create!(name: 'same', age: 34)
59
59
  assert_equal 'same', first.slug
60
60
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slugs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Museways
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-09 00:00:00.000000000 Z
11
+ date: 2014-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -58,7 +58,7 @@ dependencies:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '1.3'
61
- description: Inspired in friendly_id but more minimalistic.
61
+ description: Minimalistic slugs inspired in friendly_id for rails.
62
62
  email:
63
63
  - contact@museways.com
64
64
  executables: []
@@ -66,7 +66,7 @@ extensions: []
66
66
  extra_rdoc_files: []
67
67
  files:
68
68
  - MIT-LICENSE
69
- - README.rdoc
69
+ - README.md
70
70
  - Rakefile
71
71
  - lib/slugs.rb
72
72
  - lib/slugs/active_record/base.rb
@@ -111,7 +111,6 @@ files:
111
111
  - test/dummy/db/migrate/20130819183119_create_translatables.rb
112
112
  - test/dummy/db/migrate/20130819183257_create_translatable_translations.rb
113
113
  - test/dummy/db/schema.rb
114
- - test/dummy/db/test.sqlite3
115
114
  - test/dummy/log/development.log
116
115
  - test/dummy/log/test.log
117
116
  - test/dummy/public/404.html
@@ -143,7 +142,7 @@ rubyforge_project:
143
142
  rubygems_version: 2.2.2
144
143
  signing_key:
145
144
  specification_version: 4
146
- summary: Slugs for Rails.
145
+ summary: Slugs for rails.
147
146
  test_files:
148
147
  - test/dummy/app/assets/javascripts/application.js
149
148
  - test/dummy/app/assets/stylesheets/application.css
@@ -179,7 +178,6 @@ test_files:
179
178
  - test/dummy/db/migrate/20130819183119_create_translatables.rb
180
179
  - test/dummy/db/migrate/20130819183257_create_translatable_translations.rb
181
180
  - test/dummy/db/schema.rb
182
- - test/dummy/db/test.sqlite3
183
181
  - test/dummy/log/development.log
184
182
  - test/dummy/log/test.log
185
183
  - test/dummy/public/404.html
data/README.rdoc DELETED
@@ -1,38 +0,0 @@
1
- === WARNING: From version 1.2.0 and above "slug" method has been renamed to "has_slug".
2
-
3
- ---
4
-
5
- {<img src="https://badge.fury.io/rb/slugs.png" alt="Gem Version" />}[http://badge.fury.io/rb/slugs] {<img src="https://codeclimate.com/github/museways/slugs.png" />}[https://codeclimate.com/github/museways/slugs] {<img src="https://secure.travis-ci.org/museways/slugs.png?branch=master" alt="Build Status" />}[https://travis-ci.org/museways/slugs] {<img src="https://gemnasium.com/museways/slugs.png" alt="Dependency Status" />}[https://gemnasium.com/museways/slugs]
6
-
7
- = Slugs
8
-
9
- Inspired in friendly_id but more minimalistic.
10
-
11
- = Install
12
-
13
- Put this line in your Gemfile:
14
- gem 'slugs'
15
-
16
- Then bundle:
17
- $ bundle
18
-
19
- = Usage
20
-
21
- Add the column in your migration:
22
- t.string :slug
23
-
24
- (If you are using translatable_records you need to place the column in the translation table, this has been done this way because it’s easier to maintain and your queries will be faster avoiding extra joins)
25
-
26
- Update your db:
27
- rake db:migrate
28
-
29
- Call the has_slug method in your model:
30
-
31
- If you want to use the value of one field:
32
- has_slug :prop
33
-
34
- To concatenate the value of multiple fields:
35
- has_slug :prop1, :prop2, :prop3
36
-
37
- Or if you need a very custom slug you can use a lambda, proc or block:
38
- has_slug proc { |record| "#{record.prop}-custom" }
Binary file