Browse Source

test: start adding status tag tests

pull/987/head
Sam Seed 4 years ago
parent
commit
439c56a3a8
  1. 31
      spec/helpers/tag_helper_spec.rb

31
spec/helpers/tag_helper_spec.rb

@ -9,8 +9,39 @@ 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>")
end 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

Loading…
Cancel
Save