rails_slugs 1.0.10 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- metadata +18 -133
- data/MIT-LICENSE +0 -20
- data/README.rdoc +0 -38
- data/Rakefile +0 -38
- data/lib/rails_slugs.rb +0 -7
- data/lib/rails_slugs/active_record/base.rb +0 -156
- data/lib/rails_slugs/active_record/relation.rb +0 -17
- data/lib/rails_slugs/railtie.rb +0 -10
- data/lib/rails_slugs/version.rb +0 -5
- data/test/dummy/README.rdoc +0 -261
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -15
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/models/simple.rb +0 -7
- data/test/dummy/app/models/translatable.rb +0 -8
- data/test/dummy/app/models/translatable_translation.rb +0 -13
- data/test/dummy/app/models/without.rb +0 -5
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -59
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -37
- data/test/dummy/config/environments/production.rb +0 -67
- data/test/dummy/config/environments/test.rb +0 -37
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -15
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -58
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20120923194640_create_translatables.rb +0 -9
- data/test/dummy/db/migrate/20120923195534_create_translatables_i18n.rb +0 -13
- data/test/dummy/db/migrate/20120924010158_create_simples.rb +0 -11
- data/test/dummy/db/migrate/20130128234241_create_withouts.rb +0 -9
- data/test/dummy/db/schema.rb +0 -38
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -776
- data/test/dummy/log/test.log +0 -11455
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -25
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/rails_slugs_test.rb +0 -9
- data/test/records_test.rb +0 -82
- data/test/test_helper.rb +0 -21
data/test/dummy/public/404.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/404.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/test/dummy/public/422.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/422.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The change you wanted was rejected.</h1>
|
23
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/test/dummy/public/500.html
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/500.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>We're sorry, but something went wrong.</h1>
|
23
|
-
</div>
|
24
|
-
</body>
|
25
|
-
</html>
|
File without changes
|
data/test/dummy/script/rails
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|
data/test/rails_slugs_test.rb
DELETED
data/test/records_test.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class RecordsTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
setup :create_records
|
6
|
-
|
7
|
-
test "should not break validation" do
|
8
|
-
assert Without.new.valid?
|
9
|
-
assert Simple.new.valid?
|
10
|
-
assert Translatable.new.valid?
|
11
|
-
end
|
12
|
-
|
13
|
-
test "should not break without models" do
|
14
|
-
assert_equal 'name', @without.name
|
15
|
-
assert_equal @without, Without.find('1')
|
16
|
-
assert_equal @without, Without.find(1)
|
17
|
-
end
|
18
|
-
|
19
|
-
test "shoud create slug" do
|
20
|
-
assert_equal 'name', @simple.slug
|
21
|
-
assert_equal @simple, Simple.find('name')
|
22
|
-
assert_equal 'translatable-name', @translatable.slug
|
23
|
-
assert_equal @translatable, Translatable.find('translatable-name')
|
24
|
-
end
|
25
|
-
|
26
|
-
test "should edit slug" do
|
27
|
-
@simple.update_attributes :name => 'new name'
|
28
|
-
assert_equal 'new-name', @simple.slug
|
29
|
-
assert_equal @simple, Simple.find('new-name')
|
30
|
-
@translatable.update_attributes :name => 'new translatable name'
|
31
|
-
assert_equal 'new-translatable-name', @translatable.slug
|
32
|
-
assert_equal @translatable, Translatable.find('new-translatable-name')
|
33
|
-
end
|
34
|
-
|
35
|
-
test "should not alter direct assigned slug" do
|
36
|
-
@simple.update_attributes :slug => 'direct slug'
|
37
|
-
assert_equal 'direct slug', @simple.slug
|
38
|
-
assert_equal @simple, Simple.find('direct slug')
|
39
|
-
@translatable.update_attributes :slug => 'translatable direct slug'
|
40
|
-
assert_equal 'translatable direct slug', @translatable.slug
|
41
|
-
assert_equal @translatable, Translatable.find('translatable direct slug')
|
42
|
-
end
|
43
|
-
|
44
|
-
test "should assign index for same slugs" do
|
45
|
-
first = Simple.create(:name => 'same', :age => 34)
|
46
|
-
assert_equal 'same', first.slug
|
47
|
-
second = Simple.create(:name => 'same', :age => 45)
|
48
|
-
assert_equal 'same-1', second.slug
|
49
|
-
third = Simple.create(:name => 'same', :age => 234)
|
50
|
-
assert_equal 'same-2', third.slug
|
51
|
-
|
52
|
-
first.update_attributes :name => 'other'
|
53
|
-
assert_equal 'other', first.slug
|
54
|
-
second.update_attributes :name => 'other'
|
55
|
-
assert_equal 'other-1', second.slug
|
56
|
-
third.update_attributes :name => 'other'
|
57
|
-
assert_equal 'other-2', third.slug
|
58
|
-
|
59
|
-
first = Translatable.create(:name => 'same', :age => 34)
|
60
|
-
assert_equal 'same', first.slug
|
61
|
-
second = Translatable.create(:name => 'same', :age => 45)
|
62
|
-
assert_equal 'same-1', second.slug
|
63
|
-
third = Translatable.create(:name => 'same', :age => 234)
|
64
|
-
assert_equal 'same-2', third.slug
|
65
|
-
|
66
|
-
first.update_attributes :name => 'other'
|
67
|
-
assert_equal 'other', first.slug
|
68
|
-
second.update_attributes :name => 'other'
|
69
|
-
assert_equal 'other-1', second.slug
|
70
|
-
third.update_attributes :name => 'other'
|
71
|
-
assert_equal 'other-2', third.slug
|
72
|
-
end
|
73
|
-
|
74
|
-
protected
|
75
|
-
|
76
|
-
def create_records
|
77
|
-
@without = Without.create(:name => 'name')
|
78
|
-
@simple = Simple.create(:name => 'name', :age => 14)
|
79
|
-
@translatable = Translatable.create(:name => 'translatable name', :age => 20)
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# Configure Rails Environment
|
2
|
-
ENV['RAILS_ENV'] = 'test'
|
3
|
-
|
4
|
-
require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
5
|
-
require 'rails/test_help'
|
6
|
-
|
7
|
-
Rails.backtrace_cleaner.remove_silencers!
|
8
|
-
|
9
|
-
# Load support files
|
10
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
11
|
-
|
12
|
-
# Load fixtures from the engine
|
13
|
-
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
14
|
-
ActiveSupport::TestCase.fixture_path = File.expand_path('../fixtures', __FILE__)
|
15
|
-
end
|
16
|
-
|
17
|
-
# Load database
|
18
|
-
config = YAML::load(File.read(File.expand_path('../dummy/config/database.yml', __FILE__)))
|
19
|
-
config['test']['adapter'] = 'jdbcsqlite3' if RUBY_PLATFORM == 'java'
|
20
|
-
ActiveRecord::Base.establish_connection(config['test'])
|
21
|
-
load(File.expand_path('../dummy/db/schema.rb', __FILE__))
|