consul/consul

View on GitHub
spec/components/sdg/goals/tag_cloud_component_spec.rb

Summary

Maintainability
A
0 mins
Test Coverage
require "rails_helper"

describe SDG::Goals::TagCloudComponent do
  before do
    Setting["feature.sdg"] = true
    Setting["sdg.process.debates"] = true
    Setting["sdg.process.proposals"] = true
  end

  it "renders a title" do
    component = SDG::Goals::TagCloudComponent.new("Debate")

    render_inline component

    expect(page).to have_content "Filters by SDG"
  end

  it "renders all goals ordered by code" do
    component = SDG::Goals::TagCloudComponent.new("Proposal")

    render_inline component

    expect(page).to have_css ".sdg-goal-icon", count: 17
    expect(page.first("a")[:title]).to end_with "goal 1"
    expect(page.all("a").last[:title]).to end_with "goal 17"
  end
end