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/classes/autocomplete_test.rb | Ruby | mit | 84 | main | 7,546 | # frozen_string_literal: true
require("test_helper")
require("autocomplete")
# These empty classes and methods are required for the test to work.
# rubocop:disable Lint/UselessMethodDefinition
class AutocompleteMock < Autocomplete::ByString
attr_accessor :rough_matches, :limit
def truncate_matches
super
e... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/box_test.rb | Ruby | mit | 84 | main | 2,191 | # frozen_string_literal: true
require("test_helper")
class BoxTest < UnitTestCase
def valid_args
{ north: 10, south: -10, east: 10, west: -10 }
end
def test_valid
assert(Mappable::Box.new(**valid_args).valid?)
assert(Mappable::Box.new(**valid_args, east: -10, west: 10).
valid?)
# Bo... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/user_management_service_test.rb | Ruby | mit | 84 | main | 7,978 | # frozen_string_literal: true
require("test_helper")
class UserManagementServiceTest < UnitTestCase
def test_verified_login?
user = users(:mary)
fake_input = StringIO.new("#{user.login}\n")
original_stdin = $stdin
begin
$stdin = fake_input
log_contents = with_captured_logger do
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/inat_license_test.rb | Ruby | mit | 84 | main | 1,012 | # frozen_string_literal: true
require("test_helper")
# test mapping iNat license_code to MO license_id
# https://github.com/inaturalist/inaturalist/blob/main/app/models/shared/license_module.rb
class InatLicenseTest < UnitTestCase
def test_inat_cc_license
assert_equal(licenses(:ccnc30), Inat::License.new("cc-by... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/pattern_search_test.rb | Ruby | mit | 84 | main | 22,865 | # frozen_string_literal: true
require("test_helper")
class PatternSearchTest < UnitTestCase
def test_parse_next_term
parser = PatternSearch::Parser.new("")
# make str mutable because it is modified by parse_next_term
str = + 'test name:blah two:1,2,3 foo:"quote" bar:\'a\',"b" slash:\\,,"\\""'
assert... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/integer_extensions_test.rb | Ruby | mit | 84 | main | 548 | # frozen_string_literal: true
require("test_helper")
# Test MO extensions to Ruby Integer class
class IntegerExtensionsTest < UnitTestCase
def test_convert_decimal_to_base62
assert_equal("0", 0.alphabetize)
assert_equal("g", 42.alphabetize)
assert_equal("8M0kX", 123_456_789.alphabetize)
end
def tes... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/report_test.rb | Ruby | mit | 84 | main | 37,896 | # frozen_string_literal: true
require("test_helper")
class ReportTest < UnitTestCase
LAT_INDEX = 19
LONG_INDEX = 20
def test_adolf
obs = observations(:agaricus_campestris_obs)
expect = [
nil,
nil,
nil,
"Agaricus",
nil,
"campestris",
"L.",
nil,
nil,
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/eol_data_test.rb | Ruby | mit | 84 | main | 1,725 | # frozen_string_literal: true
require("test_helper")
class EolDataTest < UnitTestCase
def name_test(obj, name)
name_id = name.id
assert(obj.has_images?(name_id))
assert_equal(Array, obj.images(name_id).class)
assert(obj.image_count(name_id).positive?,
"Expected #{name.text_name} image cou... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/observation_labels_test.rb | Ruby | mit | 84 | main | 535 | # frozen_string_literal: true
require("test_helper")
require "prawn/measurement_extensions"
class ObservationLabelsTest < UnitTestCase
def test_error_case
new_root = Pathname.new("/tmp/fake_rails_root")
Rails.stub(:root, new_root) do
log_contents = with_captured_logger do
obs = Observation.fir... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/image_script_test.rb | Ruby | mit | 84 | main | 17,464 | # frozen_string_literal: true
require("test_helper")
class ImageScriptTest < UnitTestCase
DATABASE_CONFIG = YAML.safe_load(
Rails.root.join("config/database.yml").read
)["test"]
def script_file(cmd)
Rails.root.join("script/#{cmd}").to_s
end
def local_root
# Use worker-specific paths for parall... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/parallel_test_config_service_test.rb | Ruby | mit | 84 | main | 9,066 | # frozen_string_literal: true
require("test_helper")
class ParallelTestConfigServiceTest < UnitTestCase
def setup
@output = StringIO.new
@output_handler = MockOutputHandler.new(@output)
@temp_dir = Dir.mktmpdir
@rails_root = Pathname.new(@temp_dir)
@service = ParallelTestConfigService.new(
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/hash_extensions_test.rb | Ruby | mit | 84 | main | 741 | # frozen_string_literal: true
require("test_helper")
# test MO extensions to Ruby's Hash class
class HashExtensionsTest < UnitTestCase
def test_flatten
assert_equal({ id: 5, q: 123 },
{ id: 5, params: { q: 123 } }.flatten)
assert_equal({}, {}.flatten)
end
def test_remove_nils!
h = ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/fixtures_test.rb | Ruby | mit | 84 | main | 509 | # frozen_string_literal: true
require("test_helper")
class FixturesTest < ActiveSupport::TestCase
def test_observations_all_have_rss_logs
Observation.find_each do |obs|
name = ActiveRecord::FixtureSet.reverse_lookup(:observations, obs.id)
assert_not_nil(
obs.rss_log_id,
"Observation ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/robots_test.rb | Ruby | mit | 84 | main | 405 | # frozen_string_literal: true
require("test_helper")
class RobotsTest < UnitTestCase
def test_robots_dot_text
file = MO.robots_dot_text_file
data = Robots.parse_robots_dot_text(file)
assert_equal(["glossary/show_term", "info/intro"], data.keys.sort)
assert_true(data["glossary/show_term"])
assert... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/ip_stats_test.rb | Ruby | mit | 84 | main | 5,460 | # frozen_string_literal: true
require("test_helper")
require("fileutils")
class IpStatsTest < UnitTestCase
def setup
super
fixture_path = Rails.root.join("test/fixtures")
setup_file(MO.blocked_ips_file, "#{fixture_path}/blocked_ips.txt")
setup_file(MO.okay_ips_file, "#{fixture_path}/okay_ips.txt")
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query_test.rb | Ruby | mit | 84 | main | 24,446 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
class QueryTest < UnitTestCase
include QueryExtensions
##############################################################################
def test_basic
assert_raises(NameError) { Query.lookup(:BogusModel) }
# All queries ass... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/map_set_test.rb | Ruby | mit | 84 | main | 7,201 | # frozen_string_literal: true
require("test_helper")
class MapSetTest < UnitTestCase
# ------------------------------------------------------------------
# #compute_color — issue #4159 (was #4131)
# ------------------------------------------------------------------
# Location-only sets have no observations t... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/string_extensions_test.rb | Ruby | mit | 84 | main | 3,477 | # frozen_string_literal: true
require("test_helper")
# test extensions to Ruby and Rails String Class
class StringExtensionsTest < UnitTestCase
def test_dealphabetize
# convert_base62_to_decimal
assert_equal(0, "0".dealphabetize)
assert_equal(42, "g".dealphabetize)
assert_equal(123_456_789, "8M0kX".... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/search_field_ui_test.rb | Ruby | mit | 84 | main | 5,796 | # frozen_string_literal: true
require("test_helper")
class SearchFieldUITest < UnitTestCase
# Mock controller for Observations search
class MockObservationsController
def self.name
"Observations::SearchController"
end
def permitted_search_params
[
:date,
:has_name,
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/textile_test.rb | Ruby | mit | 84 | main | 11,367 | # frozen_string_literal: true
require("test_helper")
require("textile")
class Textile
def send_private(method, ...)
send(method, ...)
end
end
class TextileTest < UnitTestCase
EXPLICIT_OBJECT_MARKUP = [
"_observation 123_", # lower case explicit tag
"_term bar code_",
"_Term gill_", # non-lower ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/inat_obs_photo_test.rb | Ruby | mit | 84 | main | 1,272 | # frozen_string_literal: true
require("test_helper")
# test mapping of iNat observation photo key/values to MO Image attributes
class InatObsPhotoTest < UnitTestCase
def test_simple_photo
mock_search = File.read("test/inat/tremella_mesenterica.txt")
inat_obs = Inat::Obs.new(
JSON.generate(JSON.parse(m... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/array_extensions_test.rb | Ruby | mit | 84 | main | 790 | # frozen_string_literal: true
require("test_helper")
# test MO extensions to Ruby's Array class
class ArrayExtensionsTest < UnitTestCase
def test_to_boolean_hash
assert_equal({}, [].to_boolean_hash)
assert_equal({ "a" => true, "b" => true, "c" => true },
%w[a b c].to_boolean_hash)
end
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/inat_taxon_test.rb | Ruby | mit | 84 | main | 7,266 | # frozen_string_literal: true
require("test_helper")
# test encapsulated imported iNat observations
class InatTaxonTest < UnitTestCase
include InatStubHelpers
def test_maps_inat_species_to_mo_species
mock_inat_obs = mock_observation("somion_unicolor")
inat_taxon = Inat::Taxon.new(mock_inat_obs[:taxon])
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/language_exporter_test.rb | Ruby | mit | 84 | main | 15,421 | # frozen_string_literal: true
require("test_helper")
class LanguageExporterTest < UnitTestCase
attr_accessor :tmp_dir
def setup
@official = Language.official
Language.clear_verbose_messages
Language.override_input_files
self.tmp_dir = Rails.root.join("tmp")
FileUtils.mkdir_p(tmp_dir)
supe... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/script_test.rb | Ruby | mit | 84 | main | 4,382 | # frozen_string_literal: true
require("test_helper")
class ScriptTest < UnitTestCase
include GeneralExtensions
def script_file(cmd)
Rails.root.join("script/#{cmd}").to_s
end
# Environment for running scripts with worker-specific database config
def script_env
worker_num = database_worker_number
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/config_test.rb | Ruby | mit | 84 | main | 250 | # frozen_string_literal: true
require("test_helper")
# A place to put tests related to the overall RoR configuration
class ConfigTest < UnitTestCase
def test_secrets
assert_equal("magic", Rails.application.credentials.test_secret)
end
end |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/time_extensions_test.rb | Ruby | mit | 84 | main | 1,530 | # frozen_string_literal: true
require("test_helper")
# MO time extensions wrap Date, DateTime, and Time
# So test need to use those Classes in ways which offend RuboCop
# test public interface of a class which includes date
module DateExtensionsInterfaceTest
def test_responds_to_api_date
assert_respond_to(@obje... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/symbol_extensions_test.rb | Ruby | mit | 84 | main | 4,181 | # frozen_string_literal: true
require("test_helper")
class SymbolExtensionsTest < UnitTestCase
def test_localize_postprocessing
Symbol.raise_errors
assert_equal("", Symbol.test_localize(""))
assert_equal("blah", Symbol.test_localize("blah"))
assert_equal("one\n\ntwo", Symbol.te... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/inat_observation_importer_test.rb | Ruby | mit | 84 | main | 659 | # frozen_string_literal: true
require("test_helper")
class InatObservationImporterTest < UnitTestCase
def test_canceled
import = inat_imports(:ollie_inat_import)
assert(import.canceled?, "Test needs a canceled InatImport fixture")
user = import.user
mock_inat_response = File.read("test/inat/calostom... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/inat_obs_test.rb | Ruby | mit | 84 | main | 15,661 | # frozen_string_literal: true
require("test_helper")
# test encapsulated imported iNat observations
class InatObsTest < UnitTestCase
include Inat::Constants
include InatStubHelpers
# disable cop to facilitate typing/reading id's
# rubocop:disable Style/NumericLiterals
def test_complicated_public_obs
# ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/object_extensions_test.rb | Ruby | mit | 84 | main | 580 | # frozen_string_literal: true
require("test_helper")
# test MO extensions to Ruby's Object class
class ObjectExtensionsTest < UnitTestCase
def test_stacktrace_removes_caller
# Reflect on this test method's name (in case someone chooses to rename it).
caller = __method__.to_s
assert_not(_stacktrace.first... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/collapsible_map_test.rb | Ruby | mit | 84 | main | 19,847 | # frozen_string_literal: true
require("test_helper")
class BigDecimal
# Make this class dump out easier-to-read diagnostics when tests fail.
def inspect
str = format("%f", self)
str.sub(/0+$/, ""). # remove trailing zeros
sub(/\.$/, "")
end
end
class CollapsibleMapTest < UnitTestCase
def assert... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/localization_files_test.rb | Ruby | mit | 84 | main | 7,384 | # frozen_string_literal: true
require("test_helper")
class LocalizationFilesTest < UnitTestCase
def assert_no_missing_translations(tags, type)
missing = tags.uniq.reject(&:has_translation?)
msg = "Missing #{type} translations:\n" \
"#{missing.map(&:inspect).sort.join("\n")}\n"
assert_empty(mis... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2_test.rb | Ruby | mit | 84 | main | 29,214 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2Test < UnitTestCase
include API2Extensions
# --------------------
# :section: Parsers
# --------------------
def test_parse_boolean
assert_parse(:boolean, nil, nil)
assert_parse(:boolean, true, nil, default:... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/pattern_search/observation_test.rb | Ruby | mit | 84 | main | 13,208 | # frozen_string_literal: true
require("test_helper")
class PatternSearch::ObservationTest < UnitTestCase
def test_observation_search_name_hack
# "Turkey" is not a name, and no taxa modifiers present, so no reason to
# suspect that this is a name query. Should leave it completely alone.
x = PatternSearc... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/pattern_search/name_test.rb | Ruby | mit | 84 | main | 7,920 | # frozen_string_literal: true
require("test_helper")
class PatternSearch::NameTest < UnitTestCase
def test_name_search_created
expect = Name.with_correct_spelling.where(Name[:created_at].year.eq(2010))
assert_not_empty(expect)
x = PatternSearch::Name.new("created:2010")
assert_name_arrays_equal(expe... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/inat/page_parser_test.rb | Ruby | mit | 84 | main | 961 | # frozen_string_literal: true
require("test_helper")
class Inat
class PageParserTest < UnitTestCase
def test_raises_if_not_own_import_has_no_username_or_ids
import = inat_imports(:dick_inat_import).tap do |i|
i.import_others = true
i.inat_username = ""
i.inat_ids = ""
end
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/inat/sequence_field_detector_test.rb | Ruby | mit | 84 | main | 3,660 | # frozen_string_literal: true
require("test_helper")
class Inat
class SequenceFieldDetectorTest < UnitTestCase
def test_sequence_field_detects_dna_datatype
field = { datatype: "dna", name: "ITS", value: "ACGTACGTACGT" }
assert(SequenceFieldDetector.sequence_field?(field))
end
def test_sequ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/comments_test.rb | Ruby | mit | 84 | main | 3,776 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2::CommentsTest < UnitTestCase
include API2Extensions
def test_basic_comment_get
do_basic_get_test(Comment)
end
# -----------------------------
# :section: Comment Requests
# -----------------------------
de... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/namings_test.rb | Ruby | mit | 84 | main | 227 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
# Test naming API
# See https://www.pivotaltracker.com/story/show/174886715
class API2::NamingsTest < UnitTestCase
include API2Extensions
end |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/occurrences_test.rb | Ruby | mit | 84 | main | 11,978 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
require("builder")
class API2::OccurrencesTest < UnitTestCase
include API2Extensions
def setup
super
@obs1 = observations(:detailed_unknown_obs)
@obs2 = observations(:amateur_obs)
@obs3 = observations(:coprinus_comatu... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/image_votes_test.rb | Ruby | mit | 84 | main | 234 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
# Test image_vote API
# See https://www.pivotaltracker.com/story/show/174886806
class API2::ImageVotesTest < UnitTestCase
include API2Extensions
end |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/locations_test.rb | Ruby | mit | 84 | main | 7,305 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2::LocationsTest < UnitTestCase
include API2Extensions
def test_basic_location_get
do_basic_get_test(Location)
end
# ------------------------------
# :section: Location Requests
# ------------------------------... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/location_descriptions_test.rb | Ruby | mit | 84 | main | 269 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2::LocationDescriptionsTest < UnitTestCase
include API2Extensions
def test_basic_location_description_get
do_basic_get_test(LocationDescription, public: true)
end
end |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/sequences_test.rb | Ruby | mit | 84 | main | 14,824 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2::SequencesTest < UnitTestCase
include API2Extensions
def test_basic_sequence_get
do_basic_get_test(Sequence)
end
# ------------------------------
# :section: Sequence Requests
# ------------------------------... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/votes_test.rb | Ruby | mit | 84 | main | 223 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
# Test vote API
# See https://www.pivotaltracker.com/story/show/174886762
class API2::VotesTest < UnitTestCase
include API2Extensions
end |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/api_keys_test.rb | Ruby | mit | 84 | main | 4,733 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2::APIKeysTest < UnitTestCase
include API2Extensions
include ActiveJob::TestHelper
# ----------------------------
# :section: APIKey Requests
# ----------------------------
def test_page_length_methods
api = AP... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/herbarium_records_test.rb | Ruby | mit | 84 | main | 10,174 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2::HerbariumRecordsTest < UnitTestCase
include API2Extensions
def test_basic_herbarium_record_get
do_basic_get_test(HerbariumRecord)
end
# --------------------------------------
# :section: Herbarium Record Reque... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/species_lists_test.rb | Ruby | mit | 84 | main | 8,537 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2::SpeciesListsTest < UnitTestCase
include API2Extensions
# ---------------------------------
# :section: SpeciesList Requests
# ---------------------------------
def params_get(**)
{ method: :get, action: :speci... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/projects_test.rb | Ruby | mit | 84 | main | 7,520 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2::ProjectsTest < UnitTestCase
include API2Extensions
def test_basic_project_get
do_basic_get_test(Project)
end
# -----------------------------
# :section: Project Requests
# -----------------------------
de... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/herbaria_test.rb | Ruby | mit | 84 | main | 1,691 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2::HerbariaTest < UnitTestCase
include API2Extensions
def test_basic_herbarium_get
do_basic_get_test(Herbarium)
end
# -------------------------------
# :section: Herbarium Requests
# ---------------------------... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/name_descriptions_test.rb | Ruby | mit | 84 | main | 656 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2::NameDescriptionsTest < UnitTestCase
include API2Extensions
def test_basic_name_description_get
do_basic_get_test(NameDescription, public: true)
end
def params_get(**)
{ method: :get, action: :name_description... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/names_test.rb | Ruby | mit | 84 | main | 18,022 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2::NamesTest < UnitTestCase
include API2Extensions
def test_basic_name_get
do_basic_get_test(Name)
end
# --------------------------
# :section: Name Requests
# --------------------------
def params_get(**)
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/external_sites_test.rb | Ruby | mit | 84 | main | 637 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2::ExternalSitesTest < UnitTestCase
include API2Extensions
def test_basic_external_site_get
do_basic_get_test(ExternalSite)
end
# ----------------------------------
# :section: ExternalSite Requests
# ---------... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/users_test.rb | Ruby | mit | 84 | main | 5,206 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2::UsersTest < UnitTestCase
include API2Extensions
include ActiveJob::TestHelper
def test_basic_user_get
do_basic_get_test(User)
end
# --------------------------
# :section: User Requests
# ------------------... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/collection_numbers_test.rb | Ruby | mit | 84 | main | 6,127 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2::CollectionNumbersTest < UnitTestCase
include API2Extensions
def test_basic_collection_number_get
do_basic_get_test(CollectionNumber)
end
# ---------------------------------------
# :section: Collection Number ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/field_slips_test.rb | Ruby | mit | 84 | main | 5,674 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
require("builder")
class API2::FieldSlipsTest < UnitTestCase
include API2Extensions
def test_basic_field_slip_get
do_basic_get_test(FieldSlip)
end
# ---------------------------------------
# :section: Field Slip Requests
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/external_links_test.rb | Ruby | mit | 84 | main | 5,103 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2::ExternalLinksTest < UnitTestCase
include API2Extensions
def test_basic_external_link_get
do_basic_get_test(ExternalLink)
end
# ----------------------------------
# :section: ExternalLink Requests
# ---------... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/images_test.rb | Ruby | mit | 84 | main | 13,581 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2::ImagesTest < UnitTestCase
include API2Extensions
def test_basic_image_get
do_basic_get_test(Image)
end
# ---------------------------
# :section: Image Requests
# ---------------------------
def params_get... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/api2/observations_test.rb | Ruby | mit | 84 | main | 23,509 | # frozen_string_literal: true
require("test_helper")
require("api2_extensions")
class API2::ObservationsTest < UnitTestCase
include API2Extensions
def test_basic_observation_get
do_basic_get_test(Observation)
end
# ---------------------------------
# :section: Observation Requests
# ---------------... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/collection_numbers_test.rb | Ruby | mit | 84 | main | 5,188 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::CollectionNumbers class to be included in QueryTest
class Query::CollectionNumbersTest < UnitTestCase
include QueryExtensions
def test_collection_number_all
expects = CollectionNumber.order_by_default
asser... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/filters_test.rb | Ruby | mit | 84 | main | 4,151 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::Filter class
class Query::FiltersTest < UnitTestCase
include QueryExtensions
def test_filters
assert_equal(
[:has_images, :has_specimen, :has_occurrence, :lichen, :region, :clade],
Query::Filter.all... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/name_descriptions_test.rb | Ruby | mit | 84 | main | 5,546 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::NameDescriptions class to be included in QueryTest
class Query::NameDescriptionsTest < UnitTestCase
include QueryExtensions
def test_name_description_all
all_descs = NameDescription.order_by_default
all_pel... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/comments_test.rb | Ruby | mit | 84 | main | 3,726 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::Comments class to be included in QueryTest
class Query::CommentsTest < UnitTestCase
include QueryExtensions
def test_comment_all
expects = Comment.order_by_default
assert_query(expects, :Comment)
end
d... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/glossary_terms_test.rb | Ruby | mit | 84 | main | 1,672 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::GlossaryTerms class to be included in QueryTest
class Query::GlossaryTermsTest < UnitTestCase
include QueryExtensions
def test_glossary_term_all
expects = GlossaryTerm.order_by_default
assert_query(expects,... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/herbarium_records_test.rb | Ruby | mit | 84 | main | 5,179 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::HerbariumRecords class to be included in QueryTest
class Query::HerbariumRecordsTest < UnitTestCase
include QueryExtensions
def test_herbarium_record_all
expects = HerbariumRecord.order_by_default
assert_qu... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/external_sites_test.rb | Ruby | mit | 84 | main | 627 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::ExternalLinks class to be included in QueryTest
class Query::ExternalSitesTest < UnitTestCase
include QueryExtensions
def test_external_link_all
assert_query(ExternalSite.order_by_default, :ExternalSite)
end
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/observations_test.rb | Ruby | mit | 84 | main | 34,139 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::Observations class to be included in QueryTest
class Query::ObservationsTest < UnitTestCase
include QueryExtensions
def test_observation_all
expects = Observation.order_by_default
assert_query(expects, :Obs... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/rss_logs_test.rb | Ruby | mit | 84 | main | 4,054 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::RssLogs class to be included in QueryTest
class Query::RssLogsTest < UnitTestCase
include QueryExtensions
def test_rss_log_default_index
ids = RssLog.order_by_default
assert_query(ids, :RssLog)
end
def... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/external_links_test.rb | Ruby | mit | 84 | main | 2,100 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::ExternalLinks class to be included in QueryTest
class Query::ExternalLinksTest < UnitTestCase
include QueryExtensions
def test_external_link_all
assert_query(ExternalLink.order_by_default, :ExternalLink)
end
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/users_test.rb | Ruby | mit | 84 | main | 2,133 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::Users class to be included in QueryTest
class Query::UsersTest < UnitTestCase
include QueryExtensions
def test_user_all_by_name
expects = User.order_by(:name)
assert_query(expects, :User, order_by: :name)
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/herbaria_test.rb | Ruby | mit | 84 | main | 2,988 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::Herbaria class to be included in QueryTest
class Query::HerbariaTest < UnitTestCase
include QueryExtensions
def test_herbarium_all
expects = Herbarium.order_by_default
assert_query(expects, :Herbarium)
en... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/articles_test.rb | Ruby | mit | 84 | main | 1,403 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::Articles class to be included in QueryTest
class Query::ArticlesTest < UnitTestCase
include QueryExtensions
def test_article_all
expects = [articles(:premier_article), articles(:second_article)]
scope = Art... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/field_slips_test.rb | Ruby | mit | 84 | main | 1,339 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::FieldSlips class to be included in QueryTest
class Query::FieldSlipsTest < UnitTestCase
include QueryExtensions
def test_field_slip_all
expects = FieldSlip.order_by_default
assert_query(expects, :FieldSlip)... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/names_test.rb | Ruby | mit | 84 | main | 29,653 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::Names class to be included in QueryTest
class Query::NamesTest < UnitTestCase
include QueryExtensions
def test_name_all
# NOTE: misspellings are modified by `do_test_name_all`
# This saves looking up Name.o... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/projects_test.rb | Ruby | mit | 84 | main | 4,802 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::Projects class to be included in QueryTest
class Query::ProjectsTest < UnitTestCase
include QueryExtensions
def test_project_all
expects = Project.order_by_default
assert_query(expects, :Project)
end
d... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/api_keys_test.rb | Ruby | mit | 84 | main | 476 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::APIKeys class to be included in QueryTest
class Query::APIKeysTest < UnitTestCase
include QueryExtensions
def test_api_key_all
expects = APIKey.order_by_default
assert_query(expects, :APIKey)
end
def t... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/sequences_test.rb | Ruby | mit | 84 | main | 5,725 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::Sequences class to be included in QueryTest
class Query::SequencesTest < UnitTestCase
include QueryExtensions
def test_sequence_all
expects = Sequence.order_by_default
assert_query(expects, :Sequence)
end... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/images_test.rb | Ruby | mit | 84 | main | 18,885 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::Images class to be included in QueryTest
class Query::ImagesTest < UnitTestCase
include QueryExtensions
def test_image_all
expects = Image.order_by_default
assert_query(expects, :Image)
end
def test_im... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/locations_test.rb | Ruby | mit | 84 | main | 22,761 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::Locations class to be included in QueryTest
class Query::LocationsTest < UnitTestCase
include QueryExtensions
def test_location_all
expects = Location.order_by_default
assert_query(expects, :Location)
end... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/species_lists_test.rb | Ruby | mit | 84 | main | 5,705 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::SpeciesLists class to be included in QueryTest
class Query::SpeciesListsTest < UnitTestCase
include QueryExtensions
def test_species_list_all
expects = SpeciesList.order_by_default
assert_query(expects, :Sp... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/query/location_descriptions_test.rb | Ruby | mit | 84 | main | 4,532 | # frozen_string_literal: true
require("test_helper")
require("query_extensions")
# tests of Query::LocationDescriptions class to be included in QueryTest
class Query::LocationDescriptionsTest < UnitTestCase
include QueryExtensions
def test_location_description_all
assert_query(LocationDescription.all, :Locat... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/observation_labels/fields_test.rb | Ruby | mit | 84 | main | 827 | # frozen_string_literal: true
require("test_helper")
class FieldsTest < UnitTestCase
def test_error_case
Location.update_box_area_and_center_columns
obs = observations(:megacollybia_rodmanii_obs)
obs_fields = ObservationLabels::Fields.new(obs)
similar_obs = obs_fields.similar_observations
assert... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/observation_labels/name_field_test.rb | Ruby | mit | 84 | main | 1,671 | # frozen_string_literal: true
require("test_helper")
class NameFieldTest < UnitTestCase
def test_standard_case
textile_text = "**__Agaricus__** **__campestris__** L."
assert_equal([["Agaricus", [:bold, :italic]],
["campestris", [:bold, :italic]], ["L.", []]],
ObservationLa... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/observation_labels/qr_code_field_test.rb | Ruby | mit | 84 | main | 466 | # frozen_string_literal: true
require("test_helper")
require "prawn/measurement_extensions"
class QRCodeFieldTest < UnitTestCase
def test_error_case
qrcf = ObservationLabels::QRCodeField.new("Home Page", 1.234)
pdf = Prawn::Document.new(
page_size: [10.in, 10.in],
margin: 0
)
log_content... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/form_object/translation_test.rb | Ruby | mit | 84 | main | 703 | # frozen_string_literal: true
require("test_helper")
class FormObject::TranslationTest < UnitTestCase
def test_has_tag_attribute
form = FormObject::Translation.new(tag: "app_title")
assert_equal("app_title", form.tag)
end
def test_tag_defaults_to_nil
form = FormObject::Translation.new
assert_... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/classes/form_object/login_test.rb | Ruby | mit | 84 | main | 907 | # frozen_string_literal: true
require("test_helper")
class FormObject::LoginTest < UnitTestCase
def test_has_login_attribute
form = FormObject::Login.new(login: "testuser")
assert_equal("testuser", form.login)
end
def test_has_password_attribute
form = FormObject::Login.new(password: "secret")
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/mailers/application_mailer_test.rb | Ruby | mit | 84 | main | 9,886 | # frozen_string_literal: true
require("test_helper")
require("application_mailer")
class ApplicationMailerTest < UnitTestCase
FIXTURES_PATH = "#{File.dirname(__FILE__)}/../application_mailer".freeze
def setup
# Disable cop; there's no block in which to limit the time zone change
I18n.locale = :en # ruboc... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/mailers/occurrence_change_mailer_test.rb | Ruby | mit | 84 | main | 1,176 | # frozen_string_literal: true
require("test_helper")
class OccurrenceChangeMailerTest < UnitTestCase
include ActiveJob::TestHelper
def test_build_added
obs = observations(:detailed_unknown_obs)
mail = OccurrenceChangeMailer.build(
sender: rolf, receiver: mary,
observation: obs, action: :added... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/components/login_form_test.rb | Ruby | mit | 84 | main | 1,447 | # frozen_string_literal: true
require "test_helper"
class LoginFormTest < ComponentTestCase
def setup
super
@model = FormObject::Login.new(login: "testuser", remember_me: true)
@html = render_form
end
def test_renders_form_with_login_field
assert_html(@html, "body", text: :login_user.l)
ass... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/components/name_approve_synonym_form_test.rb | Ruby | mit | 84 | main | 1,467 | # frozen_string_literal: true
require "test_helper"
class NameApproveSynonymFormTest < ComponentTestCase
def test_form_structure
name = names(:lactarius_alpinus)
html = render_form(name: name)
# Form structure and action
assert_html(html, "form#name_approve_synonym_form")
assert_html(html, "for... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/components/map_test.rb | Ruby | mit | 84 | main | 6,501 | # frozen_string_literal: true
require "test_helper"
class MapTest < ComponentTestCase
def setup
super
@location = locations(:burbank)
end
def test_renders_map_with_default_attributes
html = render(Components::Map.new(objects: [@location]))
# All default attributes on one element
assert_htm... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/components/observation_form_test.rb | Ruby | mit | 84 | main | 4,497 | # frozen_string_literal: true
require("test_helper")
class ObservationFormTest < ComponentTestCase
def test_new_form_posts_to_observations
user = users(:rolf)
obs = Observation.new(when: Time.zone.today)
html = render_form(observation: obs, user: user, mode: :create)
# Should post to /observations... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/components/banner_form_test.rb | Ruby | mit | 84 | main | 809 | # frozen_string_literal: true
require("test_helper")
class BannerFormTest < ComponentTestCase
def setup
super
@banner = Banner.current || Banner.new
end
def test_renders_form_structure
html = render_form
# Form structure
assert_html(html, "#banner_form")
assert_html(html, "form[action=... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/components/name_classification_form_test.rb | Ruby | mit | 84 | main | 833 | # frozen_string_literal: true
require "test_helper"
class NameClassificationFormTest < ComponentTestCase
def test_form_structure
name = names(:coprinus_comatus)
html = render_form(name)
# Form structure and action
assert_html(html, "form#name_classification_form")
assert_html(html, "form[action... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/components/activity_log_type_filters_test.rb | Ruby | mit | 84 | main | 3,473 | # frozen_string_literal: true
require "test_helper"
class ActivityLogTypeFiltersTest < ComponentTestCase
def test_renders_form_with_get_method
html = render_component(nil, ["all"])
assert_html(html, "form[method='get']")
assert_html(html, "form[action='/activity_logs']")
assert_html(html, "form#log... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/components/form_image_fields_test.rb | Ruby | mit | 84 | main | 2,640 | # frozen_string_literal: true
require "test_helper"
class FormImageFieldsTest < ComponentTestCase
def setup
super
@user = users(:rolf)
@image = images(:connected_coprinus_comatus_image)
end
def test_existing_image_renders_all_fields
html = render_fields(image: @image, img_id: @image.id, upload:... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/components/account_signup_form_test.rb | Ruby | mit | 84 | main | 2,488 | # frozen_string_literal: true
require("test_helper")
class AccountSignupFormTest < ComponentTestCase
def setup
super
@new_user = User.new(theme: MO.default_theme)
end
def test_renders_form_structure
html = render_form
# Form structure
assert_html(html, "#account_signup_form")
assert_ht... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/components/visual_model_form_test.rb | Ruby | mit | 84 | main | 1,061 | # frozen_string_literal: true
require "test_helper"
class VisualModelFormTest < ComponentTestCase
def setup
super
@visual_model = VisualModel.new
@html = render_form
end
def test_renders_form_with_name_field
assert_html(@html, "input[name='visual_model[name]']")
assert_html(@html, "body", t... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | test/components/occurrence_resolve_modal_test.rb | Ruby | mit | 84 | main | 3,333 | # frozen_string_literal: true
require("test_helper")
class OccurrenceResolveModalTest < ComponentTestCase
def setup
super
@user = users(:rolf)
@obs1 = observations(:detailed_unknown_obs)
@obs2 = observations(:coprinus_comatus_obs)
@project = projects(:eol_project)
end
def test_modal_structu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.