add routing specs

This commit is contained in:
Benjamin Neff 2015-06-23 00:42:34 +02:00
parent 7a74b4e01d
commit 38b31ea464
3 changed files with 41 additions and 2 deletions

View file

@ -18,13 +18,13 @@ guard :rspec, cmd: "NO_COVERAGE=true bin/rspec" do
watch(rails.controllers) do |m|
[
# rspec.spec.call("routing/#{m[1]}_routing"),
rspec.spec.call("routing/#{m[1]}_routing"),
rspec.spec.call("controllers/#{m[1]}_controller")
]
end
# Rails config changes
watch(rails.spec_helper) { rspec.spec_dir }
# watch(rails.routes) { "#{rspec.spec_dir}/routing" }
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
end

View file

@ -0,0 +1,20 @@
module DiasporaFederation
describe ReceiveController, type: :routing do
routes { DiasporaFederation::Engine.routes }
it "routes POST public" do
expect(post: "/receive/public").to route_to(
controller: "diaspora_federation/receive",
action: "public"
)
end
it "routes POST private" do
expect(post: "/receive/users/1234").to route_to(
controller: "diaspora_federation/receive",
action: "private",
guid: "1234"
)
end
end
end

View file

@ -0,0 +1,19 @@
module DiasporaFederation
describe ReceiveController, type: :routing do
routes { DiasporaFederation::Engine.routes }
it "routes GET host-meta" do
expect(get: ".well-known/host-meta").to route_to(
controller: "diaspora_federation/webfinger",
action: "host_meta"
)
end
it "routes GET legacy webfinger" do
expect(get: "/webfinger").to route_to(
controller: "diaspora_federation/webfinger",
action: "legacy_webfinger"
)
end
end
end