hyper-kitten-tables 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +3 -0
  5. data/lib/hyper-kitten-tables.rb +6 -0
  6. data/lib/hyper_kitten_tables/components/table.rb +7 -0
  7. data/lib/hyper_kitten_tables/concerns/table.rb +134 -0
  8. data/lib/hyper_kitten_tables/engine.rb +5 -0
  9. data/lib/hyper_kitten_tables/version.rb +3 -0
  10. data/lib/tasks/tables_tasks.rake +4 -0
  11. data/spec/components/table_spec.rb +209 -0
  12. data/spec/dummy/Rakefile +6 -0
  13. data/spec/dummy/app/assets/config/manifest.js +3 -0
  14. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  15. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  16. data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
  17. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  18. data/spec/dummy/app/controllers/pages_controller.rb +3 -0
  19. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  20. data/spec/dummy/app/jobs/application_job.rb +7 -0
  21. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  22. data/spec/dummy/app/models/application_record.rb +3 -0
  23. data/spec/dummy/app/views/hyper_kitten_meow/pages/hardcoded_page.html.haml +4 -0
  24. data/spec/dummy/app/views/pages/app_hardcoded_page.html.haml +4 -0
  25. data/spec/dummy/app/views/pages/show.html.haml +3 -0
  26. data/spec/dummy/bin/rails +4 -0
  27. data/spec/dummy/bin/rake +4 -0
  28. data/spec/dummy/bin/setup +33 -0
  29. data/spec/dummy/config/application.rb +26 -0
  30. data/spec/dummy/config/boot.rb +5 -0
  31. data/spec/dummy/config/cable.yml +10 -0
  32. data/spec/dummy/config/database.yml +16 -0
  33. data/spec/dummy/config/environment.rb +5 -0
  34. data/spec/dummy/config/environments/development.rb +56 -0
  35. data/spec/dummy/config/environments/production.rb +93 -0
  36. data/spec/dummy/config/environments/test.rb +50 -0
  37. data/spec/dummy/config/initializers/assets.rb +12 -0
  38. data/spec/dummy/config/initializers/content_security_policy.rb +26 -0
  39. data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
  40. data/spec/dummy/config/initializers/inflections.rb +16 -0
  41. data/spec/dummy/config/initializers/permissions_policy.rb +11 -0
  42. data/spec/dummy/config/locales/en.yml +33 -0
  43. data/spec/dummy/config/puma.rb +43 -0
  44. data/spec/dummy/config/routes.rb +3 -0
  45. data/spec/dummy/config/storage.yml +34 -0
  46. data/spec/dummy/config.ru +6 -0
  47. data/spec/dummy/db/migrate/20220805173427_create_action_text_tables.action_text.rb +26 -0
  48. data/spec/dummy/db/migrate/20220805173748_create_active_storage_tables.active_storage.rb +57 -0
  49. data/spec/dummy/db/schema.rb +134 -0
  50. data/spec/dummy/db/seeds.rb +23 -0
  51. data/spec/dummy/log/development.log +12689 -0
  52. data/spec/dummy/log/test.log +58989 -0
  53. data/spec/dummy/public/404.html +67 -0
  54. data/spec/dummy/public/422.html +67 -0
  55. data/spec/dummy/public/500.html +66 -0
  56. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  57. data/spec/dummy/public/apple-touch-icon.png +0 -0
  58. data/spec/dummy/public/favicon.ico +0 -0
  59. data/spec/dummy/storage/it/lb/itlbn65dlnw20cu9ii6epg3qtr0h +0 -0
  60. data/spec/dummy/tmp/capybara/screenshot_2022-10-04-16-58-13.777.html +148 -0
  61. data/spec/dummy/tmp/capybara/screenshot_2022-10-04-16-59-53.965.html +148 -0
  62. data/spec/dummy/tmp/capybara/screenshot_2022-10-04-17-00-42.481.html +148 -0
  63. data/spec/dummy/tmp/capybara/screenshot_2022-10-04-17-01-02.940.html +229 -0
  64. data/spec/dummy/tmp/capybara/screenshot_2022-10-04-17-03-02.450.html +229 -0
  65. data/spec/dummy/tmp/capybara/screenshot_2022-10-04-17-03-17.782.html +148 -0
  66. data/spec/dummy/tmp/capybara/screenshot_2022-10-04-17-03-57.376.html +229 -0
  67. data/spec/dummy/tmp/capybara/screenshot_2022-10-04-17-07-53.996.html +232 -0
  68. data/spec/dummy/tmp/capybara/screenshot_2022-10-04-17-13-29.891.html +232 -0
  69. data/spec/dummy/tmp/capybara/screenshot_2022-10-04-17-13-56.197.html +232 -0
  70. data/spec/dummy/tmp/capybara/screenshot_2022-10-04-17-15-26.557.html +232 -0
  71. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-14-43-43.563.html +165 -0
  72. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-14-45-19.375.html +157 -0
  73. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-15-29-06.088.html +1 -0
  74. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-15-29-06.102.html +1 -0
  75. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-15-29-06.116.html +1 -0
  76. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-15-29-06.193.html +1 -0
  77. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-15-29-06.206.html +1 -0
  78. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-16-26-51.644.html +96 -0
  79. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-16-26-54.957.html +91 -0
  80. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-16-30-28.415.html +91 -0
  81. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-16-30-34.037.html +96 -0
  82. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-16-43-01.197.html +91 -0
  83. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-16-43-04.942.html +96 -0
  84. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-16-45-09.535.html +96 -0
  85. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-16-45-14.082.html +91 -0
  86. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-16-45-26.094.html +96 -0
  87. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-16-45-26.446.html +91 -0
  88. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-16-57-08.858.html +96 -0
  89. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-16-57-11.332.html +91 -0
  90. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-16-58-08.456.html +91 -0
  91. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-16-58-08.832.html +96 -0
  92. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-02-35.674.html +91 -0
  93. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-02-39.415.html +96 -0
  94. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-03-38.082.html +96 -0
  95. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-03-38.564.html +91 -0
  96. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-04-08.143.html +91 -0
  97. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-04-08.472.html +96 -0
  98. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-04-34.570.html +91 -0
  99. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-04-40.657.html +96 -0
  100. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-04-52.001.html +91 -0
  101. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-04-52.410.html +96 -0
  102. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-06-40.488.html +91 -0
  103. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-06-46.796.html +96 -0
  104. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-09-28.828.html +91 -0
  105. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-09-32.459.html +96 -0
  106. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-09-45.931.html +91 -0
  107. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-09-46.318.html +96 -0
  108. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-12-03.393.html +96 -0
  109. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-12-06.113.html +91 -0
  110. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-12-11.111.html +96 -0
  111. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-12-16.868.html +91 -0
  112. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-15-57.176.html +91 -0
  113. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-16-03.653.html +96 -0
  114. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-29-32.001.html +91 -0
  115. data/spec/dummy/tmp/capybara/screenshot_2022-10-05-17-29-34.702.html +96 -0
  116. data/spec/dummy/tmp/capybara/screenshot_2022-10-11-16-24-42.604.html +85 -0
  117. data/spec/dummy/tmp/capybara/screenshot_2022-10-11-16-25-08.753.html +76 -0
  118. data/spec/dummy/tmp/capybara/screenshot_2022-10-12-14-02-02.769.html +0 -0
  119. data/spec/dummy/tmp/capybara/screenshot_2022-10-12-14-08-16.549.html +0 -0
  120. data/spec/dummy/tmp/capybara/screenshot_2022-10-12-14-09-06.988.html +0 -0
  121. data/spec/dummy/tmp/capybara/screenshot_2022-10-12-14-10-02.456.html +0 -0
  122. data/spec/dummy/tmp/capybara/screenshot_2022-10-12-14-12-58.767.html +0 -0
  123. data/spec/dummy/tmp/capybara/screenshot_2022-10-12-14-13-38.946.html +0 -0
  124. data/spec/dummy/tmp/capybara/screenshot_2022-10-12-14-20-23.040.html +0 -0
  125. data/spec/dummy/tmp/capybara/screenshot_2022-10-12-14-22-40.972.html +31 -0
  126. data/spec/dummy/tmp/capybara/screenshot_2022-10-12-14-30-50.210.html +31 -0
  127. data/spec/dummy/tmp/capybara/screenshot_2022-10-12-14-31-41.216.html +31 -0
  128. data/spec/dummy/tmp/capybara/screenshot_2022-10-12-14-42-03.223.html +31 -0
  129. data/spec/dummy/tmp/capybara/screenshot_2022-10-12-14-53-14.392.html +0 -0
  130. data/spec/dummy/tmp/capybara/screenshot_2022-10-18-16-52-54.850.html +35 -0
  131. data/spec/dummy/tmp/capybara/screenshot_2022-10-18-16-53-03.992.html +0 -0
  132. data/spec/dummy/tmp/capybara/screenshot_2022-10-18-16-53-40.077.html +0 -0
  133. data/spec/dummy/tmp/capybara/screenshot_2022-10-18-16-53-55.068.html +0 -0
  134. data/spec/dummy/tmp/capybara/screenshot_2022-10-18-16-54-08.951.html +0 -0
  135. data/spec/dummy/tmp/capybara/screenshot_2022-10-18-16-54-39.523.html +0 -0
  136. data/spec/dummy/tmp/capybara/screenshot_2022-10-18-16-55-46.588.html +0 -0
  137. data/spec/dummy/tmp/capybara/screenshot_2022-10-18-16-56-53.302.html +0 -0
  138. data/spec/dummy/tmp/capybara/screenshot_2022-10-18-16-57-13.712.html +0 -0
  139. data/spec/dummy/tmp/capybara/screenshot_2022-10-18-16-59-55.972.html +0 -0
  140. data/spec/dummy/tmp/capybara/screenshot_2022-10-18-17-04-32.815.html +0 -0
  141. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-19-45-56.483.html +1 -0
  142. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-19-51-45.853.html +54 -0
  143. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-19-56-35.870.html +1 -0
  144. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-19-58-42.872.html +1 -0
  145. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-19-59-53.565.html +1 -0
  146. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-25-51.194.html +1 -0
  147. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-27-18.607.html +1 -0
  148. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-34-14.915.html +1 -0
  149. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-34-23.967.html +1 -0
  150. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-35-20.693.html +0 -0
  151. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-38-57.780.html +1 -0
  152. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-39-59.478.html +1 -0
  153. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-40-32.807.html +0 -0
  154. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-40-42.311.html +1 -0
  155. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-41-40.038.html +1 -0
  156. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-43-18.794.html +1 -0
  157. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-45-22.057.html +9 -0
  158. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-46-07.622.html +1 -0
  159. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-46-23.810.html +1 -0
  160. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-46-42.443.html +9 -0
  161. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-47-03.378.html +1 -0
  162. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-49-38.206.html +1 -0
  163. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-49-53.697.html +1 -0
  164. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-50-25.359.html +1 -0
  165. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-50-43.146.html +9 -0
  166. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-51-18.812.html +54 -0
  167. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-51-55.591.html +78 -0
  168. data/spec/dummy/tmp/capybara/screenshot_2022-11-16-20-52-42.586.html +78 -0
  169. data/spec/dummy/tmp/development_secret.txt +1 -0
  170. data/spec/dummy/tmp/restart.txt +0 -0
  171. data/spec/features/admin/create_first_user_spec.rb +34 -0
  172. data/spec/features/admin/menu_management_spec.rb +137 -0
  173. data/spec/features/admin/page_management_spec.rb +73 -0
  174. data/spec/features/admin/post_management_spec.rb +80 -0
  175. data/spec/features/admin/users_management_spec.rb +65 -0
  176. data/spec/features/display_pages_spec.rb +45 -0
  177. data/spec/features/display_posts_spec.rb +0 -0
  178. data/spec/rails_helper.rb +13 -0
  179. metadata +502 -0
