docbrown/spec/requests/stories_index_spec.rb
rhymes e588fa7ece Code cleanups (#659)
* 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
2018-08-07 11:00:13 -04:00

54 lines
1.5 KiB
Ruby

require "rails_helper"
RSpec.describe "StoriesIndex", type: :request do
describe "GET stories index" do
it "renders page with proper sidebar" do
get "/"
expect(response.body).to include("key links")
end
end
describe "GET query page" do
it "renders page with proper header" do
get "/search?q=hello"
expect(response.body).to include("query-header-text")
end
end
describe "GET podcast index" do
it "renders page with proper header" do
podcast = create(:podcast)
get "/" + podcast.slug
expect(response.body).to include(podcast.title)
end
end
describe "GET tag index" do
it "renders page with proper header" do
tag = create(:tag)
get "/t/#{tag.name}"
expect(response.body).to include(tag.name)
end
# rubocop:disable RSpec/ExampleLength, RSpec/MultipleExpectations
it "renders page with top/week etc." do
tag = create(:tag)
get "/t/#{tag.name}/top/week"
expect(response.body).to include(tag.name)
get "/t/#{tag.name}/top/month"
expect(response.body).to include(tag.name)
get "/t/#{tag.name}/top/year"
expect(response.body).to include(tag.name)
get "/t/#{tag.name}/top/infinity"
expect(response.body).to include(tag.name)
end
# rubocop:enable RSpec/ExampleLength, RSpec/MultipleExpectations
it "renders tag after alias change" do
tag = create(:tag)
tag2 = create(:tag, alias_for: tag.name)
get "/t/#{tag2.name}"
expect(response.body).to redirect_to "/t/#{tag.name}"
end
end
end