From e1f42aee0c55f01548b706464beea97aa67aa0f5 Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Thu, 26 Jun 2025 23:34:51 +0200 Subject: [PATCH] rubocop --- test/controllers/packages_controller_test.rb | 13 ++++++++----- test/system/browses_test.rb | 9 ++++----- test/system/uploads_test.rb | 17 +++++++---------- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/test/controllers/packages_controller_test.rb b/test/controllers/packages_controller_test.rb index 9a9d9d5..c9eae31 100644 --- a/test/controllers/packages_controller_test.rb +++ b/test/controllers/packages_controller_test.rb @@ -1,13 +1,13 @@ require 'test_helper' class PackagesControllerTest < ActionController::TestCase - test "should get index and contain dummy package-4" do + test 'should get index and contain dummy package-4' do get :grid assert_response :success assert_select 'div', 'package-4' end - test "should get list view with_screenshots and find Firefox" do + test 'should get list view with_screenshots and find Firefox' do # package = Package.create!(name: 'firefox', description: 'A web browser.') # Screenshot.create!(package: package, approved: true, hidden: false) @@ -20,7 +20,12 @@ class PackagesControllerTest < ActionController::TestCase assert_select 'div', 'A program to browse web sites.' end - # test "should get without_screenshots" do + # test 'should get thumbnail for a package and a desired version' do + # # get '/thumbnail-with-version/package-5/0.1' + # get thumbnail_with_version_url('package-5', '0.1') + # end + + # test 'should get without_screenshots' do # get :without_screenshots # assert_response :success # end @@ -56,7 +61,6 @@ class PackagesControllerTest < ActionController::TestCase # byebug # assert_equal newest_screenshot2.user, users(:normal) - # # (name: 'firefox') # # img_count_before = page.find_all('img').count # # attach_file 'file[]', Rails.root.join('test/fixtures/files/large1.png') @@ -77,5 +81,4 @@ class PackagesControllerTest < ActionController::TestCase # # newest_screenshot.destroy # # sign_out users(:normal) # end - end diff --git a/test/system/browses_test.rb b/test/system/browses_test.rb index 36d75fc..e0a7b54 100644 --- a/test/system/browses_test.rb +++ b/test/system/browses_test.rb @@ -1,4 +1,4 @@ -require "application_system_test_case" +require 'application_system_test_case' class BrowsesTest < ApplicationSystemTestCase # test "visiting the index" do @@ -7,14 +7,13 @@ class BrowsesTest < ApplicationSystemTestCase # assert_selector "h1", text: "Browse" # end - test "user can see home page" do + test 'user can see home page' do visit root_path - assert_text /This website lets you browse screenshots of [\d,]+ software packages/ + assert_text(/This website lets you browse screenshots of [\d,]+ software packages/) end - test "user can browse packages" do + test 'user can browse packages' do visit packages_grid_path has_link? href: packages_grid_path(page: 2) end - end diff --git a/test/system/uploads_test.rb b/test/system/uploads_test.rb index 65198e7..74e034c 100644 --- a/test/system/uploads_test.rb +++ b/test/system/uploads_test.rb @@ -1,7 +1,7 @@ -require "application_system_test_case" +require 'application_system_test_case' class UploadsTest < ApplicationSystemTestCase - test "upload broken screenshot anonymously and get error message" do + test 'upload broken screenshot anonymously and get error message' do visit package_path(name: 'firefox') click_on 'Upload a screenshot' # The actual file field is hidden in favor of a more beautiful button -> visible=false @@ -10,10 +10,10 @@ class UploadsTest < ApplicationSystemTestCase assert_text 'large-broken.png must be a valid' end - test "upload png screenshot anonymously and await moderation" do + test 'upload png screenshot anonymously and await moderation' do visit package_path(name: 'firefox') img_count1 = page.find_all('img').count - #Rails::logger.debug "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 1=#{img_count1}" + # Rails::logger.debug "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 1=#{img_count1}" click_on 'Upload a screenshot' attach_file 'file[]', Rails.root.join('test/fixtures/files/large1.png'), visible: false @@ -25,7 +25,7 @@ class UploadsTest < ApplicationSystemTestCase assert page.has_content?('needs to be approved') img_count2 = page.find_all('img').count - #Rails::logger.debug "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 1=#{img_count2}" + # Rails::logger.debug "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 1=#{img_count2}" assert_equal img_count2, img_count1 + 1 @@ -40,13 +40,12 @@ class UploadsTest < ApplicationSystemTestCase # Wait for redirect to details page assert page.has_content?('Homepage') img_count3 = page.find_all('img').count - #Rails::logger.debug "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 1=#{img_count3}" + # Rails::logger.debug "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 1=#{img_count3}" assert_equal img_count3, img_count1 end - test "upload png screenshot as moderator and expect auto-approval" do - + test 'upload png screenshot as moderator and expect auto-approval' do # Delete all screenshots for the Firefox package Package.find_by_name(:firefox).screenshots.delete_all @@ -83,7 +82,6 @@ class UploadsTest < ApplicationSystemTestCase assert page.has_content?('Homepage') end - # test "upload screenshot as Debian SSO user and get auto-approval" do # sign_in users(:debian) # visit upload_path(name: 'firefox') @@ -128,5 +126,4 @@ class UploadsTest < ApplicationSystemTestCase # newest_screenshot.destroy # sign_out users(:debian) # end - end