# encoding: UTF-8
require 'rails_helper'
describe DashboardController, type: :controller do
  before :each do
    setup_supplier_for_controller
  end

  describe "GET #table_qr_image" 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>]
    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>]
    end
  end
end
