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-34.0.0 test/models/help_page_edition_test.rb
govuk_content_models-33.0.0 test/models/help_page_edition_test.rb
govuk_content_models-32.3.1 test/models/help_page_edition_test.rb
govuk_content_models-32.3.0 test/models/help_page_edition_test.rb
govuk_content_models-32.2.0 test/models/help_page_edition_test.rb
govuk_content_models-32.1.0 test/models/help_page_edition_test.rb
govuk_content_models-32.0.0 test/models/help_page_edition_test.rb
govuk_content_models-31.4.0 test/models/help_page_edition_test.rb
govuk_content_models-31.3.0 test/models/help_page_edition_test.rb
govuk_content_models-31.2.2 test/models/help_page_edition_test.rb
govuk_content_models-31.2.1 test/models/help_page_edition_test.rb
govuk_content_models-31.2.0 test/models/help_page_edition_test.rb
govuk_content_models-31.1.0 test/models/help_page_edition_test.rb
govuk_content_models-31.0.0 test/models/help_page_edition_test.rb
govuk_content_models-30.0.0 test/models/help_page_edition_test.rb
govuk_content_models-29.1.2 test/models/help_page_edition_test.rb
govuk_content_models-29.1.1 test/models/help_page_edition_test.rb
govuk_content_models-29.1.0 test/models/help_page_edition_test.rb
govuk_content_models-29.0.1 test/models/help_page_edition_test.rb
govuk_content_models-29.0.0 test/models/help_page_edition_test.rb