docbrown/spec/requests/reading_list_items_spec.rb
Mac Siri 6d1638ed68 Unskip all skipped specs (#2941)
* Change all login_as to sign_in

* Unskip comment spec

* Create new specs

* Turn on Webdriver caching

* Set logger for Omniauth in test

* Update editor system spec

* Fix editor approval file

* Update video_controller

* Update TagAdjustmentUpdateService's spec

* Update users api spec

* Update stories_index_spec

* Remove redundant spec file

* Remove residual code

* Change ClassifiedListing spec

* Update NotificationsIndex spec
2019-05-25 11:04:38 -04:00

30 lines
877 B
Ruby

require "rails_helper"
RSpec.describe "ReadingListItems", type: :request do
let(:user) { create(:user) }
let(:article) { create(:article, user_id: user.id) }
let(:reaction) { create(:reaction, reactable_id: article.id, user_id: user.id) }
before do
sign_in user
end
describe "GET reading list" do
it "returns reading list page" do
get "/readinglist"
expect(response.body).to include("Reading List")
end
end
describe "PUT reading_list_items/:id" do
it "returns archives item if no param" do
put "/reading_list_items/#{reaction.id}"
expect(reaction.reload.status).to eq("archived")
end
it "unarchives an item if current_status is passed as archived" do
put "/reading_list_items/#{reaction.id}", params: { current_status: "archived" }
expect(reaction.reload.status).to eq("valid")
end
end
end