activerecord-sortable 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +7 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +33 -0
  4. data/lib/activerecord/sortable.rb +8 -0
  5. data/lib/activerecord/sortable/acts_as_sortable.rb +40 -0
  6. data/lib/activerecord/sortable/acts_as_sortable/instance_methods.rb +66 -0
  7. data/lib/activerecord/sortable/rails.rb +8 -0
  8. data/lib/activerecord/sortable/version.rb +5 -0
  9. data/lib/assets/javascripts/sortable.js +99 -0
  10. data/lib/tasks/sortable_tasks.rake +4 -0
  11. data/spec/dummy/README.rdoc +28 -0
  12. data/spec/dummy/Rakefile +6 -0
  13. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  14. data/spec/dummy/app/assets/javascripts/jquery.simulate.js +312 -0
  15. data/spec/dummy/app/assets/stylesheets/application.css +14 -0
  16. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  17. data/spec/dummy/app/controllers/things_controller.rb +10 -0
  18. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  19. data/spec/dummy/app/models/item.rb +3 -0
  20. data/spec/dummy/app/models/other_thing.rb +5 -0
  21. data/spec/dummy/app/models/thing.rb +3 -0
  22. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  23. data/spec/dummy/app/views/things/_thing.html.erb +3 -0
  24. data/spec/dummy/app/views/things/index.html.erb +7 -0
  25. data/spec/dummy/app/views/things/move.js.erb +4 -0
  26. data/spec/dummy/bin/bundle +3 -0
  27. data/spec/dummy/bin/rails +4 -0
  28. data/spec/dummy/bin/rake +4 -0
  29. data/spec/dummy/config.ru +4 -0
  30. data/spec/dummy/config/application.rb +24 -0
  31. data/spec/dummy/config/boot.rb +5 -0
  32. data/spec/dummy/config/database.yml +25 -0
  33. data/spec/dummy/config/environment.rb +5 -0
  34. data/spec/dummy/config/environments/development.rb +29 -0
  35. data/spec/dummy/config/environments/production.rb +80 -0
  36. data/spec/dummy/config/environments/test.rb +36 -0
  37. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  38. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  39. data/spec/dummy/config/initializers/inflections.rb +16 -0
  40. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  41. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  42. data/spec/dummy/config/initializers/session_store.rb +3 -0
  43. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  44. data/spec/dummy/config/locales/en.yml +23 -0
  45. data/spec/dummy/config/routes.rb +9 -0
  46. data/spec/dummy/db/development.sqlite3 +0 -0
  47. data/spec/dummy/db/migrate/20140512100816_create_things.rb +10 -0
  48. data/spec/dummy/db/migrate/20140525104834_create_other_things.rb +10 -0
  49. data/spec/dummy/db/migrate/20140525111906_create_items.rb +7 -0
  50. data/spec/dummy/db/migrate/20140525112123_add_position_to_items.rb +13 -0
  51. data/spec/dummy/db/schema.rb +40 -0
  52. data/spec/dummy/db/seeds.rb +3 -0
  53. data/spec/dummy/db/test.sqlite3 +0 -0
  54. data/spec/dummy/log/development.log +5000 -0
  55. data/spec/dummy/log/test.log +125455 -0
  56. data/spec/dummy/public/404.html +58 -0
  57. data/spec/dummy/public/422.html +58 -0
  58. data/spec/dummy/public/500.html +57 -0
  59. data/spec/dummy/public/favicon.ico +0 -0
  60. data/spec/dummy/tmp/cache/assets/development/sprockets/02e6da2de0eeda095c3ab81e1033fc1d +0 -0
  61. data/spec/dummy/tmp/cache/assets/development/sprockets/04cf541b9d1ee4cad14421becb051689 +0 -0
  62. data/spec/dummy/tmp/cache/assets/development/sprockets/06a48cadb2e97ab6c9c35285891cd326 +0 -0
  63. data/spec/dummy/tmp/cache/assets/development/sprockets/0bb2483991c2c5f7f83fde21edafb6a9 +0 -0
  64. data/spec/dummy/tmp/cache/assets/development/sprockets/0d3c3b294494fb664545d3c26ee18f14 +0 -0
  65. data/spec/dummy/tmp/cache/assets/development/sprockets/0de48e81714433e3a37eac8d8be3d97e +0 -0
  66. data/spec/dummy/tmp/cache/assets/development/sprockets/10ae91021bb1bbd0930672c779b3b91a +0 -0
  67. data/spec/dummy/tmp/cache/assets/development/sprockets/11820a6ecc13dd7f7094529f02abab32 +0 -0
  68. data/spec/dummy/tmp/cache/assets/development/sprockets/11854112d39135b018adc8440defeda0 +0 -0
  69. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  70. data/spec/dummy/tmp/cache/assets/development/sprockets/1510c8e329d6e9494521d212f6436149 +0 -0
  71. data/spec/dummy/tmp/cache/assets/development/sprockets/1f6d40a549a87bc8b9dc59afe0b41143 +0 -0
  72. data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  73. data/spec/dummy/tmp/cache/assets/development/sprockets/30e32f924769f4b2ef4ec2ed78d62f3d +0 -0
  74. data/spec/dummy/tmp/cache/assets/development/sprockets/3102e67dc53e4d0f35c4581e16261889 +0 -0
  75. data/spec/dummy/tmp/cache/assets/development/sprockets/327b885c1a9d58094da4fda60431a466 +0 -0
  76. data/spec/dummy/tmp/cache/assets/development/sprockets/327f7f624a6fc56d3d434e46aceb3299 +0 -0
  77. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  78. data/spec/dummy/tmp/cache/assets/development/sprockets/3754f0eb2c14b3faa11aec78b2dcee56 +0 -0
  79. data/spec/dummy/tmp/cache/assets/development/sprockets/3a8816f3d1d27361f67808fed1cfaf48 +0 -0
  80. data/spec/dummy/tmp/cache/assets/development/sprockets/3c6d7669755b971545e296fc93a9595b +0 -0
  81. data/spec/dummy/tmp/cache/assets/development/sprockets/3e904cfb843c2a95c02c07b4fbc96e6e +0 -0
  82. data/spec/dummy/tmp/cache/assets/development/sprockets/402789e80a4ebf130058eeae9bacd1e3 +0 -0
  83. data/spec/dummy/tmp/cache/assets/development/sprockets/405ef6e6ee991e0b2d850f3443245dc8 +0 -0
  84. data/spec/dummy/tmp/cache/assets/development/sprockets/4249e053e25b3a5632832c437bfd0e4d +0 -0
  85. data/spec/dummy/tmp/cache/assets/development/sprockets/42b8d23a55d28e131ae662ed762cbf08 +0 -0
  86. data/spec/dummy/tmp/cache/assets/development/sprockets/4646b96b524c218d2b80992e633080ff +0 -0
  87. data/spec/dummy/tmp/cache/assets/development/sprockets/47e71eb31da5be13ced7c7a889342d58 +0 -0
  88. data/spec/dummy/tmp/cache/assets/development/sprockets/485c8ac4edde07df3f326e4f4b9f9106 +0 -0
  89. data/spec/dummy/tmp/cache/assets/development/sprockets/49bf73b3490c4a8e62534bd0d5be81c3 +0 -0
  90. data/spec/dummy/tmp/cache/assets/development/sprockets/4c1e2286914bc9b9ad1073e0aaa47a40 +0 -0
  91. data/spec/dummy/tmp/cache/assets/development/sprockets/4c803caf54aa7538b898209acc1b1070 +0 -0
  92. data/spec/dummy/tmp/cache/assets/development/sprockets/562dbca143b36a28d7fc6820500de6cc +0 -0
  93. data/spec/dummy/tmp/cache/assets/development/sprockets/57c480a56fb25b20eb672e4027117550 +0 -0
  94. data/spec/dummy/tmp/cache/assets/development/sprockets/58b84f82ca3fe739a2c21accf3b43e08 +0 -0
  95. data/spec/dummy/tmp/cache/assets/development/sprockets/5b848793a8918c09f06e30db36aeb816 +0 -0
  96. data/spec/dummy/tmp/cache/assets/development/sprockets/5dc29296d9d4d74645d70a5225f6027f +0 -0
  97. data/spec/dummy/tmp/cache/assets/development/sprockets/61832b49e09217de656ff5bd787626c9 +0 -0
  98. data/spec/dummy/tmp/cache/assets/development/sprockets/6386af6a5c718c1ddd97f609e0f7e9bd +0 -0
  99. data/spec/dummy/tmp/cache/assets/development/sprockets/63c434ac472c04632133d9bc2f8ebe44 +0 -0
  100. data/spec/dummy/tmp/cache/assets/development/sprockets/64ef40135516dbbf1737a2d598b22cfa +0 -0
  101. data/spec/dummy/tmp/cache/assets/development/sprockets/67ad3a3d9a5fa9dd07456e131ce9c2a8 +0 -0
  102. data/spec/dummy/tmp/cache/assets/development/sprockets/6c2e45e1a31edecd0e3584aa2d836c58 +0 -0
  103. data/spec/dummy/tmp/cache/assets/development/sprockets/743ab64e3ac90ba4734a5a1af916fd93 +0 -0
  104. data/spec/dummy/tmp/cache/assets/development/sprockets/77088c2f43bec60ff0e030676e96f686 +0 -0
  105. data/spec/dummy/tmp/cache/assets/development/sprockets/777746e36b5f546628033e633d960005 +0 -0
  106. data/spec/dummy/tmp/cache/assets/development/sprockets/7ed5d11be8a68c295f8833e4961891ff +0 -0
  107. data/spec/dummy/tmp/cache/assets/development/sprockets/80d43205b7942ece8d8b09f859813908 +0 -0
  108. data/spec/dummy/tmp/cache/assets/development/sprockets/867c6ad0b26a9665bc431c93887cea11 +0 -0
  109. data/spec/dummy/tmp/cache/assets/development/sprockets/87f7d23ea55311ee3affe8e6ad8f1b57 +0 -0
  110. data/spec/dummy/tmp/cache/assets/development/sprockets/8a23854402292f417575b8ecaa5ced06 +0 -0
  111. data/spec/dummy/tmp/cache/assets/development/sprockets/8b39a75a80c1fb3a07395e674644e2cc +0 -0
  112. data/spec/dummy/tmp/cache/assets/development/sprockets/8fd0bc56f8581ee9a4376dced1efc158 +0 -0
  113. data/spec/dummy/tmp/cache/assets/development/sprockets/a12ecc7f4b8b7b1315023a6f62aa4ab5 +0 -0
  114. data/spec/dummy/tmp/cache/assets/development/sprockets/a2038db6aaa5289fba7fde9aea561a08 +0 -0
  115. data/spec/dummy/tmp/cache/assets/development/sprockets/ad0693eaa72c0eee52a255fb9d030503 +0 -0
  116. data/spec/dummy/tmp/cache/assets/development/sprockets/b0a786e48e0e908ab34cfbb918853146 +0 -0
  117. data/spec/dummy/tmp/cache/assets/development/sprockets/b84a4d17f27ef190e1eed6129eaac20b +0 -0
  118. data/spec/dummy/tmp/cache/assets/development/sprockets/b9296322253567156d260263305d22d2 +0 -0
  119. data/spec/dummy/tmp/cache/assets/development/sprockets/b970eb3cff83ab8da0076e1472860d75 +0 -0
  120. data/spec/dummy/tmp/cache/assets/development/sprockets/bbceab6aa0252d0552d3a37d2d11e98d +0 -0
  121. data/spec/dummy/tmp/cache/assets/development/sprockets/bfca8c57a5fdc4f3f2e41cea232ed987 +0 -0
  122. data/spec/dummy/tmp/cache/assets/development/sprockets/bfce4ec4b73dd7cbfa1a9dcc601c5050 +0 -0
  123. data/spec/dummy/tmp/cache/assets/development/sprockets/bfd7da030142aceda83eb82f60b33487 +0 -0
  124. data/spec/dummy/tmp/cache/assets/development/sprockets/c7e351cd01a8592503c63b37d7d69e4f +0 -0
  125. data/spec/dummy/tmp/cache/assets/development/sprockets/caf21088467d229770a205c793606696 +0 -0
  126. data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  127. data/spec/dummy/tmp/cache/assets/development/sprockets/d1256d5e44bddbb67bfb24dbab1c3795 +0 -0
  128. data/spec/dummy/tmp/cache/assets/development/sprockets/d2c66e0a8aa45b5f5b17c98c3d39bf91 +0 -0
  129. data/spec/dummy/tmp/cache/assets/development/sprockets/d3fe7bc39b02f61c0f994820aec91f78 +0 -0
  130. data/spec/dummy/tmp/cache/assets/development/sprockets/d4b2ad85aa1a4f1ea28a39b5518f992b +0 -0
  131. data/spec/dummy/tmp/cache/assets/development/sprockets/d5449ece5f819190ad6dd88c1caccffc +0 -0
  132. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  133. data/spec/dummy/tmp/cache/assets/development/sprockets/d8b62b055a9e2933d39777275cd166f0 +0 -0
  134. data/spec/dummy/tmp/cache/assets/development/sprockets/dbbb41e059e78bdfbb7ec9285ce21b97 +0 -0
  135. data/spec/dummy/tmp/cache/assets/development/sprockets/e0f01bdea42cc99228735a8a21d95ef2 +0 -0
  136. data/spec/dummy/tmp/cache/assets/development/sprockets/ebd00f71b7dcba8d80316e0b8d5e76e3 +0 -0
  137. data/spec/dummy/tmp/cache/assets/development/sprockets/ebe17685dedaf8f574dde1463bdea118 +0 -0
  138. data/spec/dummy/tmp/cache/assets/development/sprockets/f188fdc5d08872237a3dd0231bbfe4e1 +0 -0
  139. data/spec/dummy/tmp/cache/assets/development/sprockets/f4cbaca85a4be542050fd39cbf5eb6c3 +0 -0
  140. data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  141. data/spec/dummy/tmp/cache/assets/development/sprockets/fba7f1b57d7cc3253cb40677cbbd8f54 +0 -0
  142. data/spec/dummy/tmp/cache/assets/development/sprockets/fd13af7854ecfb6bedf12ce71539b636 +0 -0
  143. data/spec/dummy/tmp/cache/assets/test/sprockets/02e6da2de0eeda095c3ab81e1033fc1d +0 -0
  144. data/spec/dummy/tmp/cache/assets/test/sprockets/0bb2483991c2c5f7f83fde21edafb6a9 +0 -0
  145. data/spec/dummy/tmp/cache/assets/test/sprockets/11820a6ecc13dd7f7094529f02abab32 +0 -0
  146. data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  147. data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  148. data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  149. data/spec/dummy/tmp/cache/assets/test/sprockets/405ef6e6ee991e0b2d850f3443245dc8 +0 -0
  150. data/spec/dummy/tmp/cache/assets/test/sprockets/485c8ac4edde07df3f326e4f4b9f9106 +0 -0
  151. data/spec/dummy/tmp/cache/assets/test/sprockets/63c434ac472c04632133d9bc2f8ebe44 +0 -0
  152. data/spec/dummy/tmp/cache/assets/test/sprockets/67ad3a3d9a5fa9dd07456e131ce9c2a8 +0 -0
  153. data/spec/dummy/tmp/cache/assets/test/sprockets/77088c2f43bec60ff0e030676e96f686 +0 -0
  154. data/spec/dummy/tmp/cache/assets/test/sprockets/80d43205b7942ece8d8b09f859813908 +0 -0
  155. data/spec/dummy/tmp/cache/assets/test/sprockets/a2038db6aaa5289fba7fde9aea561a08 +0 -0
  156. data/spec/dummy/tmp/cache/assets/test/sprockets/bbceab6aa0252d0552d3a37d2d11e98d +0 -0
  157. data/spec/dummy/tmp/cache/assets/test/sprockets/c7e351cd01a8592503c63b37d7d69e4f +0 -0
  158. data/spec/dummy/tmp/cache/assets/test/sprockets/caf21088467d229770a205c793606696 +0 -0
  159. data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  160. data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  161. data/spec/dummy/tmp/cache/assets/test/sprockets/d8b62b055a9e2933d39777275cd166f0 +0 -0
  162. data/spec/dummy/tmp/cache/assets/test/sprockets/ebe17685dedaf8f574dde1463bdea118 +0 -0
  163. data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  164. data/spec/dummy/tmp/cache/assets/test/sprockets/fba7f1b57d7cc3253cb40677cbbd8f54 +0 -0
  165. data/spec/dummy/tmp/cache/assets/test/sprockets/fd13af7854ecfb6bedf12ce71539b636 +0 -0
  166. data/spec/features/drag_and_drop_spec.rb +65 -0
  167. data/spec/other_thing_spec.rb +5 -0
  168. data/spec/spec_helper.rb +24 -0
  169. data/spec/support/activerecord_sortable.rb +181 -0
  170. data/spec/thing_spec.rb +5 -0
  171. metadata +458 -0
