-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Match CRUD operations and tests for good ones
- Loading branch information
1 parent
1e0a5e5
commit 3c09717
Showing
19 changed files
with
192 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
%h1 Gift Idea #{gift_idea.id} | ||
%p= link_to "show", admin_gift_idea_path(gift_idea) | ||
%p= link_to "delete", admin_gift_idea_path(gift_idea), data: { turbo_method: :delete, turbo_confirm: "Are you sure?" } | ||
%h1 Edit Gift Idea #{gift_idea.id} | ||
|
||
%p= link_to "Show Gift Idea", admin_gift_idea_path(gift_idea) | ||
|
||
= render "form", gift_idea: gift_idea, button_label: "update" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
%h1 Gift Ideas | ||
|
||
%p= link_to "new gift idea", new_admin_gift_idea_path | ||
%p= link_to "New Gift Idea", new_admin_gift_idea_path | ||
|
||
%ul | ||
- gift_ideas.each do |gift_idea| | ||
%li= link_to gift_idea.title, admin_gift_idea_path(gift_idea) | ||
%table | ||
%thead | ||
%tr | ||
%th ID | ||
%th Title | ||
%th.text-right Created At | ||
%tbody | ||
- gift_ideas.each do |gift_idea| | ||
%tr | ||
%td= link_to gift_idea.id, admin_gift_idea_path(gift_idea) | ||
%td= gift_idea.title | ||
%td.text-right= gift_idea.created_at.to_formatted_s(:long) | ||
|
||
= paginate gift_ideas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
%h1 New Gift Idea | ||
%p= link_to "gift ideas", admin_gift_ideas_path | ||
|
||
%p= link_to "Gift Idea List", admin_gift_ideas_path | ||
|
||
= render "form", gift_idea: gift_idea, button_label: "create" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
%h1 Gift Idea #{gift_idea.id} | ||
|
||
%p= link_to "gift ideas", admin_gift_ideas_path | ||
%p= link_to "Gift Idea List", admin_gift_ideas_path | ||
|
||
%p= link_to "edit", edit_admin_gift_idea_path(gift_idea) | ||
%p= link_to "Edit Gift Idea", edit_admin_gift_idea_path(gift_idea) | ||
|
||
%p= link_to "Delete Gift Idea", admin_gift_idea_path(gift_idea), data: { turbo_method: :delete, turbo_confirm: "Are you sure?" } | ||
|
||
= render partial: "attrs_table", locals: { attrs: gift_idea.table_attrs } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
spec/system/financial_accounts/admin_views_financial_accounts_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require "rails_helper" | ||
|
||
describe "Admin edits gift idea" do | ||
include_context "admin password matches" | ||
|
||
scenario "from show page" do | ||
gift_idea = FactoryBot.create(:gift_idea) | ||
visit "/admin/gift_ideas/#{gift_idea.id}" | ||
click_on "Edit Gift Idea" | ||
expect(page).to have_css "h1", text: "Edit Gift Idea #{gift_idea.id}" | ||
expect(page).to have_css "a", text: "Show Gift Idea" | ||
expect(current_path).to eq edit_admin_gift_idea_path(gift_idea) | ||
end | ||
|
||
scenario "edit with errors" do | ||
gift_idea = FactoryBot.create(:gift_idea) | ||
visit "/admin/gift_ideas/#{gift_idea.id}/edit" | ||
fill_in "title", with: "" | ||
click_on "update" | ||
expect(page).to have_css ".alert", text: "Title can't be blank" | ||
end | ||
|
||
scenario "edit successfully" do | ||
gift_idea = FactoryBot.create( | ||
:gift_idea, | ||
title: "Mew Nario Game" | ||
) | ||
visit "/admin/gift_ideas/#{gift_idea.id}/edit" | ||
fill_in "title", with: "New Mario Game" | ||
click_on "update" | ||
|
||
expect(page).to have_css ".notice", text: "Gift Idea updated" | ||
expect(current_path).to eq admin_gift_idea_path(gift_idea) | ||
expect(page).to have_css "td", text: "New Mario Game" | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.