staples 0.1.0 → 1.0.0

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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -1
  3. data/README.md +225 -5
  4. data/lib/staples/cli.rb +25 -2
  5. data/lib/staples/version.rb +3 -1
  6. data/lib/staples.rb +6 -1
  7. data/lib/templates/Procfile +3 -0
  8. data/lib/templates/README.md +127 -0
  9. data/lib/templates/app/controllers/pages_controller.rb +3 -0
  10. data/lib/templates/app/models/membership.rb +4 -0
  11. data/lib/templates/app/models/organization.rb +3 -0
  12. data/lib/templates/app/models/user/account.rb +24 -0
  13. data/lib/templates/app/models/user.rb +3 -0
  14. data/lib/templates/app/views/application/_card.html.erb +5 -0
  15. data/lib/templates/app/views/application/_error_messages.html.erb +11 -0
  16. data/lib/templates/app/views/application/_flashes.html.erb +10 -0
  17. data/lib/templates/app/views/application/_nav.html.erb +27 -0
  18. data/lib/templates/app/views/devise/confirmations/new.html.erb +22 -0
  19. data/lib/templates/app/views/devise/passwords/edit.html.erb +31 -0
  20. data/lib/templates/app/views/devise/passwords/new.html.erb +22 -0
  21. data/lib/templates/app/views/devise/registrations/edit.html.erb +50 -0
  22. data/lib/templates/app/views/devise/registrations/new.html.erb +35 -0
  23. data/lib/templates/app/views/devise/sessions/new.html.erb +32 -0
  24. data/lib/templates/app/views/devise/shared/_links.html.erb +27 -0
  25. data/lib/templates/app/views/pages/home.html.erb +21 -0
  26. data/lib/templates/base.rb +246 -0
  27. data/lib/templates/config/initializers/high_voltage.rb +3 -0
  28. data/lib/templates/config/initializers/sidekiq.rb +12 -0
  29. data/lib/templates/db/migrate/20251121192825_devise_create_users.rb +37 -0
  30. data/lib/templates/db/migrate/20251122141432_create_organizations.rb +7 -0
  31. data/lib/templates/db/migrate/20251122141520_create_memberships.rb +11 -0
  32. data/lib/templates/lib/development/seeder.rb +10 -0
  33. data/lib/templates/lib/tasks/development.rake +15 -0
  34. data/lib/templates/test/controllers/devise/registrations_controller_test.rb +40 -0
  35. data/lib/templates/test/factories/memberships.rb +6 -0
  36. data/lib/templates/test/factories/organizations.rb +4 -0
  37. data/lib/templates/test/factories/users.rb +12 -0
  38. data/lib/templates/test/models/membership_test.rb +13 -0
  39. data/lib/templates/test/models/organization_test.rb +19 -0
  40. data/lib/templates/test/models/user_test.rb +36 -0
  41. data/lib/templates/test/system/authentication_stories_test.rb +72 -0
  42. metadata +36 -1
