Sha256: e534b1546317db5607b70c0759626a3612e5b8760ffa1931c5778f42b7a61f63

Contents?: true

Size: 1.2 KB

Versions: 133

Compression:

Stored size: 1.2 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.build(:help_page_edition, :panopticon_id => @artefact.id)
    h.body = "I'm a help page."
    h.safely.save!

    h = HelpPageEdition.first
    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

133 entries across 133 versions & 1 rubygems

Version Path
govuk_content_models-26.0.0 test/models/help_page_edition_test.rb
govuk_content_models-25.0.0 test/models/help_page_edition_test.rb
govuk_content_models-24.2.0 test/models/help_page_edition_test.rb
govuk_content_models-24.1.0 test/models/help_page_edition_test.rb
govuk_content_models-24.0.1 test/models/help_page_edition_test.rb
govuk_content_models-24.0.0 test/models/help_page_edition_test.rb
govuk_content_models-23.0.0 test/models/help_page_edition_test.rb
govuk_content_models-22.2.0 test/models/help_page_edition_test.rb
govuk_content_models-22.1.2 test/models/help_page_edition_test.rb
govuk_content_models-22.1.1 test/models/help_page_edition_test.rb
govuk_content_models-22.1.0 test/models/help_page_edition_test.rb
govuk_content_models-22.0.0 test/models/help_page_edition_test.rb
govuk_content_models-21.0.0 test/models/help_page_edition_test.rb
govuk_content_models-20.2.0 test/models/help_page_edition_test.rb
govuk_content_models-20.1.0 test/models/help_page_edition_test.rb
govuk_content_models-20.0.0 test/models/help_page_edition_test.rb
govuk_content_models-19.0.0 test/models/help_page_edition_test.rb
govuk_content_models-18.0.0 test/models/help_page_edition_test.rb
govuk_content_models-17.2.1 test/models/help_page_edition_test.rb
govuk_content_models-17.1.1 test/models/help_page_edition_test.rb