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 | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20250308220906_create_part.rb | Ruby | mit | 48 | main | 359 | class CreatePart < ActiveRecord::Migration[7.1]
def change
create_table :parts do |t|
t.text :mongo_id
t.integer :order
t.string :title
t.string :body
t.string :slug
t.references :guide_edition, foreign_key: true
t.references :programme_edition, foreign_key: true
t.... |
github | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20250227112620_create_artefact.rb | Ruby | mit | 48 | main | 755 | class CreateArtefact < ActiveRecord::Migration[7.1]
def change
create_table :artefacts do |t|
t.string :name
t.string :slug
t.string :paths, array: true, default: []
t.string :prefixes, array: true, default: []
t.string :kind
t.string :owning_app
t.string :rendering_app
... |
github | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20250319211637_create_devolved_administration_availability.rb | Ruby | mit | 48 | main | 400 | class CreateDevolvedAdministrationAvailability < ActiveRecord::Migration[7.1]
def change
create_table :devolved_administration_availabilities do |t|
t.string :authority_type, default: "local_authority_service"
t.string :alternative_url
t.string :type
t.text :mongo_id
t.references :lo... |
github | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20250227112627_create_artefact_action.rb | Ruby | mit | 48 | main | 364 | class CreateArtefactAction < ActiveRecord::Migration[7.1]
def change
create_table :artefact_actions do |t|
t.text :mongo_id
t.string :action_type
t.jsonb :snapshot
t.string :task_performed_by
t.timestamps
t.references :user, foreign_key: true
t.references :artefact, index... |
github | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20250711142940_create_video_edition.rb | Ruby | mit | 48 | main | 223 | class CreateVideoEdition < ActiveRecord::Migration[7.1]
def change
create_table :video_editions do |t|
t.string :video_url
t.string :video_summary
t.string :body
t.timestamps
end
end
end |
github | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20250318163059_create_local_service.rb | Ruby | mit | 48 | main | 281 | class CreateLocalService < ActiveRecord::Migration[7.1]
def change
create_table :local_services do |t|
t.string :description
t.integer :lgsl_code
t.text :mongo_id
t.string :providing_tier, array: true, default: []
t.timestamps
end
end
end |
github | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20250310153542_create_transaction_edition.rb | Ruby | mit | 48 | main | 393 | class CreateTransactionEdition < ActiveRecord::Migration[7.1]
def change
create_table :transaction_editions do |t|
t.string :introduction
t.string :will_continue_on
t.string :link
t.string :more_information
t.string :need_to_know
t.string :alternate_methods
t.string :star... |
github | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20260402151145_add_composite_index_to_actions.rb | Ruby | mit | 48 | main | 429 | class AddCompositeIndexToActions < ActiveRecord::Migration[8.1]
# This is required to perform the migration concurrently, which prevents write locks
# on the table whilst the index is being built
disable_ddl_transaction!
def change
add_index :actions, %i[edition_id request_type created_at],
n... |
github | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20250319215603_create_overview_dashboard.rb | Ruby | mit | 48 | main | 465 | class CreateOverviewDashboard < ActiveRecord::Migration[7.1]
def change
create_table :overview_dashboards do |t|
t.text :mongo_id
t.string :dashboard_type
t.string :result_group
t.integer :count
t.integer :draft
t.integer :amends_needed
t.integer :in_review
t.intege... |
github | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20250320115929_create_completed_transaction_edition.rb | Ruby | mit | 48 | main | 365 | class CreateCompletedTransactionEdition < ActiveRecord::Migration[7.1]
def change
create_table :completed_transaction_editions do |t|
t.string :body
t.json :presentation_toggles, default: {
"promotion_choice" =>
{
"choice" => "none",
"url" => "",
},
... |
github | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20250402111020_create_simple_smart_answer_edition_node_option.rb | Ruby | mit | 48 | main | 378 | class CreateSimpleSmartAnswerEditionNodeOption < ActiveRecord::Migration[7.1]
def change
create_table :simple_smart_answer_edition_node_options do |t|
t.string :label
t.string :slug
t.string :next_node
t.integer :order
t.text :mongo_id
t.references :node, foreign_key: { to_tabl... |
github | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20250319213629_create_place_edition.rb | Ruby | mit | 48 | main | 264 | class CreatePlaceEdition < ActiveRecord::Migration[7.1]
def change
create_table :place_editions do |t|
t.string :introduction
t.string :more_information
t.string :need_to_know
t.string :place_type
t.timestamps
end
end
end |
github | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20250212162143_create_user.rb | Ruby | mit | 48 | main | 503 | class CreateUser < ActiveRecord::Migration[7.1]
def change
create_table :users do |t|
t.string :name
t.string :email
t.string :uid
t.string :organisation_slug
t.string :organisation_content_id
t.string :app_name
t.string :permissions, array: true, default: [... |
github | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20250228161852_create_artefact_external_link.rb | Ruby | mit | 48 | main | 257 | class CreateArtefactExternalLink < ActiveRecord::Migration[7.1]
def change
create_table :artefact_external_links do |t|
t.text :mongo_id
t.string :title
t.string :url
t.references :artefact, foreign_key: true
end
end
end |
github | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20250319211636_create_local_transaction_edition.rb | Ruby | mit | 48 | main | 432 | class CreateLocalTransactionEdition < ActiveRecord::Migration[7.1]
def change
create_table :local_transaction_editions do |t|
t.integer :lgsl_code, type: Integer
t.integer :lgil_override, type: Integer
t.integer :lgil_code, type: Integer
t.string :introduction, type: String
t.string ... |
github | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20250319215816_create_downtime.rb | Ruby | mit | 48 | main | 265 | class CreateDowntime < ActiveRecord::Migration[7.1]
def change
create_table :downtimes do |t|
t.string :message
t.datetime :start_time
t.datetime :end_time
t.references :artefact, foreign_key: true
t.timestamps
end
end
end |
github | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20250308220704_create_guide_edition.rb | Ruby | mit | 48 | main | 243 | class CreateGuideEdition < ActiveRecord::Migration[7.1]
def change
create_table :guide_editions do |t|
t.string :video_url
t.string :video_summary
t.boolean :hide_chapter_navigation
t.timestamps
end
end
end |
github | alphagov/publisher | https://github.com/alphagov/publisher | db/migrate/20250711143214_create_licence_edition.rb | Ruby | mit | 48 | main | 327 | class CreateLicenceEdition < ActiveRecord::Migration[7.1]
def change
create_table :licence_editions do |t|
t.string :licence_identifier
t.string :licence_short_description
t.string :licence_overview
t.string :will_continue_on
t.string :continuation_link
t.timestamps
end
e... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration_test_helper.rb | Ruby | mit | 48 | main | 3,476 | require "test_helper"
require "capybara/minitest"
require "capybara/rails"
require "capybara-select-2"
require "support/govuk_test"
class IntegrationTest < ActionDispatch::IntegrationTest
include Capybara::DSL
include Capybara::Minitest::Assertions
include CapybaraSelect2
include CapybaraSelect2::Helpers
inc... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/gmail_test_helper.rb | Ruby | mit | 48 | main | 895 | require "test_helper"
require "google/apis/gmail_v1"
require "securerandom"
require "time"
require "webmock"
def build_gmail_message(raw = "")
Google::Apis::GmailV1::Message.new(
id: SecureRandom.uuid,
label_ids: %w[UNREAD INBOX],
raw: raw,
)
end
def add_header(message, name, value)
# Add value to r... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/selenium_error_patch.rb | Ruby | mit | 48 | main | 1,320 | # Taken from https://github.com/alphagov/forms-admin/commit/5ea98767d765a396ed06cf2cba8f9afb1b10fc0e#diff-c36c07a0c7f499b1b95634f9dce1a10ebf4d10a9dee872f39f746a9efa555ddbR1-R34
# Monkey patch for a specific intermittent Selenium error.
#
# Intermittently, Selenium/Chromedriver raises `Selenium::WebDriver::Error::Unknow... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/legacy_integration_test_helper.rb | Ruby | mit | 48 | main | 5,977 | require "test_helper"
require "capybara/rails"
require "capybara-select-2"
require "support/govuk_test"
class LegacyIntegrationTest < ActionDispatch::IntegrationTest
include Capybara::DSL
include CapybaraSelect2
include CapybaraSelect2::Helpers
include Warden::Test::Helpers
teardown do
Capybara.reset_se... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/test_helper.rb | Ruby | mit | 48 | main | 3,607 | ENV["RAILS_ENV"] = "test"
# Must go at top of file
require "simplecov"
SimpleCov.start
require File.expand_path("../config/environment", __dir__)
require "rails/test_help"
require "minitest/autorun"
require "mocha/minitest"
require "webmock/minitest"
require "gds_api/test_helpers/publishing_api"
require "selenium_err... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/validators/slug_validator_test.rb | Ruby | mit | 48 | main | 1,987 | require "test_helper"
class SlugTest < ActiveSupport::TestCase
def document_with_slug(slug, kind: nil)
if kind
FactoryBot.build(:artefact, slug:, kind:)
else
FactoryBot.build(:artefact, slug:)
end
end
context "default slugs" do
should "reject url paths" do
assert_not document_w... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/validators/link_validator_test.rb | Ruby | mit | 48 | main | 2,384 | require "test_helper"
class LinkValidatorTest < ActiveSupport::TestCase
context "links" do
should "not be verified for blank govspeak fields" do
edition = FactoryBot.create(:answer_edition)
assert_nothing_raised do
edition.update!(body: nil)
end
assert_empty edition.errors
en... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/validators/safe_html_validator_test.rb | Ruby | mit | 48 | main | 1,809 | require "test_helper"
class SafeHtmlTest < ActiveSupport::TestCase
should "validate content's body" do
edition = FactoryBot.build(:edition, body: "<script>")
assert edition.invalid?
assert_includes edition.errors.attribute_names, :body
end
context "what to validate" do
should "allow clean conte... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/traits/recordable_actions_test.rb | Ruby | mit | 48 | main | 2,950 | require "test_helper"
class RecordableActionsTest < ActiveSupport::TestCase
extend Minitest::Spec::DSL
let(:object_under_test) { FactoryBot.create(:edition) }
let(:user) { FactoryBot.create(:user) }
describe "#published_by" do
it "returns who published the object" do
object_under_test.actions.creat... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/support/govuk_test.rb | Ruby | mit | 48 | main | 443 | GovukTest.configure
Capybara.register_driver :headless_chrome do |app|
chrome_options = GovukTest.headless_chrome_selenium_options
chrome_options.add_argument("--disable-web-security")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argume... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/support/tag_test_helpers.rb | Ruby | mit | 48 | main | 5,818 | module TagTestHelpers
include GdsApi::TestHelpers::PublishingApi
def stub_linkables
stub_request(:get, %r{\A#{PUBLISHING_API_V2_ENDPOINT}/expanded-links/.+})
.to_return(status: 200, body: "{}", headers: {})
stub_publishing_api_data
end
def stub_linkables_with_data
stub_request(:get, %r{\A#{... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/support/ga4_test_helpers.rb | Ruby | mit | 48 | main | 921 | module Ga4TestHelpers
def disable_form_submit
execute_script("document.querySelector('form').addEventListener('submit',function(e){e.preventDefault()})")
end
def disable_links
execute_script("document.addEventListener('click',function(e){if(e.target.href)(e.preventDefault())})")
end
def get_event_da... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/support/host_content_update_test_helpers.rb | Ruby | mit | 48 | main | 336 | module HostContentUpdateHelpers
def stub_events_for_all_content_ids(action: "HostContentUpdateJob", events: [])
Services.publishing_api.stubs(:get_events_for_content_id).with(
regexp_matches(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),
{
action:,
},
).returns(ev... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/support/downtimes_controller_parameterised_tests.rb | Ruby | mit | 48 | main | 3,375 | module DowntimesControllerParameterisedTests
def test_create_with_invalid_datetime_values
[
["start_time", "1", "", "Start time format is invalid"],
["start_time", "2", "", "Start time format is invalid"],
["start_time", "3", "", "Start time format is invalid"],
["start_time", "4", "", "St... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/support/action_processor_helpers.rb | Ruby | mit | 48 | main | 1,647 | module ActionProcessorHelpers
def request_review(user, edition)
user.progress(edition, request_type: :request_review, comment: "Review this edition please.")
end
def approve_review(user, edition)
user.progress(edition, request_type: :approve_review, comment: "I've reviewed it")
end
def send_fact_che... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/support/holidays_test_helpers.rb | Ruby | mit | 48 | main | 234 | require "gds_api/test_helpers/calendars"
module HolidaysTestHelpers
include GdsApi::TestHelpers::Calendars
def stub_holidays_used_by_fact_check
stub_calendars_has_no_bank_holidays(in_division: "england-and-wales")
end
end |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/support/presenter_test_helpers.rb | Ruby | mit | 48 | main | 809 | module PresenterTestHelpers
def it_includes_last_edited_by_editor_id
test "[:last_edited_by_editor_id] should return the creator of the edition" do
editor = FactoryBot.create(:user)
edition.actions.create!(request_type: Action::CREATE, requester: editor)
assert_equal editor.uid, result[:last_ed... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/support/factories.rb | Ruby | mit | 48 | main | 15,644 | require "factory_bot"
require "answer_edition"
require "artefact"
require "user"
FactoryBot.define do
trait :scheduled_for_publishing do
state { "scheduled_for_publishing" }
publish_at { 1.day.from_now }
end
trait :published do
state { "published" }
end
trait :ready do
state { "ready" }
e... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/support/fact_check_manager_api_helpers.rb | Ruby | mit | 48 | main | 1,234 | module FactCheckManagerApiHelpers
def stub_post_new_fact_check_request(success: true)
response = if success
GdsApi::Response.new(code: 200)
else
GdsApi::HTTPErrorResponse.new(code: 422)
end
Services.fact_check_manager_api.stubs(:post_fact_check).... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/api/fact_check_response_controller_test.rb | Ruby | mit | 48 | main | 5,245 | require "integration_test_helper"
class FactCheckResponseControllerTest < IntegrationTest
setup do
@test_strategy.switch!(:fact_check_manager_api, true)
@edition = FactoryBot.create(:answer_edition, :fact_check)
end
def invalid_non_strings
[123, %w[invalid], { invalid: true }, true]
end
context ... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/request_tracing_test.rb | Ruby | mit | 48 | main | 2,446 | require "legacy_integration_test_helper"
class RequestTracingTest < LegacyIntegrationTest
setup do
setup_users
stub_register_published_content
end
test "govuk_request_id is passed downstream across the worker boundary on publish" do
Sidekiq::Testing.fake! do
inbound_headers = { "HTTP_GOVUK_REQ... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_related_links_test.rb | Ruby | mit | 48 | main | 5,572 | require "integration_test_helper"
class EditionRelatedLinksTest < IntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
login_as(@govuk_editor)
@draft_edition = FactoryBot.create(:edition, :draft)
visit edition_path(@draft_edition)
click_link "Relate... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/ga4_tracking_downtime_test.rb | Ruby | mit | 48 | main | 3,091 | require "integration_test_helper"
require "support/ga4_test_helpers"
class Ga4DowntimeTest < JavascriptIntegrationTest
include Ga4TestHelpers
setup do
setup_users
@edition = FactoryBot.create(:transaction_edition, :published)
@test_strategy.switch!(:ga4_form_tracking, true)
end
context "Add downt... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/healthcheck_test.rb | Ruby | mit | 48 | main | 2,528 | require "legacy_integration_test_helper"
class HealthcheckTest < LegacyIntegrationTest
def json
JSON.parse(response.body)
end
context "live check" do
should "return a 200 OK when maintenance mode is implicitly disabled" do
get "/healthcheck/live"
assert_response :success
end
should ... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_tab_test.rb | Ruby | mit | 48 | main | 2,633 | require "legacy_integration_test_helper"
class EditionTabTest < LegacyJavascriptIntegrationTest
setup do
setup_users
stub_linkables
stub_holidays_used_by_fact_check
stub_events_for_all_content_ids
stub_users_from_signon_api
UpdateWorker.stubs(:perform_async)
@simple_smart_answer = Factor... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/fact_check_email_test.rb | Ruby | mit | 48 | main | 6,037 | require "legacy_integration_test_helper"
require "gmail_test_helper"
class FactCheckEmailTest < LegacyIntegrationTest
def fact_check_mail_for(edition, attrs = {})
base_mail = Mail.new do
from attrs.fetch(:from, "foo@example.com")
to attrs.fetch(:to, edition && edition.fact_check_email_ad... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/skip_review_test.rb | Ruby | mit | 48 | main | 2,101 | require "legacy_integration_test_helper"
class SkipReviewTest < LegacyJavascriptIntegrationTest
setup do
@permitted_user = FactoryBot.create(
:user,
name: "Vincent Panache",
email: "test@example.com",
permissions: %w[skip_review govuk_editor],
)
stub_linkables
stub_holidays_u... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_edit_test.rb | Ruby | mit | 48 | main | 8,500 | require "integration_test_helper"
class EditionEditTest < IntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
@govuk_requester = FactoryBot.create(:user, :govuk_editor, name: "Stub requester")
login_as(@govuk_editor)
UpdateWorker.stubs(:perform_async)
... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_workflow_test.rb | Ruby | mit | 48 | main | 18,932 | require "integration_test_helper"
class EditionWorkflowTest < IntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
@govuk_requester = FactoryBot.create(:user, :govuk_editor, name: "Stub requester")
login_as(@govuk_editor)
stub_holidays_used_by_fact_check... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/downtime_integration_test.rb | Ruby | mit | 48 | main | 3,591 | require "integration_test_helper"
class DowntimeIntegrationTest < JavascriptIntegrationTest
setup do
setup_users
@edition = FactoryBot.create(
:transaction_edition,
:published,
title: "Apply to become a driving instructor",
slug: "apply-to-become-a-driving-instructor",
)
Web... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/legacy_redirect_test.rb | Ruby | mit | 48 | main | 441 | require "legacy_integration_test_helper"
class LegacyRedirect < LegacyIntegrationTest
should "redirect requests for the old index to the new one" do
get "/admin"
assert_response :redirect
assert_redirected_to "/"
end
should "redirect requests for an old edition path to a new one" do
get "/admin/... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/previous_edition_differences_test.rb | Ruby | mit | 48 | main | 2,385 | require "legacy_integration_test_helper"
class PreviousEditionDifferencesTest < LegacyJavascriptIntegrationTest
setup do
stub_register_published_content
setup_users
stub_linkables
stub_holidays_used_by_fact_check
stub_events_for_all_content_ids
stub_users_from_signon_api
@first_edition =... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/ga4_tracking_edit_test.rb | Ruby | mit | 48 | main | 20,987 | require "integration_test_helper"
require "support/ga4_test_helpers"
class Ga4TrackingEditTest < JavascriptIntegrationTest
include Ga4TestHelpers
setup do
setup_users
@edition = FactoryBot.create(:answer_edition, title: "Answer edition")
@guide_edition = FactoryBot.create(:guide_edition, title: "Guid... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/ga4_tracking_unpublish_test.rb | Ruby | mit | 48 | main | 2,071 | require "integration_test_helper"
require "support/ga4_test_helpers"
class Ga4TrackingUnpublishTest < JavascriptIntegrationTest
include Ga4TestHelpers
setup do
setup_users
@edition = FactoryBot.create(:answer_edition, state: "published", title: "Answer edition")
@test_strategy.switch!(:ga4_form_tracki... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/ga4_tracking_admin_test.rb | Ruby | mit | 48 | main | 895 | require "integration_test_helper"
require "support/ga4_test_helpers"
class Ga4TrackingAdminTest < JavascriptIntegrationTest
include Ga4TestHelpers
setup do
setup_users
@edition = FactoryBot.create(:answer_edition, title: "Answer edition")
@test_strategy.switch!(:ga4_form_tracking, true)
end
conte... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/simple_smart_answers_test.rb | Ruby | mit | 48 | main | 22,106 | require "legacy_integration_test_helper"
class SimpleSmartAnswersTest < LegacyJavascriptIntegrationTest
setup do
@artefact = FactoryBot.create(
:artefact,
slug: "can-i-get-a-driving-licence",
kind: "simple_smart_answer",
owning_app: "publisher",
name: "Can I get a driving licence?",... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/mark_edition_in_beta_test.rb | Ruby | mit | 48 | main | 1,141 | require "legacy_integration_test_helper"
class MarkEditionInBetaTest < LegacyJavascriptIntegrationTest
setup do
setup_users
stub_linkables
stub_holidays_used_by_fact_check
stub_events_for_all_content_ids
stub_users_from_signon_api
UpdateWorker.stubs(:perform_async)
end
with_and_without_j... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_history_js_test.rb | Ruby | mit | 48 | main | 847 | require "integration_test_helper"
class EditionHistoryJSTest < JavascriptIntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
login_as(@govuk_editor)
stub_events_for_all_content_ids
stub_users_from_signon_api
end
context "History and notes tab" do
... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/downtime_with_invalid_dates_test.rb | Ruby | mit | 48 | main | 4,616 | require "integration_test_helper"
class DowntimeWithInvalidDates < IntegrationTest
setup do
setup_users
@edition = FactoryBot.create(
:transaction_edition,
:published,
title: "Apply to become a driving instructor",
slug: "apply-to-become-a-driving-instructor",
)
WebMock.rese... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_history_test.rb | Ruby | mit | 48 | main | 20,233 | require "integration_test_helper"
class EditionHistoryTest < IntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
login_as(@govuk_editor)
stub_events_for_all_content_ids
stub_users_from_signon_api
UpdateWorker.stubs(:perform_async)
end
context "... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edit_artefact_test.rb | Ruby | mit | 48 | main | 1,039 | require "legacy_integration_test_helper"
class EditArtefactTest < LegacyIntegrationTest
setup do
setup_users
stub_linkables
stub_holidays_used_by_fact_check
stub_events_for_all_content_ids
stub_users_from_signon_api
end
should "edit a draft artefact" do
edition = FactoryBot.create(:simpl... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/ga4_tracking_tagging_test.rb | Ruby | mit | 48 | main | 18,898 | require "integration_test_helper"
require "support/ga4_test_helpers"
class Ga4TrackingTaggingTest < JavascriptIntegrationTest
include Ga4TestHelpers
setup do
FactoryBot.create(:user, :govuk_editor, name: "Test User")
@govuk_requester = FactoryBot.create(:user, :govuk_editor, :skip_review)
@edition = F... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_admin_test.rb | Ruby | mit | 48 | main | 7,650 | require "integration_test_helper"
class EditionAdminTest < IntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
login_as(@govuk_editor)
end
context "user does not have required permissions" do
setup do
@draft_edition = FactoryBot.create(:edition, ... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_workflow_fact_check_api_test.rb | Ruby | mit | 48 | main | 5,099 | require "integration_test_helper"
class EditionWorkflowFactCheckApiTest < IntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
login_as(@govuk_editor)
@test_strategy.switch!(:fact_check_manager_api, true)
stub_holidays_used_by_fact_check
stub_events_... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_major_change_test.rb | Ruby | mit | 48 | main | 1,832 | require "legacy_integration_test_helper"
class EditionMajorChangeTest < LegacyJavascriptIntegrationTest
setup do
setup_users
stub_linkables
stub_holidays_used_by_fact_check
stub_events_for_all_content_ids
stub_users_from_signon_api
UpdateWorker.stubs(:perform_async)
end
teardown do
G... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_edit_assignee_test.rb | Ruby | mit | 48 | main | 4,551 | require "integration_test_helper"
class EditionEditAssigneeTest < IntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
@govuk_requester = FactoryBot.create(:user, :govuk_editor, name: "Stub requester")
login_as(@govuk_editor)
UpdateWorker.stubs(:perform_... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/add_artefact_js_test.rb | Ruby | mit | 48 | main | 576 | require "integration_test_helper"
class AddArtefactJsTest < JavascriptIntegrationTest
setup do
setup_users
end
context "auto-population of an artefact's slug from its title when JS is enabled" do
should "auto-populate the artefact's slug from the title" do
visit root_path
click_link "Create ... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_metadata_test.rb | Ruby | mit | 48 | main | 3,943 | require "integration_test_helper"
class EditionMetadataTest < IntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
login_as(@govuk_editor)
UpdateWorker.stubs(:perform_async)
end
context "when state is 'draft' and user has govuk editor permissions" do
... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/host_content_update_history_test.rb | Ruby | mit | 48 | main | 4,325 | require "legacy_integration_test_helper"
class HostContentUpdateHistoryTest < LegacyJavascriptIntegrationTest
setup do
setup_users
stub_linkables
stub_holidays_used_by_fact_check
end
context "Viewing content update history" do
setup do
user1 = {
"uid" => SecureRandom.uuid,
... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/ga4_tracking_add_artefact_test.rb | Ruby | mit | 48 | main | 2,747 | require "integration_test_helper"
require "support/ga4_test_helpers"
class Ga4TrackingAddArtefactTest < JavascriptIntegrationTest
include Ga4TestHelpers
setup do
setup_users
@test_strategy.switch!(:ga4_form_tracking, true)
end
context "Create new content page one" do
setup do
visit new_art... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_scheduled_publishing_test.rb | Ruby | mit | 48 | main | 2,543 | require "legacy_integration_test_helper"
class EditionScheduledPublishingTest < LegacyJavascriptIntegrationTest
setup do
setup_users
stub_linkables
stub_holidays_used_by_fact_check
stub_events_for_all_content_ids
stub_users_from_signon_api
# queue up the edition, don't perform inline
Side... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/ga4_tracking_metadata_test.rb | Ruby | mit | 48 | main | 2,657 | require "integration_test_helper"
require "support/ga4_test_helpers"
class Ga4TrackingMetadataTest < JavascriptIntegrationTest
include Ga4TestHelpers
setup do
FactoryBot.create(:user, :govuk_editor, name: "Test User")
@govuk_requester = FactoryBot.create(:user, :govuk_editor, :skip_review)
@edition = ... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/legacy_edition_edit_test.rb | Ruby | mit | 48 | main | 1,292 | # frozen_string_literal: true
require "legacy_integration_test_helper"
class LegacyEditionEditTest < LegacyIntegrationTest
setup do
setup_users
stub_linkables
stub_holidays_used_by_fact_check
stub_events_for_all_content_ids
stub_users_from_signon_api
UpdateWorker.stubs(:perform_async)
end
... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/ga4_tracking_publications_test.rb | Ruby | mit | 48 | main | 22,498 | require "integration_test_helper"
require "support/ga4_test_helpers"
class Ga4TrackingPublicationsTest < JavascriptIntegrationTest
include Ga4TestHelpers
setup do
setup_users
@draft_edition = FactoryBot.create(:answer_edition, :draft, title: "Test edition one", assigned_to: @author, updated_at: 1.day.ago... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_tagging_test.rb | Ruby | mit | 48 | main | 36,122 | require "integration_test_helper"
class EditionTaggingTest < IntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
login_as(@govuk_editor)
stub_linkables
end
context "tagging tab" do
context "No tagging is set" do
setup do
@draft_editio... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/delete_edition_test.rb | Ruby | mit | 48 | main | 1,564 | require "legacy_integration_test_helper"
class DeleteEditionTest < LegacyIntegrationTest
setup do
setup_users
stub_linkables
stub_holidays_used_by_fact_check
stub_events_for_all_content_ids
stub_users_from_signon_api
end
teardown do
GDS::SSO.test_user = nil
end
context "when an arte... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/legacy_edition_history_test.rb | Ruby | mit | 48 | main | 9,056 | require "legacy_integration_test_helper"
class LegacyEditionHistoryTest < LegacyJavascriptIntegrationTest
setup do
setup_users
stub_linkables
stub_holidays_used_by_fact_check
stub_events_for_all_content_ids
stub_users_from_signon_api
UpdateWorker.stubs(:perform_async)
end
context "viewin... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_edit_js_test.rb | Ruby | mit | 48 | main | 17,027 | require "integration_test_helper"
class EditionEditJSTest < JavascriptIntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
login_as(@govuk_editor)
end
context "Edit tab" do
context "Unsaved changes validation prompt" do
setup do
visit_edit... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/legacy_change_edition_type_test.rb | Ruby | mit | 48 | main | 1,516 | require "legacy_integration_test_helper"
class LegacyChangeEditionTypeTest < LegacyIntegrationTest
setup do
stub_linkables
FactoryBot.create(:user, :govuk_editor)
stub_holidays_used_by_fact_check
stub_events_for_all_content_ids
stub_users_from_signon_api
UpdateWorker.stubs(:perform_async)
e... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/user_search_test.rb | Ruby | mit | 48 | main | 3,454 | require_relative "../legacy_integration_test_helper"
class UserSearchTest < LegacyIntegrationTest
setup do
alice = FactoryBot.create(:user, name: "Alice", uid: "alice")
GDS::SSO.test_user = alice
@user = alice
end
test "filtering by assigned user" do
@guide = FactoryBot.create(:guide_edition)
... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/homepage_popular_links_test.rb | Ruby | mit | 48 | main | 7,109 | require "integration_test_helper"
class HomepagePopularLinksTest < IntegrationTest
context "no homepage editor access" do
setup do
login_as(FactoryBot.create(:user, name: "Stub User"))
@popular_links = FactoryBot.create(:popular_links, state: "published")
visit_popular_links
end
should... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/ga4_tracking_flash_messages_test.rb | Ruby | mit | 48 | main | 4,293 | require "integration_test_helper"
require "support/ga4_test_helpers"
class Ga4TrackingFlashMessagesTest < JavascriptIntegrationTest
include Ga4TestHelpers
setup do
setup_users
@edition = FactoryBot.create(:edition)
@ready_edition = FactoryBot.create(:edition, :ready)
@published_edition = FactoryBo... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/unpublish_test.rb | Ruby | mit | 48 | main | 2,397 | require "legacy_integration_test_helper"
class UnpublishTest < LegacyIntegrationTest
setup do
@artefact = FactoryBot.create(
:artefact,
slug: "bertie-botts-every-flavour-beans",
kind: "answer",
name: "Bertie Bott's Every Flavour Beans",
owning_app: "publisher",
)
@edition =... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/change_edition_type_test.rb | Ruby | mit | 48 | main | 834 | require "integration_test_helper"
class ChangeEditionTypeTest < IntegrationTest
setup do
stub_linkables
FactoryBot.create(:user, :govuk_editor)
stub_holidays_used_by_fact_check
stub_events_for_all_content_ids
stub_users_from_signon_api
UpdateWorker.stubs(:perform_async)
end
NON_TRANSITIO... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/legacy_edition_workflow_test.rb | Ruby | mit | 48 | main | 25,951 | require "legacy_integration_test_helper"
require "gds_api/test_helpers/calendars"
class LegacyEditionWorkflowTest < LegacyJavascriptIntegrationTest
include GdsApi::TestHelpers::Calendars
attr_reader :alice, :bob
setup do
stub_linkables
stub_holidays_used_by_fact_check
stub_events_for_all_content_ids... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/get_content_by_content_id_test.rb | Ruby | mit | 48 | main | 1,867 | require "integration_test_helper"
class GetContentByContentIdTest < IntegrationTest
def setup
login_as_stub_user
@artefact = FactoryBot.create(:artefact, name: "browser extension test")
end
context "Content items that have only one edition, in the draft state" do
should "redirect to the find_content... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/routes_test.rb | Ruby | mit | 48 | main | 3,521 | require "legacy_integration_test_helper"
class RoutesTest < LegacyIntegrationTest
should "route to downtimes controller for edit downtime" do
edition = FactoryBot.create(:edition)
edition_id = edition.id.to_s
assert_routing("/editions/#{edition_id}/downtime/edit", controller: "downtimes", action: "edit"... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/ga4_tracking_toggle_test.rb | Ruby | mit | 48 | main | 1,095 | require "integration_test_helper"
class Ga4TrackingToggleTest < IntegrationTest
setup do
FactoryBot.create(:user, :govuk_editor)
@edition = FactoryBot.create(:edition)
end
context "'ga4_form_tracking' feature toggle is disabled" do
setup do
@test_strategy.switch!(:ga4_form_tracking, false)
... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/ga4_tracking_history_notes_test.rb | Ruby | mit | 48 | main | 2,481 | require "integration_test_helper"
require "support/ga4_test_helpers"
class Ga4TrackingHistoryNotesTest < JavascriptIntegrationTest
include Ga4TestHelpers
setup do
setup_users
@edition = FactoryBot.create(:answer_edition, title: "Answer edition")
@test_strategy.switch!(:ga4_form_tracking, true)
end
... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/ga4_tracking_related_external_links_test.rb | Ruby | mit | 48 | main | 7,516 | require "integration_test_helper"
require "support/ga4_test_helpers"
class Ga4TrackingRelatedExternalLinksTest < JavascriptIntegrationTest
include Ga4TestHelpers
setup do
setup_users
@edition = FactoryBot.create(:answer_edition, title: "Answer edition")
@test_strategy.switch!(:ga4_form_tracking, true)... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/publications_page_js_test.rb | Ruby | mit | 48 | main | 15,094 | require "integration_test_helper"
class PublicationsPageJSTest < JavascriptIntegrationTest
setup do
@other_user = FactoryBot.create(:user, name: "Other User")
login_as_govuk_editor
end
context "2i-queue page" do
context "English tab" do
setup do
@claimed_edition = FactoryBot.create(:an... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/add_artefact_test.rb | Ruby | mit | 48 | main | 5,343 | require "integration_test_helper"
class AddArtefactTest < IntegrationTest
setup do
setup_users
stub_linkables
stub_holidays_used_by_fact_check
stub_events_for_all_content_ids
stub_users_from_signon_api
UpdateWorker.stubs(:perform_async)
end
slug_prefix_for_kind = [%w[help_page help/], %w... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/tagging_test.rb | Ruby | mit | 48 | main | 9,591 | require "legacy_integration_test_helper"
class TaggingTest < LegacyJavascriptIntegrationTest
setup do
setup_users
stub_linkables
stub_holidays_used_by_fact_check
stub_publishing_api_has_lookups({})
stub_events_for_all_content_ids
stub_users_from_signon_api
@edition = FactoryBot.create(:s... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/publications_page_test.rb | Ruby | mit | 48 | main | 23,977 | # frozen_string_literal: true
require_relative "../integration_test_helper"
class PublicationsPageTest < IntegrationTest
setup do
@other_user = FactoryBot.create(:user, name: "Other User")
login_as_govuk_editor
end
context "my_content page" do
should "redirect to the my-content page when visiting t... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_edit_tab/edit_published_edition_test.rb | Ruby | mit | 48 | main | 23,463 | require "integration_test_helper"
class EditPublishedEditionTest < IntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
login_as(@govuk_editor)
end
should "show common content-type fields" do
published_edition = FactoryBot.create(:edition, :published, i... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_edit_tab/edit_archived_edition_test.rb | Ruby | mit | 48 | main | 3,318 | require "integration_test_helper"
class EditArchivedEditionTest < IntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
login_as(@govuk_editor)
@archived_edition = FactoryBot.create(:edition, :archived)
end
should "show a message when all editions are un... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_edit_tab/edit_scheduled_for_publishing_edition_test.rb | Ruby | mit | 48 | main | 6,900 | require "integration_test_helper"
class EditScheduledForPublishingTest < IntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
login_as(@govuk_editor)
@scheduled_for_publishing_edition = FactoryBot.create(:edition, :scheduled_for_publishing)
visit editio... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_edit_tab/edit_in_review_edition_test.rb | Ruby | mit | 48 | main | 15,457 | require "integration_test_helper"
class EditInReviewEditionTest < IntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
@govuk_requester = FactoryBot.create(:user, :govuk_editor, name: "Stub requester")
login_as(@govuk_editor)
end
context "user has the r... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_edit_tab/edit_draft_guide_edition_js_test.rb | Ruby | mit | 48 | main | 5,226 | require "integration_test_helper"
class EditDraftGuideEditionJsTest < JavascriptIntegrationTest
context "auto-population of a chapter's slug from its title when JS is enabled" do
setup do
login_as_govuk_editor
end
should "auto-populate the chapter's slug from the title" do
@draft_edition = F... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_edit_tab/edit_draft_edition_test.rb | Ruby | mit | 48 | main | 48,362 | require "integration_test_helper"
class EditDraftEditionTest < IntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
login_as(@govuk_editor)
UpdateWorker.stubs(:perform_async)
end
context "draft edition of a new publication" do
context "answer editio... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_edit_tab/edit_fact_check_received_edition_test.rb | Ruby | mit | 48 | main | 7,076 | require "integration_test_helper"
class EditFactCheckReceivedEditionTest < IntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
@govuk_requester = FactoryBot.create(:user, :govuk_editor, name: "Stub requester")
login_as(@govuk_editor)
@fact_check_receive... |
github | alphagov/publisher | https://github.com/alphagov/publisher | test/integration/edition_edit_tab/edit_fact_check_edition_test.rb | Ruby | mit | 48 | main | 4,908 | require "integration_test_helper"
class EditFactCheckEditionTest < IntegrationTest
setup do
@govuk_editor = FactoryBot.create(:user, :govuk_editor, name: "Stub User")
@govuk_requester = FactoryBot.create(:user, :govuk_editor, name: "Stub requester")
login_as(@govuk_editor)
@fact_check_edition = Facto... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.