require "routing/shared_examples"

describe "routes for HostController" do
  let(:controller_name) { "host" }

  it_behaves_like "A controller that has advanced search routes"
  it_behaves_like "A controller that has compare routes"
  it_behaves_like "A controller that has dialog runner routes"
  it_behaves_like "A controller that has download_data routes"
  it_behaves_like "A controller that has show list routes"
  it_behaves_like "A controller that has tagging routes"
  it_behaves_like "A controller that has timeline routes"

  describe "#advanced_settings" do
    it "routes with GET" do
      expect(get("/host/advanced_settings")).to route_to("host#advanced_settings")
    end

    it "routes with POST" do
      expect(post("/host/advanced_settings")).to route_to("host#advanced_settings")
    end
  end

  describe "#button" do
    it "routes with POST" do
      expect(post("/host/button")).to route_to("host#button")
    end
  end

  describe "#dialog_load" do
    it "routes with GET" do
      expect(get("/host/dialog_load")).to route_to("host#dialog_load")
    end
  end

  describe "#drift" do
    it "routes with GET" do
      expect(get("/host/drift")).to route_to("host#drift")
    end
  end

  describe "#drift_all" do
    it "routes with POST" do
      expect(post("/host/drift_all")).to route_to("host#drift_all")
    end
  end

  describe "#drift_compress" do
    it "routes with POST" do
      expect(post("/host/drift_compress")).to route_to("host#drift_compress")
    end
  end

  describe "#drift_differences" do
    it "routes with POST" do
      expect(post("/host/drift_differences")).to route_to("host#drift_differences")
    end
  end

  describe "#drift_history" do
    it "routes with GET" do
      expect(get("/host/drift_history")).to route_to("host#drift_history")
    end
  end

  describe "#drift_mode" do
    it "routes with POST" do
      expect(post("/host/drift_mode")).to route_to("host#drift_mode")
    end
  end

  describe "#drift_same" do
    it "routes with POST" do
      expect(post("/host/drift_same")).to route_to("host#drift_same")
    end
  end

  describe "drift_to_csv" do
    it "routes with GET" do
      expect(get("/host/drift_to_csv")).to route_to("host#drift_to_csv")
    end
  end

  describe "drift_to_pdf" do
    it "routes with GET" do
      expect(get("/host/drift_to_pdf")).to route_to("host#drift_to_pdf")
    end
  end

  describe "#drift_to_txt" do
    it "routes with GET" do
      expect(get("/host/drift_to_txt")).to route_to("host#drift_to_txt")
    end
  end

  describe "#filesystem_download" do
    it 'routes with GET' do
      expect(get("/#{controller_name}/filesystem_download")).to route_to("#{controller_name}#filesystem_download")
    end
  end

  describe "#filesystems" do
    it "routes with GET" do
      expect(get("/host/filesystems")).to route_to("host#filesystems")
    end

    it "routes with POST" do
      expect(post("/host/filesystems")).to route_to("host#filesystems")
    end
  end

  describe "#firewall_rules" do
    it "routes with GET" do
      expect(get("/host/firewall_rules")).to route_to("host#firewall_rules")
    end

    it "routes with POST" do
      expect(post("/host/firewall_rules")).to route_to("host#firewall_rules")
    end
  end

  describe "#groups" do
    it "routes with GET" do
      expect(get("/host/groups")).to route_to("host#groups")
    end

    it "routes with POST" do
      expect(post("/host/groups")).to route_to("host#groups")
    end
  end

  describe "#guest_applications" do
    it "routes with GET" do
      expect(get("/host/guest_applications")).to route_to("host#guest_applications")
    end

    it "routes with POST" do
      expect(post("/host/guest_applications")).to route_to("host#guest_applications")
    end
  end

  describe "#host_services" do
    it "routes with GET" do
      expect(get("/host/host_services")).to route_to("host#host_services")
    end

    it "routes with POST" do
      expect(post("/host/host_services")).to route_to("host#host_services")
    end
  end

  describe "#listnav_search_selected" do
    it "routes with POST" do
      expect(post("/host/listnav_search_selected")).to route_to("host#listnav_search_selected")
    end
  end

  describe "#patches" do
    it "routes with GET" do
      expect(get("/host/patches")).to route_to("host#patches")
    end

    it "routes with POST" do
      expect(post("/host/patches")).to route_to("host#patches")
    end
  end

  describe "#perf_chart_chooser" do
    it "routes with POST" do
      expect(post("/host/perf_chart_chooser")).to route_to("host#perf_chart_chooser")
    end
  end

  describe "#perf_top_chart" do
    it "routes with GET" do
      expect(get("/#{controller_name}/perf_top_chart")).to route_to("#{controller_name}#perf_top_chart")
    end
  end

  describe "#perf_top_chart" do
    it "routes with POST" do
      expect(post("/#{controller_name}/perf_top_chart")).to route_to("#{controller_name}#perf_top_chart")
    end
  end

  describe "#save_default_search" do
    it "routes with POST" do
      expect(post("/host/save_default_search")).to route_to("host#save_default_search")
    end
  end

  describe "#sections_field_changed" do
    it "routes with POST" do
      expect(post("/host/sections_field_changed")).to route_to("host#sections_field_changed")
    end
  end

  describe "#show" do
    it "routes with GET" do
      expect(get("/host/show")).to route_to("host#show")
    end

    it "routes with POST" do
      expect(post("/host/show")).to route_to("host#show")
    end
  end

  describe "#start" do
    it "routes with GET" do
      expect(get("/host/start")).to route_to("host#start")
    end
  end

  describe "#timeline_data" do
    it "routes with GET" do
      expect(get("/host/timeline_data")).to route_to("host#timeline_data")
    end
  end

  describe "#users" do
    it "routes with GET" do
      expect(get("/host/users")).to route_to("host#users")
    end

    it "routes with POST" do
      expect(post("/host/users")).to route_to("host#users")
    end
  end

  describe "#index" do
    it "routes with GET" do
      expect(get("/#{controller_name}")).to route_to("#{controller_name}#index")
    end
  end

  describe "#edit" do
    it "routes with GET" do
      expect(get("/#{controller_name}/edit/123")).to route_to("#{controller_name}#edit", :id => "123")
    end
  end

  describe "#show" do
    it "routes with GET" do
      expect(get("/#{controller_name}/show/123")).to route_to("#{controller_name}#show", :id => "123")
    end
  end
end
