formatted_length 0.0.4 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -0
- data/.rspec +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/README.md +1 -18
- data/Rakefile +4 -36
- data/formatted_length.gemspec +30 -0
- data/lib/formatted_length.rb +4 -4
- data/lib/formatted_length/formatted_length.rb +21 -0
- data/lib/formatted_length/model_additions.rb +12 -0
- data/lib/formatted_length/railtie.rb +9 -0
- data/lib/formatted_length/version.rb +1 -1
- data/spec/formatted_length/formatted_length_spec.rb +36 -0
- data/spec/formatted_length/model_additions_spec.rb +39 -0
- data/spec/spec_helper.rb +2 -0
- metadata +51 -115
- data/lib/formatted_length/acts_as_formatted_length.rb +0 -38
- data/test/acts_as_formatted_length_test.rb +0 -61
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -9
- data/test/dummy/app/assets/stylesheets/application.css +0 -7
- 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/model_with_default_length_field.rb +0 -3
- data/test/dummy/app/models/model_with_length_field_and_setter.rb +0 -3
- data/test/dummy/app/models/model_with_non_default_length_field.rb +0 -3
- 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 -45
- 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 -30
- data/test/dummy/config/environments/production.rb +0 -60
- data/test/dummy/config/environments/test.rb +0 -42
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -10
- 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/20111026123348_create_model_with_default_length_fields.rb +0 -9
- data/test/dummy/db/migrate/20111026123424_create_model_with_non_default_length_fields.rb +0 -9
- data/test/dummy/db/migrate/20111026144756_create_model_with_length_field_and_setters.rb +0 -9
- data/test/dummy/db/schema.rb +0 -34
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -33
- data/test/dummy/log/test.log +0 -2
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -26
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/dummy/test/fixtures/model_with_default_length_fields.yml +0 -7
- data/test/dummy/test/fixtures/model_with_length_field_and_setters.yml +0 -7
- data/test/dummy/test/fixtures/model_with_non_default_length_fields.yml +0 -7
- data/test/dummy/test/unit/model_with_default_length_field_test.rb +0 -7
- data/test/dummy/test/unit/model_with_length_field_and_setter_test.rb +0 -7
- data/test/dummy/test/unit/model_with_non_default_length_field_test.rb +0 -7
- data/test/formatted_length_test.rb +0 -7
- data/test/test_helper.rb +0 -10
@@ -1,14 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
#
|
3
|
-
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
-
# is enabled by default.
|
5
|
-
|
6
|
-
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
-
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters format: [:json]
|
9
|
-
end
|
10
|
-
|
11
|
-
# Disable root element in JSON by default.
|
12
|
-
ActiveSupport.on_load(:active_record) do
|
13
|
-
self.include_root_in_json = false
|
14
|
-
end
|
data/test/dummy/config/routes.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
Dummy::Application.routes.draw do
|
2
|
-
# The priority is based upon order of creation:
|
3
|
-
# first created -> highest priority.
|
4
|
-
|
5
|
-
# Sample of regular route:
|
6
|
-
# match 'products/:id' => 'catalog#view'
|
7
|
-
# Keep in mind you can assign values other than :controller and :action
|
8
|
-
|
9
|
-
# Sample of named route:
|
10
|
-
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
11
|
-
# This route can be invoked with purchase_url(:id => product.id)
|
12
|
-
|
13
|
-
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
14
|
-
# resources :products
|
15
|
-
|
16
|
-
# Sample resource route with options:
|
17
|
-
# resources :products do
|
18
|
-
# member do
|
19
|
-
# get 'short'
|
20
|
-
# post 'toggle'
|
21
|
-
# end
|
22
|
-
#
|
23
|
-
# collection do
|
24
|
-
# get 'sold'
|
25
|
-
# end
|
26
|
-
# end
|
27
|
-
|
28
|
-
# Sample resource route with sub-resources:
|
29
|
-
# resources :products do
|
30
|
-
# resources :comments, :sales
|
31
|
-
# resource :seller
|
32
|
-
# end
|
33
|
-
|
34
|
-
# Sample resource route with more complex sub-resources
|
35
|
-
# resources :products do
|
36
|
-
# resources :comments
|
37
|
-
# resources :sales do
|
38
|
-
# get 'recent', :on => :collection
|
39
|
-
# end
|
40
|
-
# end
|
41
|
-
|
42
|
-
# Sample resource route within a namespace:
|
43
|
-
# namespace :admin do
|
44
|
-
# # Directs /admin/products/* to Admin::ProductsController
|
45
|
-
# # (app/controllers/admin/products_controller.rb)
|
46
|
-
# resources :products
|
47
|
-
# end
|
48
|
-
|
49
|
-
# You can have the root of your site routed with "root"
|
50
|
-
# just remember to delete public/index.html.
|
51
|
-
# root :to => 'welcome#index'
|
52
|
-
|
53
|
-
# See how all your routes lay out with "rake routes"
|
54
|
-
|
55
|
-
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
56
|
-
# Note: This route will make all actions in every controller accessible via GET requests.
|
57
|
-
# match ':controller(/:action(/:id(.:format)))'
|
58
|
-
end
|
Binary file
|
data/test/dummy/db/schema.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
# This file is auto-generated from the current state of the database. Instead
|
3
|
-
# of editing this file, please use the migrations feature of Active Record to
|
4
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
-
#
|
6
|
-
# Note that this schema.rb definition is the authoritative source for your
|
7
|
-
# database schema. If you need to create the application database on another
|
8
|
-
# system, you should be using db:schema:load, not running all the migrations
|
9
|
-
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
-
#
|
12
|
-
# It's strongly recommended to check this file into your version control system.
|
13
|
-
|
14
|
-
ActiveRecord::Schema.define(:version => 20111026144756) do
|
15
|
-
|
16
|
-
create_table "model_with_default_length_fields", :force => true do |t|
|
17
|
-
t.integer "length"
|
18
|
-
t.datetime "created_at"
|
19
|
-
t.datetime "updated_at"
|
20
|
-
end
|
21
|
-
|
22
|
-
create_table "model_with_length_field_and_setters", :force => true do |t|
|
23
|
-
t.integer "length"
|
24
|
-
t.datetime "created_at"
|
25
|
-
t.datetime "updated_at"
|
26
|
-
end
|
27
|
-
|
28
|
-
create_table "model_with_non_default_length_fields", :force => true do |t|
|
29
|
-
t.integer "foo"
|
30
|
-
t.datetime "created_at"
|
31
|
-
t.datetime "updated_at"
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
data/test/dummy/db/test.sqlite3
DELETED
Binary file
|
@@ -1,33 +0,0 @@
|
|
1
|
-
[1m[36m (0.1ms)[0m [1mselect sqlite_version(*)[0m
|
2
|
-
[1m[35m (2.3ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
3
|
-
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
4
|
-
[1m[35m (1.0ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
5
|
-
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
6
|
-
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
7
|
-
Migrating to CreateModelWithDefaultLengthFields (20111026123348)
|
8
|
-
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
9
|
-
[1m[36m (0.4ms)[0m [1mCREATE TABLE "model_with_default_length_fields" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "length" integer, "created_at" datetime, "updated_at" datetime) [0m
|
10
|
-
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20111026123348')
|
11
|
-
Migrating to CreateModelWithNonDefaultLengthFields (20111026123424)
|
12
|
-
[1m[36m (0.3ms)[0m [1mCREATE TABLE "model_with_non_default_length_fields" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" integer, "created_at" datetime, "updated_at" datetime) [0m
|
13
|
-
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20111026123424')
|
14
|
-
Migrating to CreateModelWithLengthFieldAndSetters (20111026144756)
|
15
|
-
[1m[36m (0.3ms)[0m [1mCREATE TABLE "model_with_length_field_and_setters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "length" integer, "created_at" datetime, "updated_at" datetime) [0m
|
16
|
-
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20111026144756')
|
17
|
-
[1m[36m (0.2ms)[0m [1mselect sqlite_version(*)[0m
|
18
|
-
[1m[35m (0.1ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
19
|
-
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("model_with_default_length_fields")[0m
|
20
|
-
[1m[35m (0.0ms)[0m PRAGMA index_list("model_with_length_field_and_setters")
|
21
|
-
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("model_with_non_default_length_fields")[0m
|
22
|
-
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
23
|
-
[1m[35m (0.2ms)[0m select sqlite_version(*)
|
24
|
-
[1m[36m (1.3ms)[0m [1mCREATE TABLE "model_with_default_length_fields" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "length" integer, "created_at" datetime, "updated_at" datetime) [0m
|
25
|
-
[1m[35m (1.1ms)[0m CREATE TABLE "model_with_length_field_and_setters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "length" integer, "created_at" datetime, "updated_at" datetime)
|
26
|
-
[1m[36m (1.2ms)[0m [1mCREATE TABLE "model_with_non_default_length_fields" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" integer, "created_at" datetime, "updated_at" datetime) [0m
|
27
|
-
[1m[35m (1.1ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
28
|
-
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
29
|
-
[1m[35m (1.0ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
30
|
-
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
31
|
-
[1m[35m (1.0ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20111026144756')
|
32
|
-
[1m[36m (0.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20111026123348')[0m
|
33
|
-
[1m[35m (1.0ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20111026123424')
|
data/test/dummy/log/test.log
DELETED
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,26 +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
|
-
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</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/test_helper.rb
DELETED
@@ -1,10 +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 }
|