docbrown/spec/requests/collections_spec.rb
Anna Buianova 7d053471f8
Rubocop fixes in spec/requests (#18946)
* Rubocop fixes in spec/requests

* Fixed spec/requests/api/v0/articles_spec.rb

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2023-01-12 19:10:16 +03:00

31 lines
937 B
Ruby

require "rails_helper"
RSpec.describe "Collections" do
let(:user) { create(:user) }
let(:collection) { create(:collection, :with_articles, user: user) }
describe "GET user collections index" do
it "returns 200" do
get "/#{user.username}/series"
expect(response).to have_http_status(:ok)
end
end
describe "GET user collection show" do
it "returns 200" do
get collection.path
expect(response).to have_http_status(:ok)
end
end
describe "GET large user collection show" do
it "returns the proper article count and text for a large collection", :aggregate_failures do
amount = 6
large_collection = create(:collection, :with_articles, amount: amount, user: user)
get "/#{user.username}/#{large_collection.articles.first.slug}"
expect(response).to have_http_status(:ok)
expect(response.body).to include "#{amount - 4} more parts..."
end
end
end