manage 1.3.29 → 1.3.30

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.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -20
  3. data/Rakefile +31 -31
  4. data/app/assets/javascripts/manage/collection_actions.js.coffee +30 -30
  5. data/app/assets/javascripts/manage/handlers.js.coffee +46 -46
  6. data/app/assets/javascripts/manage/table_checkboxes.js.coffee +11 -11
  7. data/app/controllers/manage/application_controller.rb +13 -13
  8. data/app/controllers/manage/dashboards_controller.rb +4 -4
  9. data/app/controllers/manage/resource_controller.rb +6 -0
  10. data/app/controllers/manage/responder.rb +11 -11
  11. data/app/controllers/manage/sessions_controller.rb +11 -11
  12. data/app/helpers/manage/application_helper.rb +42 -42
  13. data/app/helpers/manage/form_helper.rb +21 -21
  14. data/app/helpers/manage/resource_helper.rb +77 -77
  15. data/app/models/admin_user.rb +4 -4
  16. data/app/views/layouts/manage/_main_menu.html.slim +52 -52
  17. data/app/views/layouts/manage/application.html.slim +39 -39
  18. data/app/views/layouts/manage/sign_in.html.slim +30 -30
  19. data/app/views/manage/resource/_form.html.slim +4 -4
  20. data/app/views/manage/resource/index/_collection_actions.html.slim +2 -2
  21. data/app/views/manage/resource/index/_count.html.slim +6 -6
  22. data/app/views/manage/resource/show.html.slim +10 -10
  23. data/app/views/manage/sessions/new.html.slim +10 -10
  24. data/config/initializers/devise.rb +247 -247
  25. data/config/initializers/session_store.rb +3 -3
  26. data/config/initializers/simple_form.rb +145 -145
  27. data/config/initializers/simple_form_foundation.rb +26 -26
  28. data/config/locales/devise.en.yml +59 -59
  29. data/config/locales/en.yml +20 -20
  30. data/config/routes.rb +10 -10
  31. data/db/migrate/20131204142720_create_admin_users.rb +24 -24
  32. data/lib/manage/engine.rb +21 -21
  33. data/lib/manage/fields/reader.rb +57 -57
  34. data/lib/manage/fields.rb +6 -6
  35. data/lib/manage/version.rb +1 -1
  36. data/lib/manage.rb +5 -5
  37. data/lib/tasks/manage_tasks.rake +15 -15
  38. data/lib/templates/erb/scaffold/_form.html.erb +13 -13
  39. data/spec/controllers/manage/resource_controller_spec.rb +29 -29
  40. data/spec/dummy/README.rdoc +28 -28
  41. data/spec/dummy/Rakefile +6 -6
  42. data/spec/dummy/app/assets/javascripts/application.js +13 -13
  43. data/spec/dummy/app/assets/stylesheets/application.css +13 -13
  44. data/spec/dummy/app/controllers/application_controller.rb +5 -5
  45. data/spec/dummy/app/controllers/manage/posts_controller.rb +4 -4
  46. data/spec/dummy/app/helpers/application_helper.rb +2 -2
  47. data/spec/dummy/app/models/post.rb +3 -3
  48. data/spec/dummy/app/models/user.rb +5 -5
  49. data/spec/dummy/app/views/layouts/application.html.erb +14 -14
  50. data/spec/dummy/bin/bundle +3 -3
  51. data/spec/dummy/bin/rails +4 -4
  52. data/spec/dummy/bin/rake +4 -4
  53. data/spec/dummy/config/application.rb +24 -24
  54. data/spec/dummy/config/boot.rb +5 -5
  55. data/spec/dummy/config/database.yml +25 -25
  56. data/spec/dummy/config/environment.rb +5 -5
  57. data/spec/dummy/config/environments/development.rb +29 -29
  58. data/spec/dummy/config/environments/production.rb +80 -80
  59. data/spec/dummy/config/environments/test.rb +36 -36
  60. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -7
  61. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -4
  62. data/spec/dummy/config/initializers/inflections.rb +16 -16
  63. data/spec/dummy/config/initializers/mime_types.rb +5 -5
  64. data/spec/dummy/config/initializers/secret_token.rb +12 -12
  65. data/spec/dummy/config/initializers/session_store.rb +3 -3
  66. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -14
  67. data/spec/dummy/config/locales/en.yml +23 -23
  68. data/spec/dummy/config/routes.rb +10 -10
  69. data/spec/dummy/config.ru +4 -4
  70. data/spec/dummy/db/migrate/20130716083410_init_migration.rb +21 -21
  71. data/spec/dummy/db/schema.rb +53 -53
  72. data/spec/dummy/public/404.html +58 -58
  73. data/spec/dummy/public/422.html +58 -58
  74. data/spec/dummy/public/500.html +57 -57
  75. data/spec/fields/reader_spec.rb +79 -79
  76. data/spec/spec_helper.rb +24 -24
  77. metadata +88 -90
  78. data/spec/dummy/log/test.log +0 -0
