aboutsummaryrefslogtreecommitdiff
path: root/test/system/things_test.rb
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2024-03-14 11:34:28 +0100
committerMiquel Sabaté Solà <msabate@suse.com>2024-03-14 14:09:11 +0100
commit64e2bca8326bd46a2ad80b6a7a430dea0f81ff6b (patch)
treebf4d1894c45471ee1d38b6292b87e356737f2fb6 /test/system/things_test.rb
parent90feff2bfcbdb5586a459c2350a4172a4423668e (diff)
downloadoperum-64e2bca8326bd46a2ad80b6a7a430dea0f81ff6b.tar.gz
operum-64e2bca8326bd46a2ad80b6a7a430dea0f81ff6b.zip
Added rubocop-minitest
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'test/system/things_test.rb')
-rw-r--r--test/system/things_test.rb25
1 files changed, 16 insertions, 9 deletions
diff --git a/test/system/things_test.rb b/test/system/things_test.rb
index 9dd482d..792c07f 100644
--- a/test/system/things_test.rb
+++ b/test/system/things_test.rb
@@ -7,12 +7,14 @@ class ThingsTest < ApplicationSystemTestCase
test 'the hidden menu has a things#new link' do
find('#toggle-hidden-global-menu').click
+
assert_text I18n.t('things.object').downcase
click_on I18n.t('things.object').downcase
+
assert_text I18n.t('activerecord.attributes.thing.title')
- assert page.current_path == new_thing_path
+ assert_equal page.current_path, new_thing_path
end
test 'you can click on a thing listed on the search to go to the its #show page' do
@@ -20,7 +22,7 @@ class ThingsTest < ApplicationSystemTestCase
assert_text I18n.t('activerecord.attributes.thing.title')
- assert page.current_path == edit_thing_path(things(:thing1))
+ assert_equal page.current_path, edit_thing_path(things(:thing1))
end
test 'you can create a new thing' do
@@ -38,13 +40,17 @@ class ThingsTest < ApplicationSystemTestCase
# Ensure that tag references are properly created.
tags = Thing.find_by(title: 'new title').tags
- assert tags.size == 1
- assert tags.first.name == tags(:tag1).name
- # You can go back to create another thing with a convenient link.
+ assert_equal tags.map(&:name), [tags(:tag1).name]
+ end
+
+ test 'you have a link to go back at creating a thing' do
+ visit thing_url(things(:thing1))
+
click_on I18n.t('things.create-another')
+
assert_text I18n.t('activerecord.attributes.thing.title')
- assert page.current_path == new_thing_path
+ assert_equal page.current_path, new_thing_path
end
test 'you get feedback from wrong values for a new thing' do
@@ -67,7 +73,7 @@ class ThingsTest < ApplicationSystemTestCase
# Originally :thing1 has references to :tag1 and :tag2. This test will
# remove the reference to :tag1.
- assert things(:thing1).tag_references.size == 2
+ assert_equal 2, things(:thing1).tag_references.size
fill_in I18n.t('activerecord.attributes.thing.title'), with: 'another thing entirely'
find("#thing_tag_ids_#{tags(:tag1).id}").click
@@ -77,8 +83,8 @@ class ThingsTest < ApplicationSystemTestCase
# Tag references updated: only one reference (:tag2).
tags = things(:thing1).reload.tags
- assert tags.size == 1
- assert tags.first.id = tags(:tag2).id
+
+ assert_equal tags.map(&:id), [tags(:tag2).id]
end
test 'you get feedback from wrong values for a thing' do
@@ -96,6 +102,7 @@ class ThingsTest < ApplicationSystemTestCase
assert_difference 'Thing.count', -1 do
accept_alert { click_on I18n.t('general.delete').capitalize, match: :first }
+
assert_text I18n.t('things.destroy-success')
end
end