* Initial automatic cleanup with rubocop * Fix syntax error introduced by rubocop * Cleanup seeds file * Cleanup lib folder * Exclude bin folder because it contains auto generated files * Make Rubocop a little bit more chatty * Block length should not include comments in the count * Cleanup config folder * Cleanup specs * Updated Rubocop version and generated a todo file * Fix broken ArticlesApi spec * Fix tests * Restored rubocop pre-commit hook
42 lines
1.1 KiB
Ruby
42 lines
1.1 KiB
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe "all routes", type: :routing do
|
|
let(:podcast) { create(:podcast) }
|
|
let(:user) { create(:user) }
|
|
|
|
it "renders a podcast index if there is a podcast with the slug successfully" do
|
|
expect(get: "/#{podcast.slug}").to route_to(
|
|
controller: "stories",
|
|
action: "index",
|
|
username: podcast.slug,
|
|
)
|
|
end
|
|
|
|
it "renders a user index if there is a user with the username successfully" do
|
|
expect(get: "/#{user.username}").to route_to(
|
|
controller: "stories",
|
|
action: "index",
|
|
username: user.username,
|
|
)
|
|
end
|
|
|
|
# rubocop:disable RSpec/ExampleLength
|
|
it "renders a user's story successfully" do
|
|
expect(get: "/ben/this-is-a-slug").to route_to(
|
|
controller: "stories",
|
|
action: "show",
|
|
slug: "this-is-a-slug",
|
|
username: "ben",
|
|
)
|
|
end
|
|
# rubocop:enable RSpec/ExampleLength
|
|
|
|
context "when redirected routes" do
|
|
include RSpec::Rails::RequestExampleGroup
|
|
|
|
it "redirects /shop to shop.dev.to" do
|
|
get "/shop"
|
|
expect(response).to redirect_to("https://shop.dev.to/")
|
|
end
|
|
end
|
|
end
|