docbrown/spec/routing/i18n_routes_spec.rb
Alex 2a5a933ed1
Add routes for i18n (#10193)
* Add routes

* Update all_routes spec

* Add i18n route specs

* Add docs

* Docs cleanup

* Add note about fragment caching
2020-09-03 17:11:07 -04:00

34 lines
859 B
Ruby

require "rails_helper"
RSpec.describe "i8n routes", type: :routing do
let(:locale) { "fr-ca" }
let(:i18n_route) { "/locale/#{locale}" }
let(:user) { create(:user) }
it "renders a user index if there is a user with the username successfully" do
expect(get: "#{i18n_route}/#{user.username}").to route_to(
controller: "stories",
action: "index",
username: user.username,
locale: "fr-ca",
)
end
it "renders a user's story successfully" do
expect(get: "#{i18n_route}/ben/this-is-a-slug").to route_to(
controller: "stories",
action: "show",
slug: "this-is-a-slug",
username: "ben",
locale: "fr-ca",
)
end
it "renders homepage successfully" do
expect(get: i18n_route).to route_to(
controller: "stories",
action: "index",
locale: "fr-ca",
)
end
end