hyper-kitten-tables 0.1.1.alpha1 → 0.1.1.alpha1.01

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6ae5f30c91b6b468accf3ce4b8d921c884f977e9bdc7f1a8f59680979f2d04d
4
- data.tar.gz: 14de2e2c188d44d3af6ed12c66b32ae706f0d71d524541f09a52623f0dbbe92b
3
+ metadata.gz: 14f5fafc4af8d2ba9f6325074437b5a41be99265e9dc81648bcdead30fb5bb20
4
+ data.tar.gz: ceada638dd65433be15f5b1cd01204e4dbb943ca2970c85cdc78e8b027aea09e
5
5
  SHA512:
6
- metadata.gz: 27450c54ca01cee36e00a80e9065ee27052b63b98c4ab1347166dbfbccb125d1a657e38778204799b12cd2868e78beec7c8251771d30fe527739e6b3c62748d5
7
- data.tar.gz: 65f99f53091dfd703b2c96fd52d7644dde9b78c14f4860ef6c096d03ca5cf4d9c6dd0387200603c29db474c78651a5dc042385f0b87397adc529d45568213c54
6
+ metadata.gz: 5bc66f97dc018904ab0a1c768e9b75cc0f55586f778b476ff956f0fdf71d3bc2a02036a3f9414d9a85b87576b6e030aeb40edfed47fec26f0aac471faf274c72
7
+ data.tar.gz: 0e7f575043f5d2065bb98cd416079db1a94778be026bf5349cb6bf231d29795d066d4adce4f9169909c82563584c3299ec1af8671238ca085a62300646c1fe52
@@ -11,7 +11,7 @@ module HyperKittenTables
11
11
 
12
12
  def_delegators :@view_context, :content_tag, :capture, :request
13
13
 
14
- Column = Struct.new(:name, :method_name, :sort_key, :block, :sortable, :options)
14
+ const_set :Column, Struct.new(:name, :method_name, :sort_key, :block, :sortable, :options)
15
15
  end
16
16
 
17
17
  def initialize(collection: [], requested_columns: [], &block)
@@ -34,7 +34,7 @@ module HyperKittenTables
34
34
  name = name.to_s.titleize unless block_given?
35
35
  end
36
36
  sort_key = method_name if sort_key.blank?
37
- @columns << Column.new(name, method_name, sort_key, block, sortable, options)
37
+ @columns << self.class::Column.new(name, method_name, sort_key, block, sortable, options)
38
38
  end
39
39
 
40
40
  def define_header_sort_url(&block)
@@ -1,3 +1,3 @@
1
1
  module HyperKittenTables
2
- VERSION = "0.1.1.alpha1"
2
+ VERSION = "0.1.1.alpha1.01"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyper-kitten-tables
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.alpha1
4
+ version: 0.1.1.alpha1.01
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Klina
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-07 00:00:00.000000000 Z
11
+ date: 2022-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -298,13 +298,6 @@ files:
298
298
  - spec/dummy/tmp/capybara/screenshot_2022-11-16-20-52-42.586.html
299
299
  - spec/dummy/tmp/development_secret.txt
300
300
  - spec/dummy/tmp/restart.txt
301
- - spec/features/admin/create_first_user_spec.rb
302
- - spec/features/admin/menu_management_spec.rb
303
- - spec/features/admin/page_management_spec.rb
304
- - spec/features/admin/post_management_spec.rb
305
- - spec/features/admin/users_management_spec.rb
306
- - spec/features/display_pages_spec.rb
307
- - spec/features/display_posts_spec.rb
308
301
  - spec/rails_helper.rb
309
302
  homepage: https://github.com/Hyper-Kitten/tables
310
303
  licenses:
@@ -492,11 +485,4 @@ test_files:
492
485
  - spec/dummy/tmp/capybara/screenshot_2022-11-16-20-52-42.586.html
493
486
  - spec/dummy/tmp/development_secret.txt
494
487
  - spec/dummy/tmp/restart.txt
495
- - spec/features/admin/create_first_user_spec.rb
496
- - spec/features/admin/menu_management_spec.rb
497
- - spec/features/admin/page_management_spec.rb
498
- - spec/features/admin/post_management_spec.rb
499
- - spec/features/admin/users_management_spec.rb
500
- - spec/features/display_pages_spec.rb
501
- - spec/features/display_posts_spec.rb
502
488
  - spec/rails_helper.rb