@@ -0,0 +1,80 @@
1
+ require "rails_helper"
2
+
3
+ RSpec.feature "Post management", :type => :feature do
4
+ scenario "user can view posts" do
5
+ user = create_user_and_login
6
+ post = create(:post, title: "My Title")
7
+
8
+ visit hyper_kitten_meow.admin_posts_path
9
+
10
+ expect(page).to have_text("My Title")
11
+ end
12
+
13
+ it "paginates posts" do
14
+ create_user_and_login
15
+ paginates(factory: :post, increment: 10, selector: ".post") do
16
+ visit hyper_kitten_meow.admin_posts_path
17
+ end
18
+ end
19
+
20
+ scenario "user can edit posts " do
21
+ user = create_user_and_login(name: 'Andrew')
22
+ user = create(:user, name: 'Josh')
23
+ post = create(:post, title: "My Title")
24
+ tag = create(:tag, label: 'coffee')
25
+
26
+ visit hyper_kitten_meow.edit_admin_post_path(post)
27
+
28
+ expect(page).to have_text("My Title")
29
+
30
+ fill_in "Title", with: "Hello World!"
31
+ fill_in "Summary", with: "My great summary!"
32
+ fill_in "Slug", with: "my slug"
33
+ check "coffee"
34
+ select "Josh", from: "post[user_id]"
35
+ check "Published"
36
+ click_on "Update Post"
37
+
38
+ expect(page).to have_text("Hello World!")
39
+ expect(page).to have_text("My great summary!")
40
+ expect(page).to have_text("my-slug")
41
+ expect(page).to have_text("Josh")
42
+ expect(page).to have_text("Josh")
43
+ expect(page).to have_text("coffee")
44
+ expect(page).to have_css(".published")
45
+ end
46
+
47
+ scenario "user can create posts", js: true do
48
+ user = create_user_and_login(name: 'Andrew')
49
+ user = create(:user, name: 'Josh')
50
+ tag = create(:tag, label: 'coffee')
51
+
52
+ visit hyper_kitten_meow.new_admin_post_path
53
+ fill_in "Title", with: "Hello World!"
54
+ fill_in "Summary", with: "My great summary!"
55
+ fill_in_rich_text_area "Body", with: "Fuzzy waffle!"
56
+ fill_in "Slug", with: "my slug"
57
+ select "Josh", from: "post[user_id]"
58
+ check "coffee"
59
+ check "Published"
60
+ click_on "Create Post"
61
+
62
+ expect(page).to have_text("Hello World!")
63
+ expect(page).to have_text("My great summary!")
64
+ expect(page).to have_text("my-slug")
65
+ expect(page).to have_css(".published")
66
+ expect(page).to have_text("Josh")
67
+ expect(page).to have_text("coffee")
68
+ expect(page).to have_text("Post successfully created.")
69
+ end
70
+
71
+ scenario "user can fix invalid posts" do
72
+ user = create_user_and_login
73
+ visit hyper_kitten_meow.new_admin_post_path
74
+
75
+ fill_in "Title", with: ""
76
+ click_on "Create Post"
77
+
78
+ expect(page).to have_text("Title can't be blank")
79
+ end
80
+ end
@@ -0,0 +1,65 @@
1
+ require "rails_helper"
2
+
3
+ RSpec.feature "User management", :type => :feature do
4
+ scenario "user can view users" do
5
+ user = create_user_and_login
6
+ user = create(:user, name: "Elvis Costello")
7
+
8
+ visit hyper_kitten_meow.admin_users_path
9
+
10
+ expect(page).to have_text("Elvis Costello")
11
+ end
12
+
13
+ scenario "user can paginate through the users" do
14
+ create_user_and_login
15
+ # The user created for logging in also is included here
16
+ users = FactoryBot.create_list(:user, 10)
17
+
18
+ visit hyper_kitten_meow.admin_users_path
19
+ expect(page).to have_selector('.user', count: 10)
20
+ click_on('Next')
21
+
22
+ expect(page).to have_selector('.user', count: 1)
23
+ end
24
+
25
+ scenario "user can edit users " do
26
+ create_user_and_login(name: 'Andrew')
27
+ user = create(:user, name: 'Josh')
28
+
29
+ visit hyper_kitten_meow.edit_admin_user_path(user)
30
+
31
+ expect(page).to have_text("Josh")
32
+
33
+ fill_in "Name", with: "Elvis"
34
+ fill_in "Email", with: "test@test.com"
35
+ click_on "Update User"
36
+
37
+ expect(page).to have_text("Elvis")
38
+ expect(page).to have_text("test@test.com")
39
+ end
40
+
41
+ scenario "user can create users " do
42
+ user = create_user_and_login(name: 'Andrew')
43
+
44
+ visit hyper_kitten_meow.new_admin_user_path
45
+ fill_in "Name", with: "David Byrne"
46
+ fill_in "Email", with: "test@test.com"
47
+ fill_in "Password", with: "password"
48
+ fill_in "Password confirmation", with: "password"
49
+ click_on "Create User"
50
+
51
+ expect(page).to have_text("David Byrne")
52
+ expect(page).to have_text("test@test.com")
53
+ end
54
+
55
+ scenario "user can fix invalid users" do
56
+ user = create_user_and_login
57
+ visit hyper_kitten_meow.new_admin_user_path
58
+
59
+ fill_in "Name", with: "Prince"
60
+ fill_in "Email", with: "test@test.com"
61
+ click_on "Create User"
62
+
63
+ expect(page).to have_text("Password can't be blank")
64
+ end
65
+ end
@@ -0,0 +1,45 @@
1
+ require "rails_helper"
2
+
3
+ RSpec.feature "Displaying pages", :type => :feature do
4
+ context "using default engine controller" do
5
+ scenario "visitor can view hardcoded pages" do
6
+ visit hyper_kitten_meow.page_path("hardcoded-page")
7
+
8
+ expect(page).to have_text("This is a hardcoded page")
9
+ end
10
+
11
+ scenario "visitor can view pages created in the database" do
12
+ cms_page = create(
13
+ :page,
14
+ slug: "test-page",
15
+ title: "This is a test page",
16
+ published: true
17
+ )
18
+
19
+ visit hyper_kitten_meow.page_path("test-page")
20
+
21
+ expect(page).to have_text("This is a test page")
22
+ end
23
+ end
24
+
25
+ context("using custom controller") do
26
+ scenario "visitor can view hardcoded pages on app controller" do
27
+ visit page_path("app-hardcoded-page")
28
+
29
+ expect(page).to have_text("This is an app hardcoded page")
30
+ end
31
+
32
+ scenario "visitor can view pages created in the database" do
33
+ cms_page = create(
34
+ :page,
35
+ slug: "test-page",
36
+ title: "This is a test page",
37
+ published: true
38
+ )
39
+
40
+ visit page_path("test-page")
41
+
42
+ expect(page).to have_text("This is a test page")
43
+ end
44
+ end
45
+ end
File without changes
@@ -0,0 +1,13 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require_relative "../spec/dummy/config/environment"
5
+ require "minitest"
6
+ require "rails-dom-testing"
7
+ require "rspec/rails/adapters"
8
+
9
+ RSpec.configure do |config|
10
+ config.include Rails::Dom::Testing::Assertions
11
+ config.include RSpec::Rails::MinitestAssertionAdapter
12
+ config.order = "random"
13
+ end