Skip to content

Commit

Permalink
Fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
CuddlyBunion341 committed Nov 25, 2024
1 parent 46b944a commit 27a1a1b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions test/system/translation_files_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,25 @@ def test_show
def test_create_translation
visit moirai_translation_file_path(Digest::SHA256.hexdigest(Rails.root.join("config/locales/de.yml").to_s))

within "#moirai-de_locales_german" do
within find("tr", text: "locales.german") do
fill_in "translation[value]", with: "Hochdeutsch"
click_on "Update"
find("input[type='submit'][value='Update']", visible: false).execute_script("this.click()")
end
end

def test_update_translation
Moirai::Translation.create!(key: "greeting", locale: "en", value: "Hi")
Moirai::Translation.create!(key: "locales.german", locale: "en", value: "German")
file_id = Digest::SHA256.hexdigest(Rails.root.join("config/locales/en.yml").to_s)

visit moirai_translation_file_path(file_id)

within "#moirai-en_locales_german" do
within find("tr", text: "locales.german") do
fill_in "translation[value]", with: "Hochdeutsch"
click_on "Update"
find("input[type='submit'][value='Update']", visible: false).execute_script("this.click()")
end

assert_text "Translation greeting was successfully updated."
assert_equal "Hochdeutsch", Moirai::Translation.find_by(key: "locales.german", locale: "en").value

assert_text "Translation locales.german was successfully updated."
end
end

0 comments on commit 27a1a1b

Please sign in to comment.