forked from neonwatty/meme-search
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
77 additions
and
47 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,5 +1,5 @@ | ||
<div class="mx-auto md:w-2/3 w-full"> | ||
<h1 class="font-bold text-4xl">New image path</h1> | ||
<h1 class="font-bold text-4xl">New directory path</h1> | ||
<%= render "form", image_path: @image_path %> | ||
<%= link_to "Back to image paths", [:settings, :image_paths], class: "back-button" %> | ||
<%= link_to "Back to directory paths", [:settings, :image_paths], class: "back-button" %> | ||
</div> |
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,10 +1,10 @@ | ||
<div class="mx-auto md:w-2/3 w-full flex"> | ||
<div class="mx-auto"> | ||
<%= render @image_path %> | ||
<%= link_to "Edit this image path", [:edit, :settings, @image_path], class: "edit-button" %> | ||
<%= link_to "Back to image paths", [:settings, :image_paths], class: "back-button" %> | ||
<%= link_to "Edit this directory path", [:edit, :settings, @image_path], class: "edit-button" %> | ||
<%= link_to "Back to directory paths", [:settings, :image_paths], class: "back-button" %> | ||
<div class="inline-block ml-2"> | ||
<%= button_to "Destroy this image path", [:settings, @image_path], method: :delete, data: { confirm: 'Are you sure?' }, class: "delete-button" %> | ||
<%= button_to "Destroy this directory path", [:settings, @image_path], method: :delete, data: { confirm: 'Are you sure?' }, class: "delete-button" %> | ||
</div> | ||
</div> | ||
</div> |
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,41 +1,76 @@ | ||
require "application_system_test_case" | ||
|
||
class ImagePathsTest < ApplicationSystemTestCase | ||
setup do | ||
@image_path = image_paths(:one) | ||
end | ||
|
||
test "visiting the index" do | ||
visit image_paths_url | ||
assert_selector "h1", text: "Image paths" | ||
end | ||
test "visiting the index, create a new path, edit it, and delete it" do | ||
# visit url directly | ||
visit settings_image_paths_url | ||
assert_selector "h1", text: "Current directory paths" | ||
|
||
test "should create image path" do | ||
visit image_paths_url | ||
click_on "New image path" | ||
# navigate via settings --> tag_names | ||
assert_selector "ul#navigation" do | ||
assert_selector "li#settings" do | ||
click_on "Settings" | ||
assert_selector "div", text: "Paths" | ||
click_on "Paths" | ||
sleep(0.5) | ||
assert_selector "h1", text: "Current directory paths" | ||
end | ||
end | ||
|
||
fill_in "Image path", with: @image_path.image_path | ||
click_on "Create Image path" | ||
# count total number of original current paths | ||
divs_with_path_name_id = all("div[id^='image_path_']") | ||
first_path_count = divs_with_path_name_id.count | ||
|
||
assert_text "Image path was successfully created" | ||
click_on "Back" | ||
end | ||
# click on "Create New" | ||
click_on "Create new" | ||
assert_selector "h1", text: "New directory path" | ||
|
||
test "should update Image path" do | ||
visit image_path_url(@image_path) | ||
click_on "Edit this image path", match: :first | ||
# enter name for new tag and create | ||
fill_in "new_image_path_text_area", with: "test_path" | ||
click_on "Save" | ||
sleep(0.25) | ||
assert_selector "div", text: "Directory path successfully created!" | ||
|
||
fill_in "Image path", with: @image_path.image_path | ||
click_on "Update Image path" | ||
# # return to tags list | ||
# click_on "Back to tags" | ||
# sleep(0.2) | ||
# divs_with_tag_name_id = all("div[id^='tag_name_']") | ||
# second_tag_count = divs_with_tag_name_id.count | ||
|
||
assert_text "Image path was successfully updated" | ||
click_on "Back" | ||
end | ||
# # make sure current tag count is +1 of starting tag count | ||
# assert second_tag_count == first_tag_count + 1 | ||
|
||
# # edit tag | ||
# click_on "Adjust / delete", match: :first | ||
# sleep(0.2) | ||
# click_on "Edit this tag" | ||
# sleep(0.2) | ||
# fill_in "new_tag_name_text_area", with: "another_test_tag" | ||
# click_on "Save" | ||
# sleep(0.2) | ||
# assert_selector "div", text: "Tag successfully updated!" | ||
# click_on "Back to tags" | ||
# sleep(0.2) | ||
|
||
# # count number of tags | ||
# divs_with_tag_name_id = all("div[id^='tag_name_']") | ||
# third_tag_count = divs_with_tag_name_id.count | ||
# assert third_tag_count == second_tag_count | ||
|
||
# # delete tag | ||
# click_on "Adjust / delete", match: :first | ||
# sleep(0.2) | ||
# accept_alert do | ||
# click_on "Delete this tag" | ||
# end | ||
# sleep(0.2) | ||
# assert_selector "div", text: "Tag successfully deleted!" | ||
|
||
test "should destroy Image path" do | ||
visit image_path_url(@image_path) | ||
click_on "Destroy this image path", match: :first | ||
# # count number of tags - assert the same as start | ||
# divs_with_tag_name_id = all("div[id^='tag_name_']") | ||
# fourth_tag_count = divs_with_tag_name_id.count | ||
# assert fourth_tag_count == first_tag_count | ||
|
||
assert_text "Image path was successfully destroyed" | ||
end | ||
end |
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