Sha256: f85627bc8efc78d5602adfc463059ae77f72eb6b646b9e8416ef0916699996aa

Contents?: true

Size: 1.06 KB

Versions: 11

Compression:

Stored size: 1.06 KB

Contents

require "test_helper"

class HelpPageEditionTest < ActiveSupport::TestCase
  setup do
    @artefact = FactoryGirl.create(:artefact, kind: 'help_page', slug: "help/foo")
  end

  should "have correct extra fields" do
    h = FactoryGirl.create(
      :help_page_edition,
      panopticon_id: @artefact.id,
      body: "I'm a help page.",
    )

    assert_equal "I'm a help page.", h.body
  end

  should "give a friendly (legacy supporting) description of its format" do
    help_page = HelpPageEdition.new
    assert_equal "HelpPage", help_page.format
  end

  should "return the body as whole_body" do
    h = FactoryGirl.build(
      :help_page_edition,
      panopticon_id: @artefact.id,
      body: "Something",
    )
    assert_equal h.body, h.whole_body
  end

  should "clone extra fields when cloning edition" do
    help_page = FactoryGirl.create(
      :help_page_edition,
      panopticon_id: @artefact.id,
      state: "published",
      body: "I'm very helpful",
    )

    new_help_page = help_page.build_clone
    assert_equal help_page.body, new_help_page.body
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
govuk_content_models-42.0.0 test/models/help_page_edition_test.rb
govuk_content_models-41.1.1 test/models/help_page_edition_test.rb
govuk_content_models-41.1.0 test/models/help_page_edition_test.rb
govuk_content_models-41.0.0 test/models/help_page_edition_test.rb
govuk_content_models-40.0.0 test/models/help_page_edition_test.rb
govuk_content_models-39.0.0 test/models/help_page_edition_test.rb
govuk_content_models-38.0.0 test/models/help_page_edition_test.rb
govuk_content_models-37.0.0 test/models/help_page_edition_test.rb
govuk_content_models-36.0.0 test/models/help_page_edition_test.rb
govuk_content_models-35.0.1 test/models/help_page_edition_test.rb
govuk_content_models-35.0.0 test/models/help_page_edition_test.rb