@@ -1,53 +1,53 @@
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 that you check this file into your version control system.
13
-
14
- ActiveRecord::Schema.define(version: 20131204142720) do
15
-
16
- create_table "admin_users", force: true do |t|
17
- t.string "email", default: "", null: false
18
- t.string "encrypted_password", default: "", null: false
19
- t.string "reset_password_token"
20
- t.datetime "reset_password_sent_at"
21
- t.datetime "remember_created_at"
22
- t.integer "sign_in_count", default: 0
23
- t.datetime "current_sign_in_at"
24
- t.datetime "last_sign_in_at"
25
- t.string "current_sign_in_ip"
26
- t.string "last_sign_in_ip"
27
- t.integer "failed_attempts", default: 0
28
- t.string "unlock_token"
29
- t.datetime "locked_at"
30
- t.datetime "created_at"
31
- t.datetime "updated_at"
32
- end
33
-
34
- add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true
35
- add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true
36
-
37
- create_table "posts", force: true do |t|
38
- t.text "content"
39
- t.datetime "created_at"
40
- t.datetime "updated_at"
41
- t.integer "user_id"
42
- end
43
-
44
- add_index "posts", ["user_id"], name: "index_posts_on_user_id"
45
-
46
- create_table "users", force: true do |t|
47
- t.string "username"
48
- t.string "email", null: false
49
- t.datetime "created_at"
50
- t.datetime "updated_at"
51
- end
52
-
53
- end
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 that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20131204142720) do
15
+
16
+ create_table "admin_users", force: true do |t|
17
+ t.string "email", default: "", null: false
18
+ t.string "encrypted_password", default: "", null: false
19
+ t.string "reset_password_token"
20
+ t.datetime "reset_password_sent_at"
21
+ t.datetime "remember_created_at"
22
+ t.integer "sign_in_count", default: 0
23
+ t.datetime "current_sign_in_at"
24
+ t.datetime "last_sign_in_at"
25
+ t.string "current_sign_in_ip"
26
+ t.string "last_sign_in_ip"
27
+ t.integer "failed_attempts", default: 0
28
+ t.string "unlock_token"
29
+ t.datetime "locked_at"
30
+ t.datetime "created_at"
31
+ t.datetime "updated_at"
32
+ end
33
+
34
+ add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true
35
+ add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true
36
+
37
+ create_table "posts", force: true do |t|
38
+ t.text "content"
39
+ t.datetime "created_at"
40
+ t.datetime "updated_at"
41
+ t.integer "user_id"
42
+ end
43
+
44
+ add_index "posts", ["user_id"], name: "index_posts_on_user_id"
45
+
46
+ create_table "users", force: true do |t|
47
+ t.string "username"
48
+ t.string "email", null: false
49
+ t.datetime "created_at"
50
+ t.datetime "updated_at"
51
+ end
52
+
53
+ end
@@ -1,58 +1,58 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <style>
6
- body {
7
- background-color: #EFEFEF;
8
- color: #2E2F30;
9
- text-align: center;
10
- font-family: arial, sans-serif;
11
- }
12
-
13
- div.dialog {
14
- width: 25em;
15
- margin: 4em auto 0 auto;
16
- border: 1px solid #CCC;
17
- border-right-color: #999;
18
- border-left-color: #999;
19
- border-bottom-color: #BBB;
20
- border-top: #B00100 solid 4px;
21
- border-top-left-radius: 9px;
22
- border-top-right-radius: 9px;
23
- background-color: white;
24
- padding: 7px 4em 0 4em;
25
- }
26
-
27
- h1 {
28
- font-size: 100%;
29
- color: #730E15;
30
- line-height: 1.5em;
31
- }
32
-
33
- body > p {
34
- width: 33em;
35
- margin: 0 auto 1em;
36
- padding: 1em 0;
37
- background-color: #F7F7F7;
38
- border: 1px solid #CCC;
39
- border-right-color: #999;
40
- border-bottom-color: #999;
41
- border-bottom-left-radius: 4px;
42
- border-bottom-right-radius: 4px;
43
- border-top-color: #DADADA;
44
- color: #666;
45
- box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
- }
47
- </style>
48
- </head>
49
-
50
- <body>
51
- <!-- This file lives in public/404.html -->
52
- <div class="dialog">
53
- <h1>The page you were looking for doesn't exist.</h1>
54
- <p>You may have mistyped the address or the page may have moved.</p>
55
- </div>
56
- <p>If you are the application owner check the logs for more information.</p>
57
- </body>
58
- </html>
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/404.html -->
52
+ <div class="dialog">
53
+ <h1>The page you were looking for doesn't exist.</h1>
54
+ <p>You may have mistyped the address or the page may have moved.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -1,58 +1,58 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <style>
6
- body {
7
- background-color: #EFEFEF;
8
- color: #2E2F30;
9
- text-align: center;
10
- font-family: arial, sans-serif;
11
- }
12
-
13
- div.dialog {
14
- width: 25em;
15
- margin: 4em auto 0 auto;
16
- border: 1px solid #CCC;
17
- border-right-color: #999;
18
- border-left-color: #999;
19
- border-bottom-color: #BBB;
20
- border-top: #B00100 solid 4px;
21
- border-top-left-radius: 9px;
22
- border-top-right-radius: 9px;
23
- background-color: white;
24
- padding: 7px 4em 0 4em;
25
- }
26
-
27
- h1 {
28
- font-size: 100%;
29
- color: #730E15;
30
- line-height: 1.5em;
31
- }
32
-
33
- body > p {
34
- width: 33em;
35
- margin: 0 auto 1em;
36
- padding: 1em 0;
37
- background-color: #F7F7F7;
38
- border: 1px solid #CCC;
39
- border-right-color: #999;
40
- border-bottom-color: #999;
41
- border-bottom-left-radius: 4px;
42
- border-bottom-right-radius: 4px;
43
- border-top-color: #DADADA;
44
- color: #666;
45
- box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
- }
47
- </style>
48
- </head>
49
-
50
- <body>
51
- <!-- This file lives in public/422.html -->
52
- <div class="dialog">
53
- <h1>The change you wanted was rejected.</h1>
54
- <p>Maybe you tried to change something you didn't have access to.</p>
55
- </div>
56
- <p>If you are the application owner check the logs for more information.</p>
57
- </body>
58
- </html>
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -1,57 +1,57 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <style>
6
- body {
7
- background-color: #EFEFEF;
8
- color: #2E2F30;
9
- text-align: center;
10
- font-family: arial, sans-serif;
11
- }
12
-
13
- div.dialog {
14
- width: 25em;
15
- margin: 4em auto 0 auto;
16
- border: 1px solid #CCC;
17
- border-right-color: #999;
18
- border-left-color: #999;
19
- border-bottom-color: #BBB;
20
- border-top: #B00100 solid 4px;
21
- border-top-left-radius: 9px;
22
- border-top-right-radius: 9px;
23
- background-color: white;
24
- padding: 7px 4em 0 4em;
25
- }
26
-
27
- h1 {
28
- font-size: 100%;
29
- color: #730E15;
30
- line-height: 1.5em;
31
- }
32
-
33
- body > p {
34
- width: 33em;
35
- margin: 0 auto 1em;
36
- padding: 1em 0;
37
- background-color: #F7F7F7;
38
- border: 1px solid #CCC;
39
- border-right-color: #999;
40
- border-bottom-color: #999;
41
- border-bottom-left-radius: 4px;
42
- border-bottom-right-radius: 4px;
43
- border-top-color: #DADADA;
44
- color: #666;
45
- box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
- }
47
- </style>
48
- </head>
49
-
50
- <body>
51
- <!-- This file lives in public/500.html -->
52
- <div class="dialog">
53
- <h1>We're sorry, but something went wrong.</h1>
54
- </div>
55
- <p>If you are the application owner check the logs for more information.</p>
56
- </body>
57
- </html>
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
@@ -1,79 +1,79 @@
1
- require 'spec_helper'
2
-
3
- module Manage
4
- module Fields
5
- describe Reader do
6
-
7
- it 'gets the right field value by using the field name represented as symbol' do
8
- test_object = Object.new
9
-
10
- mock_value = 'I am here!!!'
11
- test_object.stub(:me) {mock_value}
12
-
13
- value = Reader.field_value(test_object, :me)
14
- value.should eq(mock_value)
15
- end
16
-
17
- it 'gets the right field value by using the field name represented as string' do
18
- test_object = Object.new
19
-
20
- mock_value = 'I am you and you are me'
21
- test_object.stub(:me) {mock_value}
22
-
23
- value = Reader.field_value(test_object, 'me')
24
- value.should eq(mock_value)
25
- end
26
-
27
- it 'gets the right field value by using the composite field of the type "a.b.c"' do
28
- test_object = Object.new
29
-
30
- mock_value = 'Deep hidden stuff!'
31
- test_object.stub(:me) do
32
- test_object_level_two = Object.new
33
- test_object_level_two.stub(:you) do
34
- test_object_level_three = Object.new
35
- test_object_level_three.stub(:we) {mock_value}
36
- test_object_level_three
37
- end
38
-
39
- test_object_level_two
40
- end
41
-
42
- value = Reader.field_value(test_object, 'me.you.we')
43
- value.should eq(mock_value)
44
- end
45
-
46
- it 'can work with relations one level deep' do
47
- Reader.stub(:'_is_field_relation?') {true}
48
-
49
- test_object = Object.new
50
- test_object.stub(:list) {[Struct.new(:id).new(5), Struct.new(:id).new(6)]}
51
-
52
- value = Reader.field_value(test_object, 'list')
53
- value.should_not be_nil
54
- value.should be_a(String)
55
- value.should include('5', '6')
56
- end
57
-
58
- it 'displays relation values in custom format' do
59
- Reader.stub(:'_is_field_relation?') {true}
60
-
61
- test_object = Object.new
62
- test_object.stub(:list) {[
63
- Struct.new(:id, :name).new(5, 'meddle'),
64
- Struct.new(:id, :name).new(6, 'nickolay')
65
- ]}
66
-
67
- field_data = {'list' => {
68
- format: ->(obj) { obj.name }
69
- }}
70
-
71
- value = Reader.field_value(test_object, field_data)
72
- value.should_not be_nil
73
- value.should be_a(String)
74
- value.should include('meddle', 'nickolay')
75
- end
76
-
77
- end
78
- end
79
- end
1
+ require 'spec_helper'
2
+
3
+ module Manage
4
+ module Fields
5
+ describe Reader do
6
+
7
+ it 'gets the right field value by using the field name represented as symbol' do
8
+ test_object = Object.new
9
+
10
+ mock_value = 'I am here!!!'
11
+ test_object.stub(:me) {mock_value}
12
+
13
+ value = Reader.field_value(test_object, :me)
14
+ value.should eq(mock_value)
15
+ end
16
+
17
+ it 'gets the right field value by using the field name represented as string' do
18
+ test_object = Object.new
19
+
20
+ mock_value = 'I am you and you are me'
21
+ test_object.stub(:me) {mock_value}
22
+
23
+ value = Reader.field_value(test_object, 'me')
24
+ value.should eq(mock_value)
25
+ end
26
+
27
+ it 'gets the right field value by using the composite field of the type "a.b.c"' do
28
+ test_object = Object.new
29
+
30
+ mock_value = 'Deep hidden stuff!'
31
+ test_object.stub(:me) do
32
+ test_object_level_two = Object.new
33
+ test_object_level_two.stub(:you) do
34
+ test_object_level_three = Object.new
35
+ test_object_level_three.stub(:we) {mock_value}
36
+ test_object_level_three
37
+ end
38
+
39
+ test_object_level_two
40
+ end
41
+
42
+ value = Reader.field_value(test_object, 'me.you.we')
43
+ value.should eq(mock_value)
44
+ end
45
+
46
+ it 'can work with relations one level deep' do
47
+ Reader.stub(:'_is_field_relation?') {true}
48
+
49
+ test_object = Object.new
50
+ test_object.stub(:list) {[Struct.new(:id).new(5), Struct.new(:id).new(6)]}
51
+
52
+ value = Reader.field_value(test_object, 'list')
53
+ value.should_not be_nil
54
+ value.should be_a(String)
55
+ value.should include('5', '6')
56
+ end
57
+
58
+ it 'displays relation values in custom format' do
59
+ Reader.stub(:'_is_field_relation?') {true}
60
+
61
+ test_object = Object.new
62
+ test_object.stub(:list) {[
63
+ Struct.new(:id, :name).new(5, 'meddle'),
64
+ Struct.new(:id, :name).new(6, 'nickolay')
65
+ ]}
66
+
67
+ field_data = {'list' => {
68
+ format: ->(obj) { obj.name }
69
+ }}
70
+
71
+ value = Reader.field_value(test_object, field_data)
72
+ value.should_not be_nil
73
+ value.should be_a(String)
74
+ value.should include('meddle', 'nickolay')
75
+ end
76
+
77
+ end
78
+ end
79
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,24 +1,24 @@
1
- ENV['RAILS_ENV'] ||= 'test'
2
-
3
- require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
- load_schema = lambda {
5
- load "#{Rails.root.to_s}/db/schema.rb" # use db agnostic schema by default
6
- }
7
- silence_stream(STDOUT, &load_schema)
8
-
9
-
10
- require 'rspec/rails'
11
- require 'rspec/autorun'
12
-
13
- Rails.backtrace_cleaner.remove_silencers!
14
-
15
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
16
-
17
- RSpec.configure do |config|
18
- config.mock_with :rspec
19
- config.use_transactional_fixtures = true
20
- config.infer_base_class_for_anonymous_controllers = false
21
- config.order = "random"
22
- config.include Devise::TestHelpers, :type => :controller
23
- config.include Manage::Engine.routes.url_helpers
24
- end
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+
3
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
+ load_schema = lambda {
5
+ load "#{Rails.root.to_s}/db/schema.rb" # use db agnostic schema by default
6
+ }
7
+ silence_stream(STDOUT, &load_schema)
8
+
9
+
10
+ require 'rspec/rails'
11
+ require 'rspec/autorun'
12
+
13
+ Rails.backtrace_cleaner.remove_silencers!
14
+
15
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
16
+
17
+ RSpec.configure do |config|
18
+ config.mock_with :rspec
19
+ config.use_transactional_fixtures = true
20
+ config.infer_base_class_for_anonymous_controllers = false
21
+ config.order = "random"
22
+ config.include Devise::TestHelpers, :type => :controller
23
+ config.include Manage::Engine.routes.url_helpers
24
+ end