@@ -1,34 +0,0 @@
1
- require "rails_helper"
2
-
3
- RSpec.feature "Creating the first user", :type => :feature do
4
- context "when there are no users" do
5
- scenario "trying to login redirects to the first user form" do
6
- visit hyper_kitten_meow.admin_login_path
7
-
8
- expect(page).to have_current_path(hyper_kitten_meow.new_admin_first_user_path)
9
- end
10
-
11
- scenario "visitor can create first user" do
12
- visit hyper_kitten_meow.new_admin_first_user_path
13
-
14
- fill_in "Name", with: "David Byrne"
15
- fill_in "Email", with: "test@test.com"
16
- fill_in "Password", with: "password"
17
- fill_in "Password confirmation", with: "password"
18
- click_on "Create User"
19
-
20
- expect(page).to have_current_path(hyper_kitten_meow.admin_login_path)
21
- expect(page).to have_text("User successfully created. Please log in.")
22
- end
23
- end
24
-
25
- context "when there are users" do
26
- scenario "trying to create a first user redirects to the login page" do
27
- create(:user)
28
-
29
- visit hyper_kitten_meow.new_admin_first_user_path
30
-
31
- expect(page).to have_current_path(hyper_kitten_meow.admin_login_path)
32
- end
33
- end
34
- end
@@ -1,137 +0,0 @@
1
- require "rails_helper"
2
-
3
- RSpec.feature "Menu management", :type => :feature do
4
- scenario "user can view posts" do
5
- user = create_user_and_login
6
- menu = create(:menu, name: "My Title")
7
-
8
- visit hyper_kitten_meow.admin_menus_path
9
-
10
- expect(page).to have_text("My Title")
11
- end
12
-
13
- scenario "user can create a menu" do
14
- user = create_user_and_login
15
- static_page = create(:page, title: "My Page")
16
-
17
- visit hyper_kitten_meow.new_admin_menu_path
18
-
19
- fill_in "Name", with: "Hello World!"
20
- select "My Page", from: "Page"
21
- fill_in "Title", with: "My Title"
22
- check "New window"
23
- click_button "Create Menu"
24
-
25
- expect(page).to have_text("Menu was successfully created.")
26
- expect(page).to have_text("Hello World!")
27
- menu = HyperKittenMeow::Menu.last
28
- menu_item = menu.menu_items.first
29
- expect(menu_item.title).to eq("My Title")
30
- expect(menu_item.page).to eq(static_page)
31
- expect(menu_item.new_window).to eq(true)
32
- expect(menu_item.position).to eq(1)
33
- end
34
-
35
- scenario "user can edit menus" do
36
- user = create_user_and_login(name: 'Andrew')
37
- menu = create(:menu, name: "My Menu")
38
- static_page = create(:page, title: "My Page")
39
-
40
- visit hyper_kitten_meow.edit_admin_menu_path(menu)
41
-
42
- expect(page).to have_text("My Menu")
43
-
44
- fill_in "Name", with: "Hello World!"
45
- select "My Page", from: "Page"
46
- fill_in "Title", with: "My Title"
47
- click_on "Update Menu"
48
-
49
- expect(page).to have_text("Menu was successfully updated.")
50
- expect(page).to have_text("Hello World!")
51
- menu.reload
52
- menu_item = menu.menu_items.first
53
- expect(menu_item.title).to eq("My Title")
54
- expect(menu_item.page).to eq(static_page)
55
- expect(menu_item.position).to eq(1)
56
- end
57
-
58
- scenario "user can edit menus and add menu items", js: true do
59
- user = create_user_and_login(name: 'Andrew')
60
- menu = create(:menu, name: "My Menu")
61
- static_page1 = create(:page, title: "My Page 1")
62
- static_page2 = create(:page, title: "My Page 2")
63
-
64
- visit hyper_kitten_meow.edit_admin_menu_path(menu)
65
-
66
- expect(page).to have_text("My Menu")
67
-
68
- click_on "Add Menu Item"
69
- expect(page).to have_selector(".menu-item", count: 2)
70
- menu_items = all(".menu-item")
71
- within menu_items.first do
72
- select "My Page 1", from: "Page"
73
- fill_in "Title", with: "First Item"
74
- end
75
- within menu_items.last do
76
- select "My Page 2", from: "Page"
77
- fill_in "Title", with: "Second Item"
78
- end
79
- click_on "Update Menu"
80
-
81
- expect(page).to have_text("My Menu")
82
- menu.reload
83
- expect(menu.menu_items.size).to eq(2)
84
- menu_item = menu.menu_items.first
85
- expect(menu_item.title).to eq("First Item")
86
- expect(menu_item.page).to eq(static_page1)
87
- expect(menu_item.position).to eq(1)
88
- menu_item2 = menu.menu_items.last
89
- expect(menu_item2.title).to eq("Second Item")
90
- expect(menu_item2.page).to eq(static_page2)
91
- expect(menu_item2.position).to eq(2)
92
- end
93
-
94
- scenario "user can edit menus and remove menu items", js: true do
95
- user = create_user_and_login(name: 'Andrew')
96
- menu = create(:menu, name: "My Menu")
97
- static_page1 = create(:page, title: "My Page 1")
98
- static_page2 = create(:page, title: "My Page 2")
99
- create(:menu_item, menu: menu, page: static_page1, title: "First Item", position: 1)
100
- create(:menu_item, menu: menu, page: static_page2, title: "Second Item", position: 2)
101
-
102
- visit hyper_kitten_meow.edit_admin_menu_path(menu)
103
-
104
- expect(page).to have_text("My Menu")
105
- expect(page).to have_selector(".menu-item", count: 2)
106
- menu_items = all(".menu-item")
107
- within menu_items.first do
108
- click_on "Remove"
109
- end
110
- click_on "Update Menu"
111
-
112
- expect(page).to have_text("My Menu")
113
- menu.reload
114
- expect(menu.menu_items.size).to eq(1)
115
- menu_item = menu.menu_items.first
116
- expect(menu_item.title).to eq("Second Item")
117
- expect(menu_item.page).to eq(static_page2)
118
- expect(menu_item.position).to eq(1)
119
- end
120
-
121
- scenario "user can delete a menu" do
122
- user = create_user_and_login(name: 'Andrew')
123
- menu = create(:menu, name: "My Menu")
124
- static_page1 = create(:page, title: "My Page 1")
125
- static_page2 = create(:page, title: "My Page 2")
126
- create(:menu_item, menu: menu, page: static_page1, title: "First Item", position: 1)
127
- create(:menu_item, menu: menu, page: static_page2, title: "Second Item", position: 2)
128
-
129
- visit hyper_kitten_meow.admin_menus_path
130
-
131
- click_on "Delete"
132
-
133
- expect(page).to have_text("Menu was successfully deleted.")
134
- expect(page).to_not have_text("My Menu")
135
- end
136
- end
137
-
@@ -1,73 +0,0 @@
1
- require "rails_helper"
2
-
3
- RSpec.feature "Page management", :type => :feature do
4
- scenario "user can view pages" do
5
- user = create_user_and_login
6
- static_page = create(:page, title: "My Title")
7
-
8
- visit hyper_kitten_meow.admin_pages_path
9
-
10
- expect(page).to have_text("My Title")
11
- end
12
-
13
- it "paginates pages" do
14
- create_user_and_login
15
- paginates(factory: :page, increment: 10, selector: '.page') do
16
- visit hyper_kitten_meow.admin_pages_path
17
- end
18
- end
19
-
20
- scenario "user can paginate through the pages" do
21
- create_user_and_login
22
- pages = FactoryBot.create_list(:page, 11)
23
-
24
- visit hyper_kitten_meow.admin_pages_path
25
- expect(page).to have_selector('.page', count: 10)
26
- click_on('Next')
27
-
28
- expect(page).to have_selector('.page', count: 1)
29
- end
30
-
31
- scenario "user can edit pages", js: true do
32
- user = create_user_and_login
33
- static_page = create(:page, title: "My Title")
34
-
35
- visit hyper_kitten_meow.edit_admin_page_path(static_page)
36
-
37
- expect(page).to have_text("My Title")
38
-
39
- fill_in "Title", with: "Hello World!"
40
- fill_in "Slug", with: "my slug"
41
- fill_in_rich_text_area "Body", with: "Fuzzy waffle!"
42
- check "Published"
43
- click_on "Update Page"
44
-
45
- expect(current_path).to eq(hyper_kitten_meow.admin_pages_path)
46
- expect(page).to have_text("Hello World!")
47
- expect(page).to have_text("my-slug")
48
- end
49
-
50
- scenario "user can create pages", js: true do
51
- user = create_user_and_login
52
-
53
- visit hyper_kitten_meow.new_admin_page_path
54
- fill_in "Title", with: "Hello World!"
55
- fill_in_rich_text_area "Body", with: "Fuzzy waffle!"
56
- check "Published"
57
- click_on "Create Page"
58
-
59
- expect(current_path).to eq(hyper_kitten_meow.admin_pages_path)
60
- expect(page).to have_text("Hello World!")
61
- expect(page).to have_text("Page successfully created.")
62
- end
63
-
64
- scenario "user can fix invalid pages", js: true do
65
- user = create_user_and_login
66
- visit hyper_kitten_meow.new_admin_page_path
67
-
68
- fill_in "Title", with: ""
69
- click_on "Create Page"
70
-
71
- expect(page).to have_text("Title can't be blank")
72
- end
73
- end
@@ -1,80 +0,0 @@
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
@@ -1,65 +0,0 @@
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
@@ -1,45 +0,0 @@
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