pretty_param 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,7 +1,14 @@
1
1
  Pretty Param
2
2
  ============
3
3
 
4
- Easily make your resource-based routes more search engine friendly.
4
+ Easily make your resource-based routes more search engine friendly without doing a bunch of crazy shit or changing your routes.
5
+
6
+ Installation
7
+ ------------
8
+
9
+ Gemfile:
10
+
11
+ gem 'pretty_param'
5
12
 
6
13
  Usage
7
14
  -----
@@ -1,3 +1,3 @@
1
1
  module PrettyParam
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -1,5 +1,38 @@
1
+ require 'rails/all'
2
+ require 'pretty_param'
3
+
4
+ ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: "test.db")
5
+ ActiveRecord::Base.connection.execute("DROP TABLE IF EXISTS 'dummies'")
6
+ ActiveRecord::Base.connection.create_table(:dummies) do |t|
7
+ t.string :first_name
8
+ t.string :last_name
9
+ t.string :nickname
10
+ end
11
+
12
+ describe ActiveRecord::Base do
13
+ it "should receive #has_pretty_param" do
14
+ ActiveRecord::Base.should respond_to(:has_pretty_param)
15
+ end
16
+ end
17
+
18
+ class Dummy < ActiveRecord::Base
19
+ has_pretty_param :first_name, :last_name
20
+ end
21
+
1
22
  describe PrettyParam do
2
- it "should have tests but doesn't yet because testing Rails outside of Rails is a pain. Also, the source code to this gem is like 15 lines." do
3
- 1.should eq(2)
23
+ let(:dummy) { Dummy.create(first_name: "Alex", last_name: "Kiheri", nickname: "AFK") }
24
+ let(:blinged_dummy) { Dummy.create(first_name: "^A%lex@#", last_name: "#K+iheri!@") }
25
+ let(:multiple_space_dummy) { Dummy.create(first_name: "Alex ", last_name: " Kiheri") }
26
+
27
+ it "should add specified attributes to `to_param`" do
28
+ dummy.to_param.should include("alex-kiheri")
29
+ end
30
+
31
+ it "should filter out symbols" do
32
+ blinged_dummy.to_param.should include("alex-kiheri")
33
+ end
34
+
35
+ it "should remove multiple hyphens" do
36
+ multiple_space_dummy.to_param.should include("alex-kiheri")
4
37
  end
5
38
  end
File without changes
data/test.db ADDED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pretty_param
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-14 00:00:00.000000000 Z
12
+ date: 2012-03-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70345306791800 !ruby/object:Gem::Requirement
16
+ requirement: &70188704978860 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70345306791800
24
+ version_requirements: *70188704978860
25
25
  description: Search-engine friendly URLs for your models
26
26
  email:
27
27
  - kaiuhl@kittelson.com
@@ -36,8 +36,11 @@ files:
36
36
  - Rakefile
37
37
  - lib/pretty_param.rb
38
38
  - lib/pretty_param/version.rb
39
+ - pkg/pretty_param-1.0.0.gem
39
40
  - pretty_param.gemspec
40
41
  - spec/pretty_param_spec.rb
42
+ - spec/test.db
43
+ - test.db
41
44
  homepage: ''
42
45
  licenses: []
43
46
  post_install_message:
@@ -64,3 +67,4 @@ specification_version: 3
64
67
  summary: Search-engine friendly URLs for your models
65
68
  test_files:
66
69
  - spec/pretty_param_spec.rb
70
+ - spec/test.db