make more specs work

This commit is contained in:
2025-09-23 17:45:00 -05:00
parent 6596693238
commit 7dadb28004
7 changed files with 84 additions and 52 deletions
@@ -1,5 +1,6 @@
# encoding: UTF-8
require 'rails_helper'
describe DashboardController, type: :controller do
before :each do
setup_supplier_for_controller
@@ -9,13 +10,19 @@ describe DashboardController, type: :controller do
it "does render the svg image" do
table = create :table, supplier: @supplier, number: 7
get :table_qr_image, params: {table_id: table.id}, format: :svg
expect(response.body).to include %[id="tspan3801">7</tspan>]
doc = Nokogiri.parse(response.body)
element = doc.at_css('#tspan3801')
#expect(response.body).to include %[id="tspan3801">7</tspan>]
expect(element.text).to eq '7'
end
it "does render the svg image with table label if present" do
table = create :table, supplier: @supplier, number: 7, label: "The love seat"
get :table_qr_image, params: {table_id: table.id}, format: :svg
expect(response.body).to include %[id="tspan3801">7 - The love seat</tspan>]
doc = Nokogiri.parse(response.body)
element = doc.at_css('#tspan3801')
#expect(response.body).to include %[id="tspan3801">7 - The love seat</tspan>]
expect(element.text).to eq '7 - The love seat'
end
end
end