DFE-Digital/govuk-formbuilder

View on GitHub
spec/support/shared/shared_supports_branding_examples.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
shared_examples 'a field that supports custom branding' do
  let(:default_brand) { 'govuk' }
  let(:custom_brand) { 'globex-corp' }

  before do
    GOVUKDesignSystemFormBuilder.configure do |conf|
      conf.brand = custom_brand
    end
  end

  after { GOVUKDesignSystemFormBuilder.reset! }

  specify 'should contain the custom branding' do
    expect(subject).to match(Regexp.new(custom_brand))
  end

  specify 'should not contain any default branding' do
    expect(subject).not_to match(Regexp.new(default_brand))
  end
end