Browse Source

test: pick the simplest format for the tag helper tests

pull/987/head
Sam Seed 4 years ago
parent
commit
4ac96bc51a
  1. 35
      spec/helpers/tag_helper_spec.rb

35
spec/helpers/tag_helper_spec.rb

@ -9,39 +9,10 @@ RSpec.describe TagHelper do
expect(status_tag(lettings_log.status)).to eq("<strong class=\"govuk-tag govuk-tag--blue\">In progress</strong>") expect(status_tag(lettings_log.status)).to eq("<strong class=\"govuk-tag govuk-tag--blue\">In progress</strong>")
end end
context "when status is 'Not started'" do it "returns tag with correct status text and colour and custom class" do
it "returns tag with correct status text and colour and custom class" do expect(status_tag("not_started", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--grey app-tag--small\">Not started</strong>")
expect(status_tag("not_started", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--grey app-tag--small\">Not started</strong>") expect(status_tag("cannot_start_yet", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--grey app-tag--small\">Cannot start yet</strong>")
end
end end
context "when status is 'Cannot start yet'" do
it "returns tag with correct status text and colour and custom class" do
expect(status_tag("cannot_start_yet", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--grey app-tag--small\">Cannot start yet</strong>")
end
end
context "when status is 'Not started'" do
it "returns tag with correct status text and colour and custom class" do
code = "not_started"
text = "Not started"
colour = "grey"
expect(status_tag(code, "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--#{colour} app-tag--small\">#{text}</strong>")
end
end
context "when status is 'Cannot start yet'" do
it "returns tag with correct status text and colour and custom class" do
code = "cannot_start_yet"
text = "Cannot start yet"
colour = "grey"
expect(status_tag(code, "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--#{colour} app-tag--small\">#{text}</strong>")
end
it "returns tag with correct status text and colour and custom class" do
expect(status_tag("not_started", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--grey app-tag--small\">Not started</strong>")
expect(status_tag("cannot_start_yet", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--grey app-tag--small\">Cannot start yet</strong>")
end
end end
end end
end end

Loading…
Cancel
Save