docbrown/spec/requests/follows_update_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

28 lines
715 B
Ruby

require "rails_helper"
RSpec.describe "Following/Unfollowing", type: :request do
let(:user) { create(:user) }
let(:user_2) { create(:user) }
let(:tag) { create(:tag) }
before do
sign_in user
end
describe "PUT follows/:id" do
it "updates user to offer mentorship" do
user.follow(tag)
put "/follows/#{Follow.last.id}",
params: { follow: { points: 3.0 } }
expect(Follow.last.points).to eq(3.0)
end
it "does not update if follow does not belong to user" do
user_2.follow(tag)
expect do
put "/follows/#{Follow.last.id}",
params: { follow: { points: 3.0 } }
end.to raise_error(Pundit::NotAuthorizedError)
end
end
end