@@ -0,0 +1,36 @@
1
+ require "test_helper"
2
+
3
+ class User::CreateInitialOrganizationTest < ActiveSupport::TestCase
4
+ test "creates organization on create" do
5
+ user = build(:user)
6
+
7
+ assert_changes -> { Organization.count }, from: 0, to: 1 do
8
+ user.save!
9
+ end
10
+
11
+ user = User.sole
12
+ organization = Organization.sole
13
+
14
+ assert_equal organization, user.organization
15
+ end
16
+
17
+ test "does not create organization on update" do
18
+ user = create(:user)
19
+
20
+ assert_no_changes -> { Organization.count }, from: 1 do
21
+ user.update! email: "updated@example.com"
22
+ end
23
+ end
24
+ end
25
+
26
+ class User::DestroyTest < ActiveSupport::TestCase
27
+ test "destroys associated membership" do
28
+ user = create(:user)
29
+
30
+ assert_no_changes -> { Organization.count }, from: 1 do
31
+ assert_changes -> { Membership.count }, from: 1, to: 0 do
32
+ user.destroy!
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,72 @@
1
+ require "application_system_test_case"
2
+
3
+ class AuthenticationStoriesTest < ApplicationSystemTestCase
4
+ test "registering an account" do
5
+ attributes_for(:user) => {email:, password:}
6
+
7
+ visit root_path
8
+
9
+ within "nav" do
10
+ click_link "Register"
11
+ end
12
+
13
+ fill_in "Email", with: email
14
+ fill_in "Password", with: password
15
+ fill_in "Password confirmation", with: "password mismatch"
16
+ click_button "Sign up"
17
+
18
+ assert_text "Password confirmation doesn't match Password"
19
+
20
+ fill_in "Email", with: email
21
+ fill_in "Password", with: password
22
+ fill_in "Password confirmation", with: password
23
+ click_button "Sign up"
24
+
25
+ assert_text I18n.translate("devise.registrations.signed_up_but_unconfirmed")
26
+
27
+ open_email email
28
+ current_email.click_link "Confirm my account"
29
+
30
+ assert_text I18n.translate("devise.confirmations.confirmed")
31
+ end
32
+
33
+ test "logging in" do
34
+ attributes_for(:user) => {email:, password:}
35
+ create(:user, :confirmed, email:, password:)
36
+
37
+ visit root_path
38
+
39
+ within "nav" do
40
+ click_link "Log in"
41
+ end
42
+
43
+ fill_in "Email", with: email
44
+ fill_in "Password", with: password
45
+ click_button "Log in"
46
+
47
+ assert_text I18n.translate("devise.sessions.signed_in")
48
+
49
+ within "nav" do
50
+ assert_no_link "Log in"
51
+ assert_link email, href: edit_user_registration_path
52
+ end
53
+ end
54
+
55
+ test "logging out" do
56
+ user = create(:user, :confirmed)
57
+
58
+ sign_in_as user
59
+
60
+ visit root_path
61
+
62
+ within "nav" do
63
+ click_button "Log out"
64
+ end
65
+
66
+ assert_text I18n.translate("devise.sessions.signed_out")
67
+
68
+ within "nav" do
69
+ assert_no_button "Log out"
70
+ end
71
+ end
72
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: staples
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Polito
@@ -26,6 +26,41 @@ files:
26
26
  - lib/staples.rb
27
27
  - lib/staples/cli.rb
28
28
  - lib/staples/version.rb
29
+ - lib/templates/Procfile
30
+ - lib/templates/README.md
31
+ - lib/templates/app/controllers/pages_controller.rb
32
+ - lib/templates/app/models/membership.rb
33
+ - lib/templates/app/models/organization.rb
34
+ - lib/templates/app/models/user.rb
35
+ - lib/templates/app/models/user/account.rb
36
+ - lib/templates/app/views/application/_card.html.erb
37
+ - lib/templates/app/views/application/_error_messages.html.erb
38
+ - lib/templates/app/views/application/_flashes.html.erb
39
+ - lib/templates/app/views/application/_nav.html.erb
40
+ - lib/templates/app/views/devise/confirmations/new.html.erb
41
+ - lib/templates/app/views/devise/passwords/edit.html.erb
42
+ - lib/templates/app/views/devise/passwords/new.html.erb
43
+ - lib/templates/app/views/devise/registrations/edit.html.erb
44
+ - lib/templates/app/views/devise/registrations/new.html.erb
45
+ - lib/templates/app/views/devise/sessions/new.html.erb
46
+ - lib/templates/app/views/devise/shared/_links.html.erb
47
+ - lib/templates/app/views/pages/home.html.erb
48
+ - lib/templates/base.rb
49
+ - lib/templates/config/initializers/high_voltage.rb
50
+ - lib/templates/config/initializers/sidekiq.rb
51
+ - lib/templates/db/migrate/20251121192825_devise_create_users.rb
52
+ - lib/templates/db/migrate/20251122141432_create_organizations.rb
53
+ - lib/templates/db/migrate/20251122141520_create_memberships.rb
54
+ - lib/templates/lib/development/seeder.rb
55
+ - lib/templates/lib/tasks/development.rake
56
+ - lib/templates/test/controllers/devise/registrations_controller_test.rb
57
+ - lib/templates/test/factories/memberships.rb
58
+ - lib/templates/test/factories/organizations.rb
59
+ - lib/templates/test/factories/users.rb
60
+ - lib/templates/test/models/membership_test.rb
61
+ - lib/templates/test/models/organization_test.rb
62
+ - lib/templates/test/models/user_test.rb
63
+ - lib/templates/test/system/authentication_stories_test.rb
29
64
  - sig/staples.rbs
30
65
  homepage: https://github.com/stevepolitodesign/staples
31
66
  licenses: