consul/consul

View on GitHub
spec/components/application_component_spec.rb

Summary

Maintainability
A
0 mins
Test Coverage
require "rails_helper"

describe ApplicationComponent do
  it "uses custom translations if present" do
    I18nContent.update([{ id: "shared.yes", values: { "value_en" => "Affirmative" }}])

    component_class = Class.new(ApplicationComponent) do
      def call
        sanitize(t("shared.yes"))
      end

      def self.name
        ""
      end
    end

    render_inline component_class.new

    expect(page).to be_rendered with: "<p>Affirmative</p>"
  end
end