require "rails_helper" RSpec.describe GovukDesignSystem::TextareaHelper, type: :helper do describe "#govukTextarea" do it "when hint is included returns the correct HTML" do html = helper.govukTextarea({ name: "more-detail", id: "more-detail", label: { text: "Can you provide more detail?", classes: "govuk-label--l", isPageHeading: true }, hint: { text: "Do not include personal or financial information, like your National Insurance number or credit card details." } }) expect(html).to match_html(<<~HTML)

Do not include personal or financial information, like your National Insurance number or credit card details.
HTML end it "when there is an error message is returns the correct HTML" do html = helper.govukTextarea({ name: "more-detail", id: "more-detail", label: { text: "Can you provide more detail?", classes: "govuk-label--l", isPageHeading: true }, hint: { text: "Do not include personal or financial information, like your National Insurance number or credit card details." }, errorMessage: { text: "Enter more detail" } }) expect(html).to match_html(<<~HTML)

Do not include personal or financial information, like your National Insurance number or credit card details.

Error: Enter more detail

HTML end end end