@@ -0,0 +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>
@@ -0,0 +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>
@@ -0,0 +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>
File without changes
@@ -0,0 +1,65 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'drag and drop', :type => :feature, :js => true do
4
+ before(:each) { Thing.delete_all }
5
+
6
+ let!(:thing1) { Thing.create }
7
+ let!(:thing2) { Thing.create }
8
+
9
+ describe 'drag up' do
10
+ let(:thing1_selector) { "li[data-role=thing#{thing1.id}]" }
11
+ let(:thing2_selector) { "li[data-role=thing#{thing2.id}]" }
12
+
13
+ subject do
14
+ draggable = find(thing1_selector)
15
+ droppable = find(thing2_selector)
16
+
17
+ draggable.drag_to(droppable)
18
+ end
19
+
20
+ it 'change first thing position to 0' do
21
+ visit '/'
22
+ subject
23
+ expect(page).to have_selector(:xpath, "//li[@data-role='thing#{thing1.id}' and @data-position='0']")
24
+ end
25
+
26
+ it 'change second thing position to 1' do
27
+ visit '/'
28
+ subject
29
+ expect(page).to have_selector(:xpath, "//li[@data-role='thing#{thing2.id}' and @data-position='1']")
30
+ end
31
+ end
32
+
33
+ describe 'drag down' do
34
+ let!(:thing1) { Thing.create }
35
+ let!(:thing2) { Thing.create }
36
+
37
+ let(:thing1_selector) { "li[data-role=thing#{thing1.id}]" }
38
+ let(:thing2_selector) { "li[data-role=thing#{thing2.id}]" }
39
+
40
+ subject do
41
+ page.execute_script %Q{
42
+ $.getScript("/assets/jquery.simulate.js", function(){
43
+ var draggable = $('#{thing2_selector}');
44
+ var droppable = $('#{thing1_selector}');
45
+ var dy = droppable.offset().top - draggable.offset().top + 1;
46
+
47
+ draggable.simulate('drag', {dx:0, dy: dy});
48
+ });
49
+ }
50
+ end
51
+
52
+ it 'change first thing position to 0' do
53
+ visit '/'
54
+ subject
55
+ expect(page).to have_selector(:xpath, "//li[@data-role='thing#{thing1.id}' and @data-position='0']")
56
+
57
+ end
58
+
59
+ it 'change second thing position to 1' do
60
+ visit '/'
61
+ subject
62
+ expect(page).to have_selector(:xpath, "//li[@data-role='thing#{thing2.id}' and @data-position='1']")
63
+ end
64
+ end
65
+ end