source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/names/eol_data/expanded_review_controller_test.rb | Ruby | mit | 84 | main | 244 | # frozen_string_literal: true
require("test_helper")
module Names::EolData
class ExpandedReviewControllerTest < FunctionalTestCase
include ObjectLinkHelper
def test_eol_expanded_review
requires_login(:show)
end
end
end |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/names/eol_data/preview_controller_test.rb | Ruby | mit | 84 | main | 231 | # frozen_string_literal: true
require("test_helper")
module Names::EolData
class PreviewControllerTest < FunctionalTestCase
include ObjectLinkHelper
def test_eol_preview
login
get("show")
end
end
end |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/names/classification/propagate_controller_test.rb | Ruby | mit | 84 | main | 1,289 | # frozen_string_literal: true
require("test_helper")
module Names::Classification
class PropagateControllerTest < FunctionalTestCase
include ObjectLinkHelper
# Description-mirror assertions removed — classification only
# lives on Name now (discussion #4163).
def test_propagate_classification
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/names/classification/inherit_controller_test.rb | Ruby | mit | 84 | main | 4,462 | # frozen_string_literal: true
require("test_helper")
module Names::Classification
class InheritControllerTest < FunctionalTestCase
include ObjectLinkHelper
def create_name(name)
parse = Name.parse_name(name)
params = parse.params
params[:user] ||= rolf
Name.new_name(params)
end
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/names/classification/refresh_controller_test.rb | Ruby | mit | 84 | main | 1,535 | # frozen_string_literal: true
require("test_helper")
module Names::Classification
class RefreshControllerTest < FunctionalTestCase
include ObjectLinkHelper
# Description-mirror assertions removed — classification only
# lives on Name now (discussion #4163).
def test_refresh_classification
gen... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/names/descriptions/permissions_controller_test.rb | Ruby | mit | 84 | main | 6,662 | # frozen_string_literal: true
require("test_helper")
module Names::Descriptions
class PermissionsControllerTest < FunctionalTestCase
include ObjectLinkHelper
def peltigera_desc
name_descriptions(:peltigera_desc)
end
def draft_cc_desc
name_descriptions(:draft_coprinus_comatus)
end
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/names/descriptions/moves_controller_test.rb | Ruby | mit | 84 | main | 5,520 | # frozen_string_literal: true
require("test_helper")
module Names::Descriptions
class MovesControllerTest < FunctionalTestCase
include ObjectLinkHelper
# Rolf is the author of an alternative desc.
# It's not restricted.
def rolf_desc
name_descriptions(:peltigera_alt_desc)
end
# Mary ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/names/descriptions/publish_controller_test.rb | Ruby | mit | 84 | main | 3,702 | # frozen_string_literal: true
require("test_helper")
module Names::Descriptions
class PublishControllerTest < FunctionalTestCase
include ObjectLinkHelper
# Owner can publish.
def test_publish_draft
publish_draft_helper(name_descriptions(:draft_coprinus_comatus), nil,
me... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/names/descriptions/defaults_controller_test.rb | Ruby | mit | 84 | main | 940 | # frozen_string_literal: true
require("test_helper")
module Names::Descriptions
class DefaultsControllerTest < FunctionalTestCase
def make_description_default_helper(desc)
user = desc.user
params = {
id: desc.id
}
put_requires_login(:update, params, user.login)
end
def t... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/names/descriptions/merges_controller_test.rb | Ruby | mit | 84 | main | 6,463 | # frozen_string_literal: true
require("test_helper")
module Names::Descriptions
class MergesControllerTest < FunctionalTestCase
include ObjectLinkHelper
# Rolf is the author of an alternative desc.
# It's not restricted.
def rolf_desc
name_descriptions(:peltigera_alt_desc)
end
# Mary... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/names/descriptions/versions_controller_test.rb | Ruby | mit | 84 | main | 683 | # frozen_string_literal: true
require("test_helper")
module Names::Descriptions
class VersionsControllerTest < FunctionalTestCase
include ObjectLinkHelper
def test_show_past_name_description
login("dick")
desc = name_descriptions(:peltigera_desc)
old_versions = desc.versions.length
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/names/descriptions/review_status_controller_test.rb | Ruby | mit | 84 | main | 1,035 | # frozen_string_literal: true
require("test_helper")
module Names::Descriptions
class ReviewStatusControllerTest < FunctionalTestCase
include ObjectLinkHelper
def test_set_review_status_reviewer
desc = name_descriptions(:coprinus_comatus_desc)
assert_equal("unreviewed", desc.review_status)
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/names/synonyms/approve_controller_test.rb | Ruby | mit | 84 | main | 3,088 | # frozen_string_literal: true
require("test_helper")
module Names::Synonyms
class ApproveControllerTest < FunctionalTestCase
include ObjectLinkHelper
# ----------------------------
# Approval.
# ----------------------------
def test_approve_name
name = names(:lactarius_alpigenes)
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/names/synonyms/deprecate_controller_test.rb | Ruby | mit | 84 | main | 8,186 | # frozen_string_literal: true
require("test_helper")
module Names::Synonyms
class DeprecateControllerTest < FunctionalTestCase
include ObjectLinkHelper
def test_deprecate_name
name = names(:chlorophyllum_rachodes)
params = { id: name.id }
requires_login(:new, params)
assert_form_act... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/names/trackers/approve_controller_test.rb | Ruby | mit | 84 | main | 1,330 | # frozen_string_literal: true
require("test_helper")
module Names::Trackers
class ApproveControllerTest < FunctionalTestCase
include ActiveJob::TestHelper
# NOTE: this is a GET callback for email links
def test_approve_tracker_with_template
tracker = name_trackers(:agaricus_campestris_name_tracke... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/names/lifeforms/propagate_controller_test.rb | Ruby | mit | 84 | main | 1,535 | # frozen_string_literal: true
require("test_helper")
module Names::Lifeforms
class PropagateControllerTest < FunctionalTestCase
include ObjectLinkHelper
def test_propagate_lifeform
name = names(:lecanorales)
children = name.all_children
Name.update(name.id, lifeform: " lichen ")
# ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/field_slips/qr_reader_controller_test.rb | Ruby | mit | 84 | main | 874 | # frozen_string_literal: true
require("test_helper")
module FieldSlips
class QRReaderControllerTest < FunctionalTestCase
def test_new
login
get(:new)
assert_template("field_slips/qr_reader/new")
end
def test_create
login
code = "NEW-1234"
post(:create, params: { fiel... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/glossary_terms/versions_controller_test.rb | Ruby | mit | 84 | main | 940 | # frozen_string_literal: true
require("test_helper")
# tests of Versions controller
module GlossaryTerms
class VersionsControllerTest < FunctionalTestCase
ESSENTIAL_ATTRIBUTES = %w[name description].freeze
def test_show_past
term = glossary_terms(:square_glossary_term)
version = term.versions.f... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/glossary_terms/images_controller_test.rb | Ruby | mit | 84 | main | 4,168 | # frozen_string_literal: true
require("test_helper")
# tests of Images controller
module GlossaryTerms
class ImagesControllerTest < FunctionalTestCase
def test_reuse_image_page_access
glossary_term = glossary_terms(:conic_glossary_term)
params = { id: glossary_term.id }
requires_login(:reuse, ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/admin/banners_controller_test.rb | Ruby | mit | 84 | main | 802 | # frozen_string_literal: true
require("test_helper")
class Admin::BannersControllerTest < FunctionalTestCase
setup do
make_admin("admin")
end
def test_should_get_index
get(:index)
assert_response(:success)
assert_select("textarea", banners(:one).message)
end
def test_should_create_banner
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/admin/users_controller_test.rb | Ruby | mit | 84 | main | 1,321 | # frozen_string_literal: true
require("test_helper")
module Admin
class UsersControllerTest < FunctionalTestCase
def test_change_bonuses
user = users(:mary)
user_stats = user_stats(:mary)
old_contribution = mary.contribution
bonus = "7 lucky \n 13 unlucky"
# Prove that non-admin c... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/admin/donations_controller_test.rb | Ruby | mit | 84 | main | 1,376 | # frozen_string_literal: true
require("test_helper")
module Admin
class DonationsControllerTest < FunctionalTestCase
# NOTE: zeitwerk does not autoload the /tests directory
require_relative("../donations_controller_test_helpers")
include ::DonationsControllerTestHelpers
def test_new_donation
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/admin/blocked_ips_controller_test.rb | Ruby | mit | 84 | main | 8,008 | # frozen_string_literal: true
require("test_helper")
module Admin
class BlockedIpsControllerTest < FunctionalTestCase
def setup
super
# Ensure blocked_ips.txt exists (may not exist on CI)
FileUtils.touch(MO.blocked_ips_file)
FileUtils.touch(MO.okay_ips_file)
# Reset IpStats to ensu... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/admin/session_controller_test.rb | Ruby | mit | 84 | main | 3,035 | # frozen_string_literal: true
require("test_helper")
module Admin
class SessionControllerTest < FunctionalTestCase
def test_turn_admin_on_and_off
post(:create, params: { turn_on: true })
assert_false(session[:admin])
login(:rolf)
post(:create, params: { turn_on: true })
assert_fals... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/admin/emails/merge_requests_controller_test.rb | Ruby | mit | 84 | main | 4,707 | # frozen_string_literal: true
require("test_helper")
module Admin
module Emails
class MergeRequestsControllerTest < FunctionalTestCase
include ActiveJob::TestHelper
def test_email_merge_request
name1 = Name.all.sample
name2 = Name.all.sample
params = {
type: :Name,... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/admin/emails/webmaster_questions_controller_test.rb | Ruby | mit | 84 | main | 3,715 | # frozen_string_literal: true
require("test_helper")
module Admin
module Emails
class WebmasterQuestionsControllerTest < FunctionalTestCase
include ActiveJob::TestHelper
def test_page_loads
login
get(:new)
assert_template("admin/emails/webmaster_questions/new")
asser... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/admin/emails/name_change_requests_controller_test.rb | Ruby | mit | 84 | main | 3,853 | # frozen_string_literal: true
require("test_helper")
module Admin
module Emails
class NameChangeRequestsControllerTest < FunctionalTestCase
include ActiveJob::TestHelper
def test_email_name_change_request_not_logged_in
name = names(:lactarius)
params = {
name_id: name.id,
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/observations/locations_controller_test.rb | Ruby | mit | 84 | main | 2,276 | # frozen_string_literal: true
require("test_helper")
module Observations
class LocationsControllerTest < FunctionalTestCase
include ObjectLinkHelper
def test_define_location_options
albion = locations(:albion)
# Full match with "Albion, California, USA" should come first
requires_login(:... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/observations/species_lists_controller_test.rb | Ruby | mit | 84 | main | 7,120 | # frozen_string_literal: true
require("test_helper")
# :manage_species_lists
# NOTE: params changed from
# :species_list > :species_list_id
# :observation > :id
module Observations
class SpeciesListsControllerTest < FunctionalTestCase
def assigns_exist
!assigns(:other_lists).empty? || !assigns(:obs_l... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/observations/images_controller_test.rb | Ruby | mit | 84 | main | 9,936 | # frozen_string_literal: true
require("test_helper")
# tests of Images controller
module Observations
class ImagesControllerTest < FunctionalTestCase
def test_edit_image
image = images(:connected_coprinus_comatus_image)
params = { "id" => image.id.to_s }
assert(image.user.login == "rolf")
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/observations/maps_controller_test.rb | Ruby | mit | 84 | main | 5,907 | # frozen_string_literal: true
require("test_helper")
module Observations
class MapsControllerTest < FunctionalTestCase
def test_map_observations
login
get(:index)
assert_template(:index)
end
# Tests validation of nested params passed into Query
def test_map_obs_by_pattern_user_in_... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/observations/external_links_controller_test.rb | Ruby | mit | 84 | main | 7,875 | # frozen_string_literal: true
require("test_helper")
# This has to be a system test
module Observations
class ExternalLinksControllerTest < FunctionalTestCase
def test_new_external_link_form
obs = observations(:imported_inat_obs)
login(obs.user.login)
get(:new, params: { id: obs.id })
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/observations/search_controller_test.rb | Ruby | mit | 84 | main | 24,202 | # frozen_string_literal: true
require("test_helper")
# ------------------------------------------------------------
# Observation search
# ------------------------------------------------------------
module Observations
class SearchControllerTest < FunctionalTestCase
def test_show_help
login
get(:s... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/observations/identify_controller_test.rb | Ruby | mit | 84 | main | 4,523 | # frozen_string_literal: true
require("test_helper")
module Observations
class IdentifyControllerTest < FunctionalTestCase
# NOTE: This is more like an integration test, but we can't write one of
# those yet, without a JS runtime like Capybara
def test_identify_observations_index
login("mary")
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/observations/emails_controller_test.rb | Ruby | mit | 84 | main | 2,356 | # frozen_string_literal: true
require("test_helper")
module Observations
class EmailsControllerTest < FunctionalTestCase
include ActiveJob::TestHelper
def test_access_form
obs = observations(:coprinus_comatus_obs)
requires_login(:new, id: obs.id)
assert_form_action(action: :create, id: ob... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/observations/namings_controller_test.rb | Ruby | mit | 84 | main | 28,078 | # frozen_string_literal: true
require("test_helper")
module Observations
class NamingsControllerTest < FunctionalTestCase
def test_index
obs = observations(:coprinus_comatus_obs)
params = { observation_id: obs.id }
login(obs.user.login)
get(:index, params: params)
assert_no_flash(... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/observations/downloads_controller_test.rb | Ruby | mit | 84 | main | 11,717 | # frozen_string_literal: true
require("test_helper")
module Observations
class DownloadsControllerTest < FunctionalTestCase
def test_new
query = Query.lookup_and_save(:Observation, by_users: mary.id)
assert(query.num_results > 1, "Test needs query with multiple results")
login(:rolf)
ge... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/observations/namings/votes_controller_test.rb | Ruby | mit | 84 | main | 12,982 | # frozen_string_literal: true
require("test_helper")
# tests of Votes (Confidence levels) of Proposed Names
module Observations::Namings
class VotesControllerTest < FunctionalTestCase
# --------------------------------------------------------
# Test showing the votes for a naming of an obs (:index).
# ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/observations/namings/suggestions_controller_test.rb | Ruby | mit | 84 | main | 1,108 | # frozen_string_literal: true
require("test_helper")
module Observations::Namings
class SuggestionsControllerTest < FunctionalTestCase
def test_suggestions
obs = observations(:detailed_unknown_obs)
name1 = names(:coprinus_comatus)
name2a = names(:dup_name_author1)
name2b = names(:dup_nam... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/observations/images/uploads_controller_test.rb | Ruby | mit | 84 | main | 1,045 | # frozen_string_literal: true
module Observations::Images
class UploadsControllerTest < FunctionalTestCase
def test_upload_image
# Arrange
setup_image_dirs
login("dick")
file = Rack::Test::UploadedFile.new(
Rails.root.join("test/images/Coprinus_comatus.jpg").to_s, "image/jpeg"
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/images/transformations_controller_test.rb | Ruby | mit | 84 | main | 1,023 | # frozen_string_literal: true
require("test_helper")
# tests of Transformations controller
module Images
class TransformationsControllerTest < FunctionalTestCase
def test_transform_rotate_left
run_transform(opr: "rotate_left")
end
def test_transform_rotate_right
run_transform(opr: "rotate_r... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/images/originals_controller_test.rb | Ruby | mit | 84 | main | 5,628 | # frozen_string_literal: true
require("test_helper")
# Mock classes to simulate google cloud storage objects.
class MockStorage
def initialize
@buckets = {}
end
def bucket(name)
@buckets[name] ||= MockBucket.new
end
end
class MockBucket
def initialize
@files = {}
end
def file(path)
@f... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/images/votes_controller_test.rb | Ruby | mit | 84 | main | 2,638 | # frozen_string_literal: true
require("test_helper")
# tests of Transforms controller
module Images
class VotesControllerTest < FunctionalTestCase
def test_cast_vote
user = users(:mary)
image = images(:in_situ_image)
value = Image.maximum_vote
login(user.login)
assert_difference("... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/images/licenses_controller_test.rb | Ruby | mit | 84 | main | 3,789 | # frozen_string_literal: true
require("test_helper")
# tests of Images controller
module Images
class LicensesControllerTest < FunctionalTestCase
def test_edit_license_page_access
requires_login(:edit)
assert_form_action(action: :update)
assert_select(
"select[name='updates[1][new_id]... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/images/filenames_controller_test.rb | Ruby | mit | 84 | main | 445 | # frozen_string_literal: true
require("test_helper")
# tests of Images controller
module Images
class FilenamesControllerTest < FunctionalTestCase
def test_bulk_original_filename_purge
imgs = Image.where.not(original_name: "").where(user_id: rolf.id)
assert(imgs.any?)
login("rolf")
put(... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/images/exports_controller_test.rb | Ruby | mit | 84 | main | 711 | # frozen_string_literal: true
require("test_helper")
# tests of Images controller
module Images
class ExportsControllerTest < FunctionalTestCase
def test_export_image
img = images(:in_situ_image)
assert_true(img.ok_for_export) # (default)
put(:update, params: { id: img.id, value: 0 })
a... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/images/emails_controller_test.rb | Ruby | mit | 84 | main | 1,807 | # frozen_string_literal: true
require("test_helper")
module Images
class EmailsControllerTest < FunctionalTestCase
include ActiveJob::TestHelper
def test_try_commercial_inquiry
id = images(:in_situ_image).id
requires_login(:new, id: id)
assert_form_action(action: :create, id: id)
#... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/images/exif_controller_test.rb | Ruby | mit | 84 | main | 1,396 | # frozen_string_literal: true
require("test_helper")
# tests of Images controller
module Images
class EXIFControllerTest < FunctionalTestCase
def test_exif_gps_hidden
image = images(:in_situ_image)
image.update_attribute(:transferred, false)
fixture = "#{MO.root}/test/images/geotagged.jpg"
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/images/votes/anonymity_controller_test.rb | Ruby | mit | 84 | main | 1,285 | # frozen_string_literal: true
require("test_helper")
# tests of Images controller
module Images::Votes
class AnonymityControllerTest < FunctionalTestCase
# Test setting all image votes to public.
def test_bulk_image_vote_anonymity_thingy
img1 = images(:in_situ_image)
img2 = images(:commercial_in... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/descriptions/authors_controller_test.rb | Ruby | mit | 84 | main | 3,065 | # frozen_string_literal: true
require("test_helper")
module Descriptions
# test of actions to manage who's a author of a description
class AuthorsControllerTest < FunctionalTestCase
def test_review_locations
desc = location_descriptions(:albion_desc)
params = { id: desc.id, type: "LocationDescript... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/descriptions/author_requests_controller_test.rb | Ruby | mit | 84 | main | 1,935 | # frozen_string_literal: true
require("test_helper")
module Descriptions
# test of actions to request being a author of a description
class AuthorRequestsControllerTest < FunctionalTestCase
include ActiveJob::TestHelper
def test_new
id = name_descriptions(:coprinus_comatus_desc).id
requires_l... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/projects/aliases_controller_test.rb | Ruby | mit | 84 | main | 6,868 | # frozen_string_literal: true
require("test_helper")
module Projects
class AliasesControllerTest < FunctionalTestCase
setup do
@controller = Projects::AliasesController.new
@project = projects(:eol_project)
@project_alias = project_aliases(:one)
@user = users(:rolf)
login
end
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/projects/target_names_controller_test.rb | Ruby | mit | 84 | main | 4,114 | # frozen_string_literal: true
require("test_helper")
module Projects
class TargetNamesControllerTest < FunctionalTestCase
def test_create_single_name_as_admin
project = projects(:rare_fungi_project)
name = names(:peltigera)
login("rolf")
assert_not_includes(project.target_names, name)
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/projects/target_locations_controller_test.rb | Ruby | mit | 84 | main | 3,563 | # frozen_string_literal: true
require("test_helper")
module Projects
class TargetLocationsControllerTest < FunctionalTestCase
def test_create_single_location_as_admin
project = projects(:rare_fungi_project)
location = locations(:albion)
login("rolf")
assert_not_includes(project.target_l... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/projects/members_controller_test.rb | Ruby | mit | 84 | main | 19,309 | # frozen_string_literal: true
require("test_helper")
module Projects
class MembersControllerTest < FunctionalTestCase
##### Helpers (which also assert) ##########################################
def change_member_status_helper(changer, target_user, commit, admin_before,
u... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/projects/updates_controller_test.rb | Ruby | mit | 84 | main | 5,076 | # frozen_string_literal: true
require("test_helper")
module Projects
class UpdatesControllerTest < FunctionalTestCase
def setup
super
@project = projects(:rare_fungi_project)
# An observation matching a target name AND target location
@matching_obs = observations(:agaricus_campestris_obs... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/projects/search_controller_test.rb | Ruby | mit | 84 | main | 1,632 | # frozen_string_literal: true
require("test_helper")
# ------------------------------------------------------------
# Projects search
# ------------------------------------------------------------
module Projects
class SearchControllerTest < FunctionalTestCase
def test_new_projects_search
login
get... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/projects/locations_controller_test.rb | Ruby | mit | 84 | main | 2,522 | # frozen_string_literal: true
require("test_helper")
module Projects
class LocationsControllerTest < FunctionalTestCase
def test_index
eol_project = projects(:eol_project)
login
get(:index, params: { project_id: eol_project.id })
loc = eol_project.locations.first
assert_match(loc.... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/projects/violations_controller_test.rb | Ruby | mit | 84 | main | 8,104 | # frozen_string_literal: true
require("test_helper")
# test functions and view contents of ProjectsViolationsController
module Projects
class ViolationsControllerTest < FunctionalTestCase
def test_index_by_owner
project = projects(:falmouth_2023_09_project)
violations = project.violations
viol... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/projects/field_slips_controller_test.rb | Ruby | mit | 84 | main | 2,674 | # frozen_string_literal: true
require("test_helper")
module Projects
class FieldSlipsControllerTest < FunctionalTestCase
include ActiveJob::TestHelper
def test_new
FieldSlipJobTracker.find_by(status: "Done")
project = projects(:eol_project)
params = {
project_id: project.id
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/projects/admin_requests_controller_test.rb | Ruby | mit | 84 | main | 1,111 | # frozen_string_literal: true
require("test_helper")
module Projects
class AdminRequestsControllerTest < FunctionalTestCase
def test_post_admin_request
eol_project = projects(:eol_project)
params = {
project_id: eol_project.id,
email: {
subject: "Admin request subject",
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/species_lists/uploads_controller_test.rb | Ruby | mit | 84 | main | 2,723 | # frozen_string_literal: true
require("test_helper")
module SpeciesLists
class UploadsControllerTest < FunctionalTestCase
# ----------------------------
# Upload files that get parsed as species_lists.
# ----------------------------
def test_upload_species_list
spl = species_lists(:first_spe... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/species_lists/projects_controller_test.rb | Ruby | mit | 84 | main | 9,362 | # frozen_string_literal: true
require("test_helper")
module SpeciesLists
class ProjectsControllerTest < FunctionalTestCase
# ----------------------------
# Project Manager.
# ----------------------------
def test_manage_projects_permission
list = species_lists(:unknown_species_list)
#... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/species_lists/name_lists_controller_test.rb | Ruby | mit | 84 | main | 1,850 | # frozen_string_literal: true
require("test_helper")
module SpeciesLists
class NameListsControllerTest < FunctionalTestCase
# ----------------------------
# Name lister and reports.
# ----------------------------
def test_name_lister
# This will have to be very rudimentary, since the vast ma... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/species_lists/observations_controller_test.rb | Ruby | mit | 84 | main | 4,804 | # frozen_string_literal: true
require("test_helper")
module SpeciesLists
class ObservationsControllerTest < FunctionalTestCase
def test_add_remove_observations
query = Query.lookup(:Observation, by_users: users(:mary))
assert(query.num_results > 1)
params = { q: @controller.q_param(query) }
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/species_lists/search_controller_test.rb | Ruby | mit | 84 | main | 1,856 | # frozen_string_literal: true
require("test_helper")
# ------------------------------------------------------------
# SpeciesLists search
# ------------------------------------------------------------
module SpeciesLists
class SearchControllerTest < FunctionalTestCase
def test_new_species_lists_search
lo... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/species_lists/downloads_controller_test.rb | Ruby | mit | 84 | main | 2,605 | # frozen_string_literal: true
require("test_helper")
module SpeciesLists
class DownloadsControllerTest < FunctionalTestCase
def test_make_report
login
now = Time.zone.now
User.current = rolf
tapinella = Name.create(
author: "(Batsch) Šutara",
text_name: "Tapinella atroto... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/species_lists/write_in_controller_test.rb | Ruby | mit | 84 | main | 20,507 | # frozen_string_literal: true
require("test_helper")
module SpeciesLists
class WriteInControllerTest < FunctionalTestCase
def test_create_species_list_member_notes_areas
# Prove that only member_notes textarea is Other
# for user without notes template
user = users(:rolf)
login(user.logi... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/visual_groups/images_controller_test.rb | Ruby | mit | 84 | main | 1,366 | # frozen_string_literal: true
require("test_helper")
module VisualGroups
class ImagesControllerTest < FunctionalTestCase
def test_visual_group_flip_status
login
visual_group = visual_groups(:visual_group_one)
image = images(:agaricus_campestris_image)
vgi = visual_group.visual_group_imag... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/controllers/inat_imports/job_trackers_controller_test.rb | Ruby | mit | 84 | main | 1,751 | # frozen_string_literal: true
require("test_helper")
module InatImports
class JobTrackersControllerTest < FunctionalTestCase
include ActionView::Helpers::SanitizeHelper
def test_show_unstarted
import = inat_imports(:rolf_inat_import)
tracker = InatImportJobTracker.create(inat_import: import.id)... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/helpers/names_helper_test.rb | Ruby | mit | 84 | main | 4,640 | # frozen_string_literal: true
require("test_helper")
# test the helpers for ObservationsController
class NamesHelperTest < ActionView::TestCase
# Prove that the Query's used under "Observations of" (in the
# show_name_info area) return the correct Observations
include NamesHelper # Query's are in that helper
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/helpers/namings_helper_test.rb | Ruby | mit | 84 | main | 4,145 | # frozen_string_literal: true
require("test_helper")
# Tests for NamingsHelper occurrence-related methods
class NamingsHelperTest < ActionView::TestCase
include NamingsHelper
include ObjectLinkHelper
def setup
@obs1 = observations(:minimal_unknown_obs)
@obs2 = observations(:detailed_unknown_obs)
@o... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/helpers/application_helper_test.rb | Ruby | mit | 84 | main | 2,380 | # frozen_string_literal: true
require("test_helper")
# test the application-wide helpers
class ApplicationHelperTest < ActionView::TestCase
def test_add_args_to_url_two_args
assert_equal("/abcdef?foo=bar&this=that",
add_args_to_url("/abcdef", foo: "bar", this: "that"))
end
def test_add_arg... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/helpers/map_helper_test.rb | Ruby | mit | 84 | main | 2,988 | # frozen_string_literal: true
require("test_helper")
# Covers the small, branch-heavy helpers `MapHelper` exposes to
# the clustered-collection code path (issue #4159). Fuller coverage
# of `make_map` and its ERB consumers lives in the map_controller
# and view-level tests.
class MapHelperTest < ActionView::TestCase
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/helpers/forms_helper_test.rb | Ruby | mit | 84 | main | 1,234 | # frozen_string_literal: true
require("test_helper")
# Test form helpers
class FormsHelperTest < ActionView::TestCase
def test_file_field_with_label_has_accept_attribute
# Create a minimal form builder for testing
form = ActionView::Helpers::FormBuilder.new(
:upload, nil, self, {}
)
html = fi... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/helpers/object_link_helper_test.rb | Ruby | mit | 84 | main | 2,267 | # frozen_string_literal: true
require("test_helper")
# test helper for links in views
class ObjectLinkHelperTest < ActionView::TestCase
def test_name_link
name = names(:suillus)
path = name_path(name.id)
html_class = "name_link_#{name.id}"
link_text = "#{:NAME.l} ##{name.id}"
assert_equal(expec... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/helpers/table_helper_test.rb | Ruby | mit | 84 | main | 2,353 | # frozen_string_literal: true
require("test_helper")
# test the table helpers.
class TableHelperTest < ActionView::TestCase
include ContentHelper
def test_make_table
expect = "<table class=\"table\">" \
"<tr><td>1</td><td>2</td></tr>" \
"<tr><td>3</td><td>4</td></tr>" \
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/helpers/map_popup_helper_test.rb | Ruby | mit | 84 | main | 1,654 | # frozen_string_literal: true
require("test_helper")
# Coverage for `MapPopupHelper#mapset_observation_label` fallbacks
# (#4159). `display_name` is the preferred label; these tests exercise
# the `text_name` wrap branch and the final "Observation #<id>"
# fallback when neither is available.
class MapPopupHelperTest ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/helpers/content_helper_test.rb | Ruby | mit | 84 | main | 355 | # frozen_string_literal: true
require("test_helper")
# test the content helpers
module ContentHelperTest
def test_escape_textiled_string
textile = "**Bold**"
escaped = "<div class="textile"><p><b>Bold" \
"</b></p></div>"
assert_equal(escaped, e... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/helpers/inat_import_job_trackers_helper_test.rb | Ruby | mit | 84 | main | 421 | # frozen_string_literal: true
require("test_helper")
# test the helpers for InatImportJobTracker
class InatImportJobTrackersHelperTest < ActionView::TestCase
def test_time_in_hours_minutes_seconds
tracker = inat_import_job_trackers(:ollie_tracker)
assert_equal("Done", tracker.status, "Test needs fixture tha... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/helpers/observations_helper_test.rb | Ruby | mit | 84 | main | 1,569 | # frozen_string_literal: true
require("test_helper")
# test the helpers for ObservationsController
class ObservationsHelperTest < ActionView::TestCase
def test_show_observation_name
user = users(:rolf)
location = locations(:albion)
# approved name
current_name = names(:lactarius_alpinus)
Observ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/helpers/observations/sibling_records_helper_test.rb | Ruby | mit | 84 | main | 3,337 | # frozen_string_literal: true
require("test_helper")
# Tests for Observations::SiblingRecordsHelper
class SiblingRecordsHelperTest < ActionView::TestCase
include Observations::SiblingRecordsHelper
def test_sibling_collection_numbers_with_records
cn = collection_numbers(:coprinus_comatus_coll_num)
sibling... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/helpers/header/context_nav_helper_test.rb | Ruby | mit | 84 | main | 2,150 | # frozen_string_literal: true
require("test_helper")
# test the application-wide helpers
module Header
class ContextNavHelperTest < ActionView::TestCase
include LinkHelper
# Test that add_context_nav handles nil links gracefully
def test_add_context_nav_with_nil_links
# This should not raise an e... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/helpers/header/title_helper_test.rb | Ruby | mit | 84 | main | 660 | # frozen_string_literal: true
require("test_helper")
# test the application-wide helpers
module Header
class TitleHelperTest < ActionView::TestCase
include LinkHelper
def test_title_tag_contents
# Prove that if title is present, <title> contents are @title
title = "title present"
action_n... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/helpers/tabs/publications_helper_test.rb | Ruby | mit | 84 | main | 1,454 | # frozen_string_literal: true
require("test_helper")
module Tabs
class PublicationsHelperTest < ActionView::TestCase
include Tabs::PublicationsHelper
# Regression test for bug where Actions menu displayed "Add [TYPE]"
# instead of "Add Publication" when type parameter wasn't passed correctly
def te... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/jobs/inat_import_recovery_job_test.rb | Ruby | mit | 84 | main | 1,338 | # frozen_string_literal: true
require("test_helper")
class InatImportRecoveryJobTest < ActiveJob::TestCase
def test_marks_stuck_import_as_done
import = inat_imports(:katrina_inat_import)
import.update_column(:updated_at,
InatImport::STUCK_THRESHOLD.ago - 1.second)
InatImportRec... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/jobs/field_slip_job_test.rb | Ruby | mit | 84 | main | 2,261 | # frozen_string_literal: true
require("test_helper")
class FieldSlipJobTest < ActiveJob::TestCase
include GeneralExtensions
def setup
super
# Use worker-specific directory for parallel testing
worker_suffix = database_worker_number ? "-#{database_worker_number}" : ""
@pdf_dir = "public/shared#{wo... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/jobs/inat_import_job_test.rb | Ruby | mit | 84 | main | 44,720 | # frozen_string_literal: true
require("test_helper")
require_relative("inat_import_job_test_doubles")
class InatImportJobTest < ActiveJob::TestCase
include GeneralExtensions
include InatImportJobTestDoubles
include Inat::Constants
def setup
super
@user = users(:inat_importer)
# Use worker-specifi... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/jobs/image_loader_job_test.rb | Ruby | mit | 84 | main | 2,002 | # frozen_string_literal: true
require("test_helper")
# Mock classes to simulate google cloud storage objects.
class MockStorage
def initialize
@buckets = {}
end
def bucket(name)
@buckets[name] ||= MockBucket.new
end
end
class MockBucket
def initialize
@files = {}
end
def file(path)
@f... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/jobs/mail_delivery_error_logging_test.rb | Ruby | mit | 84 | main | 2,471 | # frozen_string_literal: true
require("test_helper")
require("net/smtp")
class MailDeliveryErrorLoggingTest < ActiveJob::TestCase
def setup
super
@log_path = Rails.root.join("log/email-debug.log")
@log_offset = File.exist?(@log_path) ? File.size(@log_path) : 0
end
def test_mail_delivery_failure_log... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/jobs/discard_stale_jobs_job_test.rb | Ruby | mit | 84 | main | 537 | # frozen_string_literal: true
require("test_helper")
class DiscardStaleJobsJobTest < ActiveJob::TestCase
def test_discarding_failed_jobs
assert_difference(
"SolidQueue::FailedExecution.count", -1,
"Should remove 1 entry from FailedExecutions"
) do
DiscardStaleJobsJob.perform_now
end
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/jobs/inat_import_job_test_doubles.rb | Ruby | mit | 84 | main | 4,039 | # frozen_string_literal: true
require_relative("../support/inat_stub_helpers")
module InatImportJobTestDoubles
include Inat::Constants
include InatStubHelpers
def stub_inat_interactions(
id_above: 0,
login: @inat_import.inat_username
)
stub_token_requests
stub_check_username_match(login)
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/jobs/update_box_area_and_center_columns_job_test.rb | Ruby | mit | 84 | main | 1,066 | # frozen_string_literal: true
require("test_helper")
class UpdateBoxAreaAndCenterColumnsJobTest < ActiveJob::TestCase
def test_update_box_area_and_center_columns
# Check that we have some obs that need updating
assert_not_empty(Observation.in_box_of_max_area.where(location_lat: nil))
job = UpdateBoxAre... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/inat_page_parser_test.rb | Ruby | mit | 84 | main | 264 | # frozen_string_literal: true
require("test_helper")
class InatPageParserTest < UnitTestCase
def test_inat_username_required
import = inat_imports(:ollie_inat_import)
assert_raises(ArgumentError) do
Inat::PageParser.new(import)
end
end
end |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/site_data_test.rb | Ruby | mit | 84 | main | 953 | # frozen_string_literal: true
require("test_helper")
class SiteDataTest < UnitTestCase
def test_site_data
# Create unverified user so that counts of users, verfied users,
# and contributing users are different
unverified_user = User.create(
login: "mkcwqwv",
email: "anastasiyaskakun93@ramble... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/pagination_data_test.rb | Ruby | mit | 84 | main | 4,200 | # frozen_string_literal: true
require("test_helper")
class PaginationDataTest < UnitTestCase
def test_basic
page_data = PaginationData.new
assert_nil(page_data.letter_arg)
assert_nil(page_data.number_arg)
assert_nil(page_data.page_arg)
assert_nil(page_data.letter)
assert_equal(1, page_dat... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/country_counter_test.rb | Ruby | mit | 84 | main | 1,298 | # frozen_string_literal: true
require("test_helper")
# test methods used to count Observations by country
class CountryCounterTest < UnitTestCase
def test_wheres
cc = CountryCounter.new
wheres = cc.send(:wheres)
assert(wheres)
assert(wheres.member?("Briceland, California, USA"))
end
def test_lo... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/lookup_test.rb | Ruby | mit | 84 | main | 7,466 | # frozen_string_literal: true
require("test_helper")
class LookupTest < UnitTestCase
def assert_lookup_objects(type, expects, vals, **)
lookup = "Lookup::#{type}".constantize
actual = lookup.new(vals, **).titles.sort
expects = expects.map(&:"#{lookup::TITLE_METHOD}").sort
assert_arrays_equal(expects... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/tree_test.rb | Ruby | mit | 84 | main | 2,448 | # frozen_string_literal: true
require("test_helper")
class TreeTest < UnitTestCase
def test_has_node?
tree = :foo
assert_true(tree.has_node?(:foo))
assert_false(tree.has_node?(:spam))
tree = [:foo, :bar]
assert_true(tree.has_node?(:foo))
assert_true(tree.has_node?(:bar))
assert_false(tr... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/autocomplete_for_region_test.rb | Ruby | mit | 84 | main | 3,613 | # frozen_string_literal: true
require "test_helper"
require "autocomplete"
class AutocompleteForRegionTest < UnitTestCase
def create_location(name:, north:, south:, east:, west:)
Location.create!(
name: name,
north: north,
south: south,
east: east,
west: west,
user: users(:ro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.