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/components/sidebar/login_test.rb
Ruby
mit
84
main
1,975
# frozen_string_literal: true require "test_helper" module Sidebar class LoginTest < ComponentTestCase include Tabs::Sidebar::LoginHelper include Rails.application.routes.url_helpers def setup super @original_default_url_options = Rails.application.routes.default_url_options.dup ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/components/sidebar/info_test.rb
Ruby
mit
84
main
2,143
# frozen_string_literal: true require "test_helper" module Sidebar class InfoTest < ComponentTestCase include Tabs::Sidebar::InfoHelper include Rails.application.routes.url_helpers def setup super @original_default_url_options = Rails.application.routes.default_url_options.dup ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/components/sidebar/admin_test.rb
Ruby
mit
84
main
2,287
# frozen_string_literal: true require "test_helper" module Sidebar class AdminTest < ComponentTestCase include Tabs::Sidebar::AdminHelper include Rails.application.routes.url_helpers def setup super @original_default_url_options = Rails.application.routes.default_url_options.dup ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/components/sidebar/latest_test.rb
Ruby
mit
84
main
2,244
# frozen_string_literal: true require "test_helper" module Sidebar class LatestTest < ComponentTestCase include Tabs::Sidebar::LatestHelper include Rails.application.routes.url_helpers def setup super @original_default_url_options = Rails.application.routes.default_url_options.dup ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/components/sidebar/observations_test.rb
Ruby
mit
84
main
2,378
# frozen_string_literal: true require "test_helper" module Sidebar class ObservationsTest < ComponentTestCase include Tabs::Sidebar::ObservationsHelper include Rails.application.routes.url_helpers def setup super @original_default_url_options = Rails.application.routes.default_url_o...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/components/projects/obs_footer_test.rb
Ruby
mit
84
main
1,139
# frozen_string_literal: true require("test_helper") module Projects class ObsFooterTest < ComponentTestCase def test_renders_add_and_exclude_buttons_by_default html = render_footer(show_excluded: false) assert_html(html, "#update_footer_#{obs.id}") assert_includes(html, :ADD.l) assert_...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/components/projects/locations_table_test.rb
Ruby
mit
84
main
3,019
# frozen_string_literal: true require("test_helper") module Projects class LocationsTableTest < ComponentTestCase def test_renders_table_with_locations html = render_table(user: users(:rolf)) assert_html(html, "#locations_table") assert_html(html, "table.table") assert_includes(html, :L...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/components/application_form/autocompleter_prefill_test.rb
Ruby
mit
84
main
4,467
# frozen_string_literal: true require "test_helper" class ApplicationFormAutocompleterPrefillTest < ComponentTestCase # Test form that includes the AutocompleterPrefill module class TestForm < Components::ApplicationForm include Components::ApplicationForm::AutocompleterPrefill end def setup super ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/gems/mini_racer_version_test.rb
Ruby
mit
84
main
319
# frozen_string_literal: true class MiniRacerVersionTest < FunctionalTestCase # test version "0.18.1" because ">= 0.19.0" will not compile for older Macs # Issue documented here: https://github.com/rubyjs/mini_racer/issues/359 def test_mini_racer_version assert_equal(MiniRacer::VERSION, "0.18.1") end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/channels/application_cable/connection_test.rb
Ruby
mit
84
main
482
# frozen_string_literal: true require("test_helper") class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase def test_connects_with_cookies rolf = users(:rolf) cookies["mo_user"] = "#{rolf.id} #{rolf.auth_code}" connect assert_equal(connection.current_user, rolf) end def te...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/lurker_integration_test.rb
Ruby
mit
84
main
16,025
# frozen_string_literal: true require("test_helper") # Test typical sessions of user who never creates an account or contributes. class LurkerIntegrationTest < CapybaraIntegrationTestCase def test_poke_around # Start at index. reset_session! login visit("/activity_logs") rss_log = RssLog.where....
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/images_integration_test.rb
Ruby
mit
84
main
1,875
# frozen_string_literal: true require("test_helper") class ImagesIntegrationTest < CapybaraIntegrationTestCase # ------------------------------------------------------------------------ # Quick test to try to catch a bug that the functional tests can't seem # to catch. (Functional tests can survive undefined...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/glossary_terms_integration_test.rb
Ruby
mit
84
main
1,797
# frozen_string_literal: true require("test_helper") # Simple smoke tests for glossary term form submission class GlossaryTermsIntegrationTest < CapybaraIntegrationTestCase def test_create_glossary_term # Login as a user who can create glossary terms login!(users(:rolf)) # Visit the new glossary term p...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/image_vote_anonymity_form_integration_test.rb
Ruby
mit
84
main
913
# frozen_string_literal: true require("test_helper") # Simple smoke test for image vote anonymity form submission class ImageVoteAnonymityFormIntegrationTest < CapybaraIntegrationTestCase def test_make_votes_public # Login as a user who has cast image votes user = users(:rolf) login(user) # Set all...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/advanced_search_integration_test.rb
Ruby
mit
84
main
1,284
# frozen_string_literal: true require("test_helper") class AdvancedSearchIntegrationTest < CapybaraIntegrationTestCase # Tests using a "by user" query of the "Show Locations" link on the obs index def test_advanced_search_with_name_and_location rolf.update(layout_count: 100) login visit(search_advanc...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/herbarium_curator_integration_test.rb
Ruby
mit
84
main
10,597
# frozen_string_literal: true require("test_helper") class HerbariumCuratorIntegrationTest < CapybaraIntegrationTestCase # ---------- Helpers ---------- def nybg herbaria(:nybg_herbarium) end # ---------- Tests ---------- def test_first_herbarium_record # Mary doesn't have a herbarium. obs = ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/random_integration_test.rb
Ruby
mit
84
main
2,622
# frozen_string_literal: true require("test_helper") class RandomIntegrationTest < CapybaraIntegrationTestCase def test_the_homepage login(users(:zero_user)) visit("/") assert_selector("body.observations__index") end def test_uptime_probe visit("/test") assert_selector("body") end def ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/related_records_integration_test.rb
Ruby
mit
84
main
2,481
# frozen_string_literal: true require("test_helper") class RelatedRecordsIntegrationTest < CapybaraIntegrationTestCase # Tests using a "by user" query of the "Show Locations" link on the obs index def test_observations_at_location_links login visit(observations_path(pattern: "user:#{rolf.id}")) click...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/licenses_integration_test.rb
Ruby
mit
84
main
383
# frozen_string_literal: true require("test_helper") # Test things that are untestable in integration tests class LicensesIntegrationTest < CapybaraIntegrationTestCase def test_link_to_licenses login(users(:admin)) assert_no_selector(:link, text: :LICENSES.l) first("button", text: "Turn on Admin Mode")...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/articles_integration_test.rb
Ruby
mit
84
main
1,795
# frozen_string_literal: true require("test_helper") # Simple smoke tests for article form submission class ArticlesIntegrationTest < CapybaraIntegrationTestCase def test_create_article # Login as admin (articles require admin mode) login(users(:admin)) first("button", text: "Turn on Admin Mode").click ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/webmaster_question_integration_test.rb
Ruby
mit
84
main
4,035
# frozen_string_literal: true require("test_helper") class WebmasterQuestionIntegrationTest < CapybaraIntegrationTestCase include ActiveJob::TestHelper def test_logged_in_user_submits_webmaster_question rolf = users(:rolf) login!(rolf) email_count = ActionMailer::Base.deliveries.count # Visit t...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/publications_form_integration_test.rb
Ruby
mit
84
main
1,401
# frozen_string_literal: true require("test_helper") # Simple smoke tests for publication form submission class PublicationsFormIntegrationTest < CapybaraIntegrationTestCase def test_create_publication # Login as a user who can create publications login(users(:rolf)) # Visit the new publication page ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/sequences_integration_test.rb
Ruby
mit
84
main
1,415
# frozen_string_literal: true require("test_helper") # Test adding, editing, and deleting a Sequence class SequencesIntegrationTest < CapybaraIntegrationTestCase def test_sequence obs = observations(:detailed_unknown_obs) sequence_original_count = Sequence.count login(mary) visit(observation_path(...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/user_fixture_helpers_test.rb
Ruby
mit
84
main
1,449
# frozen_string_literal: true require("test_helper") # Test that user fixture helper methods work in integration tests class UserFixtureHelpersTest < CapybaraIntegrationTestCase def test_existing_user_helpers_still_work # These had explicit method definitions before assert_equal(users(:rolf), rolf) asse...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/inat_imports_integration_test.rb
Ruby
mit
84
main
496
# frozen_string_literal: true require("test_helper") # Test things that are untestable in integration tests class InatImportsTest < CapybaraIntegrationTestCase def test_inat_import_no_imports_designated login(mary) visit(new_inat_import_path) fill_in("inat_import_inat_username", with: "anything") p...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/licenses_form_integration_test.rb
Ruby
mit
84
main
1,395
# frozen_string_literal: true require("test_helper") # Simple smoke tests for license form submission class LicensesFormIntegrationTest < CapybaraIntegrationTestCase def test_create_license # Login as admin (licenses require admin mode) login(users(:admin)) first("button", text: "Turn on Admin Mode").cl...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/species_lists_integration_test.rb
Ruby
mit
84
main
5,789
# frozen_string_literal: true require("test_helper") # Test a few representative sessions of a power-user. class SpeciesListsIntegrationTest < CapybaraIntegrationTestCase def empty_notes NameDescription.all_note_fields.index_with { |_f| nil } end # ----------------------------------------------------------...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/query_filters_integration_test.rb
Ruby
mit
84
main
8,471
# frozen_string_literal: true require("test_helper") # Test user filters class QueryFiltersIntegrationTest < CapybaraIntegrationTestCase # Test deserialization of non-ascii characters # Observation and Show Location title include # ` and ’ # as &#8216 and &#8217; ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/donations_integration_test.rb
Ruby
mit
84
main
1,731
# frozen_string_literal: true require("test_helper") # Simple smoke tests for donation form submission class DonationsIntegrationTest < CapybaraIntegrationTestCase def test_create_donation # Login as admin login(users(:admin)) first("button", text: "Turn on Admin Mode").click # Visit the new donati...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/textile_integration_test.rb
Ruby
mit
84
main
387
# frozen_string_literal: true require("test_helper") # Test adding, editing, and deleting a Sequence class TextileIntegrationTest < CapybaraIntegrationTestCase def test_sequential_term_links login(mary) visit(info_textile_sandbox_path) fill_in("textile_sandbox_code", with: "_Aborts_\n_aborts_") cli...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/email_new_password_form_integration_test.rb
Ruby
mit
84
main
850
# frozen_string_literal: true require("test_helper") # Simple smoke test for email new password form submission class EmailNewPasswordFormIntegrationTest < CapybaraIntegrationTestCase def test_request_new_password # Start at the login page visit(new_account_login_path) assert_selector("body.login__new")...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/observations_integration_test.rb
Ruby
mit
84
main
14,201
# frozen_string_literal: true require("test_helper") # Tests which supplement controller/observations_controller_test.rb class ObservationsIntegrationTest < CapybaraIntegrationTestCase # Prove that when a user "Tests" the text entered in the Textile Sandbox, # MO displays what the entered text looks like. def t...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/collection_numbers_integration_test.rb
Ruby
mit
84
main
689
# frozen_string_literal: true require("test_helper") # Test adding, editing, and deleting a CollectionNumber class CollectionNumbersIntegrationTest < CapybaraIntegrationTestCase def test_collection_number_remove obs = observations(:minimal_unknown_obs) assert_not_empty(obs.collection_numbers, ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/project_admin_requests_integration_test.rb
Ruby
mit
84
main
2,011
# frozen_string_literal: true require("test_helper") # Simple smoke tests for project admin request form submission class ProjectAdminRequestsIntegrationTest < CapybaraIntegrationTestCase include ActiveJob::TestHelper def test_create_project_admin_request # Login as a user (not the project admin) login(u...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/namings_integration_test.rb
Ruby
mit
84
main
8,078
# frozen_string_literal: true require("test_helper") class NamingsIntegrationTest < CapybaraIntegrationTestCase # -------------------------------------- # Test proposing and voting on names. # -------------------------------------- def test_proposing_names namer_session = open_session voter_session ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/projects_integration_test.rb
Ruby
mit
84
main
3,162
# frozen_string_literal: true require("test_helper") # Test relating to projects class ProjectsIntegrationTest < CapybaraIntegrationTestCase def test_add_project_dates login(mary) title = "Ongoing Project Any Dates" # ----- Add project, default dates visit(projects_path) click_on(:list_projects...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/visual_groups_integration_test.rb
Ruby
mit
84
main
1,739
# frozen_string_literal: true require("test_helper") # Simple smoke tests for visual group form submission class VisualGroupsIntegrationTest < CapybaraIntegrationTestCase def test_create_visual_group # Login as admin login(users(:admin)) first("button", text: "Turn on Admin Mode").click visual_model...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/names_integration_test.rb
Ruby
mit
84
main
10,493
# frozen_string_literal: true require("test_helper") # Tests which supplement controller/name_controller_test.rb class NamesIntegrationTest < CapybaraIntegrationTestCase def test_name_show_previous_version # a name with versions name = names(:coprinellus_micaceus) # current_version_number = name.version...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/visual_models_integration_test.rb
Ruby
mit
84
main
1,537
# frozen_string_literal: true require("test_helper") # Simple smoke tests for visual model form submission class VisualModelsIntegrationTest < CapybaraIntegrationTestCase def test_create_visual_model # Login as admin login(users(:admin)) first("button", text: "Turn on Admin Mode").click # Visit the...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/language_tracking_integration_test.rb
Ruby
mit
84
main
1,813
# frozen_string_literal: true require("test_helper") class LanguageTrackingIntegrationTest < CapybaraIntegrationTestCase # ----------------------------------------------------------------------- # Need integration test to make sure tags are being tracked and passed # through redirects correctly. # ---------...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/admin_integration_test.rb
Ruby
mit
84
main
4,871
# frozen_string_literal: true require("test_helper") class AdminIntegrationTest < CapybaraIntegrationTestCase def setup super backup_ip_files end def teardown restore_ip_files super end def test_turn_admin_mode_on_and_off refute_selector(id: "nav_admin_on_link") put_user_in_admin_...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/account_integration_test.rb
Ruby
mit
84
main
19,603
# frozen_string_literal: true require("test_helper") class AccountIntegrationTest < CapybaraIntegrationTestCase include ActiveJob::TestHelper # ------------------------------- # Test basic login. # ------------------------------- def test_login # Start at index. visit("/") # Login. first...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/api_keys_integration_test.rb
Ruby
mit
84
main
1,872
# frozen_string_literal: true require("test_helper") # Simple smoke tests for API key form submission class APIKeysIntegrationTest < CapybaraIntegrationTestCase def test_create_api_key # Login as a user login(users(:rolf)) # Visit the API keys index page and click new visit(account_api_keys_path) ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/name_descriptions_integration_test.rb
Ruby
mit
84
main
24,265
# frozen_string_literal: true require("test_helper") class NameDescriptionsIntegrationTest < CapybaraIntegrationTestCase def test_general_description_editable_by_permitted_user name = names(:peltigera) # needs to have gen_desc login!(katrina) # not permitted to edit description of above visit("/names/#...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/field_slips_integration_test.rb
Ruby
mit
84
main
2,089
# frozen_string_literal: true require("test_helper") # Tests relating to field_slip UI, and projects class FieldSlipsIntegrationTest < CapybaraIntegrationTestCase setup do @field_slip = field_slips(:field_slip_one) end def test_visiting_the_index login!(mary) visit(field_slips_url) assert_match...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/name_change_requests_integration_test.rb
Ruby
mit
84
main
1,530
# frozen_string_literal: true require("test_helper") # Simple smoke tests for name change request form submission class NameChangeRequestsIntegrationTest < CapybaraIntegrationTestCase include ActiveJob::TestHelper def test_create_name_change_request # Login as admin login(users(:admin)) first("button...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/activity_log_integration_test.rb
Ruby
mit
84
main
685
# frozen_string_literal: true require("test_helper") # Tests which supplement controller/rss_logs_controller_test.rb class ActivityLogIntegrationTest < CapybaraIntegrationTestCase # Prove that MO offers to make non-default log the user's default. def test_user_default_rss_log login visit("/activity_logs")...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/capybara/search_integration_test.rb
Ruby
mit
84
main
10,379
# frozen_string_literal: true require("test_helper") # Tests which supplement controller/observations_controller_test.rb class SearchIntegrationTest < CapybaraIntegrationTestCase def test_observations_search_form shroom = "Agaricus campestris" lichen = "Peltigera" lookup = "#{shroom}\n#{lichen}" loc...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/rails-dom-testing/n_plus_1_integration_test.rb
Ruby
mit
84
main
894
# frozen_string_literal: true require("test_helper") # Discover potential n+1 issues by running some requests with bullet gem class NPlusOneIntegrationTest < IntegrationTestCase include BulletHelper def test_api2 get("/api2/observations?detail=high&format=xml") get("/api2/locations?detail=high&format=xml...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/rails-dom-testing/autologin_integration_test.rb
Ruby
mit
84
main
1,287
# frozen_string_literal: true require("test_helper") class AutologinIntegrationTest < IntegrationTestCase # ---------------------------- # Test autologin cookies. # ---------------------------- def test_autologin rolf_cookies = get_cookies(rolf, true) mary_cookies = get_cookies(mary, true) dick_...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration/rails-dom-testing/redirects_integration_test.rb
Ruby
mit
84
main
6,078
# frozen_string_literal: true require("test_helper") # Test whether actions redirected correctly class RedirectsIntegrationTest < IntegrationTestCase # helpers def assert_old_url_redirects_to_new_path(old_method, old_url, new_path) case old_method when :get get(old_url) when :delete delete...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/inat_import_test.rb
Ruby
mit
84
main
5,010
# frozen_string_literal: true require "test_helper" class InatImportTest < ActiveSupport::TestCase def test_total_expected_time_tabula_rasa zero_out_prior_import_records import = inat_imports(:rolf_inat_import) assert_equal( import.importables * InatImport::BASE_AVG_IMPORT_SECONDS, import.t...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/translation_string_test.rb
Ruby
mit
84
main
2,222
# frozen_string_literal: true require("test_helper") class TranslationStringTest < UnitTestCase def test_rename_tags_upcase str = TranslationString.create( { tag: "JOHN", text: "Harding", user: users(:rolf), language: languages(:english) } ) TranslationString.rename_tags("JOHN" => "FRED") ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/sequence_test.rb
Ruby
mit
84
main
10,494
# frozen_string_literal: true require("test_helper") class SequenceTest < UnitTestCase def test_validators # Prove that Sequence with all proper fields is valid. sequence = Sequence.new( observation: observations(:boletus_edulis_obs), user: observations(:boletus_edulis_obs).user, locus: "I...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/article_test.rb
Ruby
mit
84
main
453
# frozen_string_literal: true require("test_helper") class ArticleTest < UnitTestCase def test_can_edit article = articles(:premier_article) assert(article.can_edit?(users(:article_writer))) assert_not(article.can_edit?(users(:zero_user))) end def test_destroy_orphans_log article = articles(:pr...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/collection_number_test.rb
Ruby
mit
84
main
266
# frozen_string_literal: true require("test_helper") class CollectionNumberTest < UnitTestCase def test_fields num = collection_numbers(:coprinus_comatus_coll_num) assert_not(num.observations.empty?) assert(num.name) assert(num.number) end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/checklist_test.rb
Ruby
mit
84
main
17,504
# frozen_string_literal: true require("test_helper") class ChecklistTest < UnitTestCase def katrinas_species ["Conocybe filaris"] end def rolfs_species [ "Agaricus campestras", # these are not synonymized "Agaricus campestris", "Agaricus campestros", "Agaricus campestrus", ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/name_parse_test.rb
Ruby
mit
84
main
5,806
# frozen_string_literal: true require("test_helper") class NameParseTest < UnitTestCase def test_default name_parse = NameParse.new("Foo bar") assert_not_nil(name_parse) assert_nil(name_parse.rank) assert_equal("Foo bar", name_parse.search_name) assert_not(name_parse.has_synonym?) assert_equ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/project_test.rb
Ruby
mit
84
main
14,373
# frozen_string_literal: true require("test_helper") class ProjectTest < UnitTestCase def test_add_and_remove_observations proj = projects(:eol_project) minimal_unknown_obs = observations(:minimal_unknown_obs) detailed_unknown_obs = observations(:detailed_unknown_obs) imgs = detailed_unknown_obs.ima...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/comment_test.rb
Ruby
mit
84
main
8,388
# frozen_string_literal: true require("test_helper") class CommentTest < UnitTestCase include ActiveJob::TestHelper def test_find_object_for_all_types Comment::ALL_TYPES.each do |type| assert(AbstractModel.find_object(type.to_s, type.first.id), "Unable to use find_object to find #{type}") ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/interest_test.rb
Ruby
mit
84
main
1,752
# frozen_string_literal: true require("test_helper") class InterestTest < UnitTestCase def test_setting_and_getting # NOTE: All users already have an interest in a NameTracker fixture Interest.new( user: rolf, target: observations(:minimal_unknown_obs), state: true ).save Interest....
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/name_tracker_test.rb
Ruby
mit
84
main
647
# frozen_string_literal: true require("test_helper") # test the NameTracker model class NameTrackerTest < UnitTestCase def test_summary name_tracker = name_trackers(:coprinus_comatus_name_tracker) assert_match(name_tracker.name.display_name, name_tracker.summary) interest = Interest.find_by(target: nam...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/language_test.rb
Ruby
mit
84
main
3,914
# frozen_string_literal: true require("test_helper") class LanguageTest < UnitTestCase def test_official english = languages(:english) all_but_english = Language.all - [english] assert_objs_equal(english, Language.official) assert_obj_arrays_equal(all_but_english, Language.unofficial) end def t...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/user_stats_test.rb
Ruby
mit
84
main
6,411
# frozen_string_literal: true require("test_helper") class UserStatsTest < UnitTestCase def rolfs_name_edits Name::Version.joins(:name). where(Name::Version.arel_table[:user_id].eq(rolf.id)). where.not( Name::Version.arel_table[:user_id].eq(Name[:user_id]) ).distinct.count end def...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/cache_test.rb
Ruby
mit
84
main
7,910
# frozen_string_literal: true require("test_helper") # Test cached columns in names and observations table. class CacheTest < UnitTestCase # Prove that changing a location name will update observations.where for # all the attached observations AND change the updated_at field. def test_changing_location_name ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/name_test.rb
Ruby
mit
84
main
160,800
# frozen_string_literal: true require("test_helper") # Tests for methods in models/name.rb and models/name/xxx.rb class NameTest < UnitTestCase include ActiveJob::TestHelper def create_test_name(string, force_rank = nil) User.current = rolf parse = Name.parse_name(string) assert(parse, "Expected this...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/user_fixture_accessibility_test.rb
Ruby
mit
84
main
2,083
# frozen_string_literal: true require("test_helper") # Test that all user fixtures are accessible via helper methods. # This validates that fixture names follow Ruby method naming conventions. class UserFixtureAccessibilityTest < UnitTestCase def test_all_user_fixtures_are_accessible_as_methods # Get all user f...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/vote_test.rb
Ruby
mit
84
main
3,359
# frozen_string_literal: true require("test_helper") class VoteTest < UnitTestCase # Create one. def test_create assert_kind_of(Naming, namings(:agaricus_campestris_naming)) assert_kind_of(User, mary) now = Time.current vote = Vote.new( created_at: now, updated_at: now, naming: n...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/observation_view_test.rb
Ruby
mit
84
main
563
# frozen_string_literal: true require("test_helper") class ObservationViewTest < UnitTestCase def test_basic_stuff obs = observations(:minimal_unknown_obs) assert_empty(ObservationView.where(observation_id: obs.id, user_id: dick.id)) ObservationView.update_view_sta...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/description_test.rb
Ruby
mit
84
main
9,754
# frozen_string_literal: true require("test_helper") class DescriptionTest < UnitTestCase # Make sure authors and editors are as they should be. def assert_authors_and_editors(obj, authors, editors, msg) assert_equal(authors.sort, obj.authors.map(&:login).sort, "Authors wrong: #{msg}") as...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/observation_test.rb
Ruby
mit
84
main
75,808
# frozen_string_literal: true require("test_helper") # test Observation model class ObservationTest < UnitTestCase include ActiveJob::TestHelper def create_new_objects @cc_obs = Observation.new @cc_obs.user = mary @cc_obs.when = Time.zone.now @cc_obs.where = "Glendale, California" @cc_obs.note...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/external_link_test.rb
Ruby
mit
84
main
3,879
# frozen_string_literal: true require("test_helper") class ExternalLinkTest < UnitTestCase def test_create_valid site = ExternalSite.first base_url = site.base_url link = ExternalLink.create!( user: mary, observation: Observation.first, external_site: site, url: "#{base_url}plus...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/name_sorter_test.rb
Ruby
mit
84
main
4,481
# frozen_string_literal: true require("test_helper") class NameSorterTest < UnitTestCase def test_add_name_default name_sorter = NameSorter.new assert_not_nil(name_sorter) name_sorter.add_name(rolf, "Foo bar") assert_equal(["Foo bar"], name_sorter.new_name_strs) assert_equal(["Foo bar"], name_so...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/name_observation_test.rb
Ruby
mit
84
main
1,012
# frozen_string_literal: true require("test_helper") class NameObservationTest < UnitTestCase def test_where_proposed name = names(:lactarius_alpigenes) assert(name.deprecated?, "Test needs deprecated Name") assert_blank(Naming.where(name: name), "Test needs name without Namings") a...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/user_test.rb
Ruby
mit
84
main
22,485
# frozen_string_literal: true require("test_helper") class UserTest < UnitTestCase def test_auth assert_equal(rolf, User.authenticate(login: "rolf", password: "testpassword")) assert_nil(User.authenticate(login: "nonrolf", password: "testpassword")) end def test_password_change mar...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/license_test.rb
Ruby
mit
84
main
4,213
# frozen_string_literal: true require("test_helper") class LicenseTest < UnitTestCase def test_available_names_and_ids_nothing_chosen names_and_ids = License.available_names_and_ids assert_equal(License.current.count, names_and_ids.length) names_and_ids.each do |(_name, id)| license = License.fin...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/synonym_test.rb
Ruby
mit
84
main
817
# frozen_string_literal: true require("test_helper") class SynonymTest < UnitTestCase def test_make_sure_all_referenced_synonyms_exist # Make sure there is at least one unused synonym. unused_id = Synonym.create.id assert_not_nil(Synonym.safe_find(unused_id)) # Make sure there is at least one missi...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/herbarium_record_test.rb
Ruby
mit
84
main
2,806
# frozen_string_literal: true require("test_helper") class HerbariumRecordTest < UnitTestCase include ActiveJob::TestHelper def test_fields assert_not(herbarium_records(:interesting_unknown).observations.empty?) assert(herbarium_records(:interesting_unknown).herbarium) assert(herbarium_records(:inter...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/naming_test.rb
Ruby
mit
84
main
5,460
# frozen_string_literal: true require("test_helper") class NamingTest < UnitTestCase # Propose a naming for an observation. def test_create obs = observations(:coprinus_comatus_obs) assert_kind_of(Observation, obs) now = Time.zone.now naming = Naming.new( created_at: now, updated_at: n...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/occurrence_test.rb
Ruby
mit
84
main
35,956
# frozen_string_literal: true require("test_helper") class OccurrenceTest < UnitTestCase include ActiveJob::TestHelper def setup @obs1 = observations(:minimal_unknown_obs) @obs2 = observations(:coprinus_comatus_obs) @obs3 = observations(:detailed_unknown_obs) @obs4 = observations(:amateur_obs) ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/rss_log_test.rb
Ruby
mit
84
main
3,033
# frozen_string_literal: true require("test_helper") class RssLogTest < UnitTestCase # Alert developer if normalization changes the path of an RssLogg'ed object # The test should be deleted once controllers for all RssLog'ged objects are # normalized. # See https://www.pivotaltracker.com/story/show/174685402 ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/api_key_test.rb
Ruby
mit
84
main
684
# frozen_string_literal: true require("test_helper") class APIKeyTest < UnitTestCase def test_create count = APIKey.count User.current = dick APIKey.create assert_equal(count, APIKey.count) APIKey.create(notes: "app name") key = APIKey.find_by(notes: "app name", user: dick) assert_not_...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/glossary_term_test.rb
Ruby
mit
84
main
5,313
# frozen_string_literal: true require("test_helper") class GlossaryTermTest < UnitTestCase def test_glossary_term_load glossary_term = glossary_terms(:conic_glossary_term) assert(glossary_term) end def test_text_name glossary_term = glossary_terms(:conic_glossary_term) assert_equal(glossary_ter...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/visual_group_test.rb
Ruby
mit
84
main
1,031
# frozen_string_literal: true require("test_helper") class VisualGroupTest < ActiveSupport::TestCase def test_merge vg1 = visual_groups(:visual_group_one) vg2 = visual_groups(:visual_group_two) total = vg1.images.count + vg2.images.count assert_not_equal(vg1.images.count, total) vg1.merge(vg2) ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/abstract_model_test.rb
Ruby
mit
84
main
19,007
# frozen_string_literal: true require("test_helper") class AbstractModelTest < UnitTestCase # Make sure update_view_stats updated stuff correctly (and did nothing else). def assert_same_but_view_stats(old_attrs, new_attrs, msg = "") (old_attrs.keys + new_attrs.keys).map(&:to_s).uniq.sort.each do |key| o...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/species_list_test.rb
Ruby
mit
84
main
5,463
# frozen_string_literal: true require("test_helper") class SpeciesListTest < UnitTestCase def test_project_ownership # NOT owned by Bolete project, but owned by Rolf spl = species_lists(:first_species_list) assert_true(spl.can_edit?(rolf)) assert_false(spl.can_edit?(mary)) assert_false(spl.can_e...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/user_thread_safety_test.rb
Ruby
mit
84
main
3,821
# frozen_string_literal: true require "test_helper" class UserThreadSafetyTest < UnitTestCase # This test verifies that User.current is now thread-safe # # These tests use Concurrent::CountDownLatch for deterministic synchronization # instead of sleep() to avoid timing-related flakiness. The latches ensure ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/inat_import_job_tracker_test.rb
Ruby
mit
84
main
726
# frozen_string_literal: true require "test_helper" class InatImportJobTrackerTest < ActiveSupport::TestCase def test_elapsed_and_remaining_time import = inat_imports(:rolf_inat_import) import.update(avg_import_time: import.initial_avg_import_seconds) tracker = InatImportJobTracker.find_or_create_by(ina...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/image_test.rb
Ruby
mit
84
main
9,467
# frozen_string_literal: true require("test_helper") class ImageTest < UnitTestCase def test_votes img = images(:in_situ_image) assert(img.image_votes.empty?) assert_equal(0, img.num_votes) assert_equal(0, img.vote_cache.to_i) assert_nil(img.users_vote(mary)) assert_nil(img.users_vote(rolf))...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/project_alias_test.rb
Ruby
mit
84
main
375
# frozen_string_literal: true require("test_helper") class ProjectAliasTest < ActiveSupport::TestCase def test_valid_user_aliases pa = ProjectAlias.find_by(target_type: "User") assert_equal(User, pa.target.class) end def test_valid_location_aliases pa = ProjectAlias.find_by(target_type: "Location")...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/herbarium_test.rb
Ruby
mit
84
main
3,052
# frozen_string_literal: true require("test_helper") class HerbariumTest < UnitTestCase def test_herbarium_records assert(herbaria(:nybg_herbarium).herbarium_records.length > 1) end def test_mailing_address assert(herbaria(:nybg_herbarium).mailing_address) assert_nil(herbaria(:rolf_herbarium).maili...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/external_site_test.rb
Ruby
mit
84
main
1,925
# frozen_string_literal: true require("test_helper") class ExternalSiteTest < UnitTestCase def test_create_external_site_valid site = ExternalSite.create!( name: "GenBank", project: Project.first, base_url: "genbank.org" ) assert_not_nil(site) assert_empty(site.errors) assert_e...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/location_test.rb
Ruby
mit
84
main
29,703
# frozen_string_literal: true require("test_helper") class LocationTest < UnitTestCase include ActiveJob::TestHelper def bad_location(str) assert(Location.dubious_name?(str, true) != []) end def good_location(str) assert_not(Location.dubious_name?(str)) end # Locations are a shared resource; an...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/models/observation/merged_naming_test.rb
Ruby
mit
84
main
12,321
# frozen_string_literal: true require("test_helper") class Observation::MergedNamingTest < UnitTestCase def setup @obs1 = observations(:minimal_unknown_obs) @obs2 = observations(:detailed_unknown_obs) @obs3 = observations(:amateur_obs) @obs1.update_column(:occurrence_id, nil) @name = names(:agar...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
app/channels/application_cable/connection.rb
Ruby
mit
84
main
1,060
# frozen_string_literal: true # This is the connection class for the ActionCable websocket connection, # responsible for setting the current_user for the connection. Any live updates # over websockets need to be authenticated like regular requests, but they don't # hit the regular controller actions, so we need to aut...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
app/views/base.rb
Ruby
mit
84
main
292
# frozen_string_literal: true class Views::Base < Components::Base # The `Views::Base` is an abstract class for all your views. # By default, it inherits from `Components::Base`, but you # can change that to `Phlex::HTML` if you want to keep views and # components independent. end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
app/views/controllers/info/textile_sandbox.rb
Ruby
mit
84
main
1,384
# frozen_string_literal: true module Views module Controllers module Info # Phlex view template for the textile sandbox page. # Sets the page title and renders the form component. # # @example Usage in controller # render(Views::Controllers::Info::TextileSandbox.new( # t...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
app/views/controllers/names/eol_data/show.xml.builder
Ruby
mit
84
main
3,989
# frozen_string_literal: true xml.instruct!(:xml, version: "1.0") xml.response( "xmlns" => "http://www.eol.org/transfer/content/0.2", "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema", "xmlns:dc" => "http://purl.org/dc/elements/1.1/", "xmlns:dcterms" => "http://purl.org/dc/terms/", "xmlns:geo" => "http://www...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
app/views/controllers/checklists/show.rb
Ruby
mit
84
main
1,621
# frozen_string_literal: true module Views module Controllers module Checklists # Phlex view for the checklist page. Replaces show.html.erb. class Show < Views::Base register_output_helper :add_project_banner register_output_helper :add_page_title register_output_helper :add_c...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
app/views/controllers/occurrences/edit.rb
Ruby
mit
84
main
1,412
# frozen_string_literal: true module Views module Controllers module Occurrences # Phlex view for the occurrence edit page. # Optionally overlays a project membership confirmation modal. class Edit < Views::Base register_output_helper :container_class def initialize(occurrence:...