Fix deprecation warnings for rails 6.0
This commit is contained in:
parent
2d38a24a86
commit
b5a46cf7bb
20 changed files with 47 additions and 44 deletions
|
|
@ -15,8 +15,7 @@ class PeopleController < ApplicationController
|
||||||
respond_to :json, :only => [:index, :show]
|
respond_to :json, :only => [:index, :show]
|
||||||
|
|
||||||
rescue_from ActiveRecord::RecordNotFound do
|
rescue_from ActiveRecord::RecordNotFound do
|
||||||
render :file => Rails.root.join('public', '404').to_s,
|
render file: Rails.root.join("public/404.html").to_s, format: :html, layout: false, status: :not_found
|
||||||
:format => :html, :layout => false, :status => 404
|
|
||||||
end
|
end
|
||||||
|
|
||||||
rescue_from Diaspora::AccountClosed do
|
rescue_from Diaspora::AccountClosed do
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class UsersController < ApplicationController
|
||||||
def update_privacy_settings
|
def update_privacy_settings
|
||||||
privacy_params = params.fetch(:user).permit(:strip_exif)
|
privacy_params = params.fetch(:user).permit(:strip_exif)
|
||||||
|
|
||||||
if current_user.update_attributes(strip_exif: privacy_params[:strip_exif])
|
if current_user.update(strip_exif: privacy_params[:strip_exif])
|
||||||
flash[:notice] = t("users.update.settings_updated")
|
flash[:notice] = t("users.update.settings_updated")
|
||||||
else
|
else
|
||||||
flash[:error] = t("users.update.settings_not_updated")
|
flash[:error] = t("users.update.settings_not_updated")
|
||||||
|
|
@ -199,7 +199,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def change_language(user_data)
|
def change_language(user_data)
|
||||||
if @user.update_attributes(user_data)
|
if @user.update(user_data)
|
||||||
I18n.locale = @user.language
|
I18n.locale = @user.language
|
||||||
flash.now[:notice] = t("users.update.language_changed")
|
flash.now[:notice] = t("users.update.language_changed")
|
||||||
else
|
else
|
||||||
|
|
@ -229,7 +229,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def change_settings(user_data, successful="users.update.settings_updated", error="users.update.settings_not_updated")
|
def change_settings(user_data, successful="users.update.settings_updated", error="users.update.settings_not_updated")
|
||||||
if @user.update_attributes(user_data)
|
if @user.update(user_data)
|
||||||
flash.now[:notice] = t(successful)
|
flash.now[:notice] = t(successful)
|
||||||
else
|
else
|
||||||
flash.now[:error] = t(error)
|
flash.now[:error] = t(error)
|
||||||
|
|
|
||||||
|
|
@ -16,17 +16,18 @@ class InvitationCode < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_invites!
|
def add_invites!
|
||||||
self.update_attributes(:count => self.count+100)
|
update(count: count + 100)
|
||||||
end
|
end
|
||||||
|
|
||||||
def use!
|
def use!
|
||||||
self.update_attributes(:count => self.count-1)
|
update(count: count - 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_token
|
def generate_token
|
||||||
begin
|
loop do
|
||||||
self.token = SecureRandom.hex(6)
|
self.token = SecureRandom.hex(6)
|
||||||
end while InvitationCode.exists?(:token => self[:token])
|
break unless InvitationCode.default_scoped.exists?(token: token)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.default_inviter_or(user)
|
def self.default_inviter_or(user)
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ class User < ApplicationRecord
|
||||||
|
|
||||||
def update_post(post, post_hash={})
|
def update_post(post, post_hash={})
|
||||||
if self.owns? post
|
if self.owns? post
|
||||||
post.update_attributes(post_hash)
|
post.update(post_hash)
|
||||||
self.dispatch_post(post)
|
self.dispatch_post(post)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -375,7 +375,7 @@ class User < ApplicationRecord
|
||||||
########### Profile ######################
|
########### Profile ######################
|
||||||
def update_profile(params)
|
def update_profile(params)
|
||||||
if photo = params.delete(:photo)
|
if photo = params.delete(:photo)
|
||||||
photo.update_attributes(:pending => false) if photo.pending
|
photo.update(pending: false) if photo.pending
|
||||||
params[:image_url] = photo.url(:thumb_large)
|
params[:image_url] = photo.url(:thumb_large)
|
||||||
params[:image_url_medium] = photo.url(:thumb_medium)
|
params[:image_url_medium] = photo.url(:thumb_medium)
|
||||||
params[:image_url_small] = photo.url(:thumb_small)
|
params[:image_url_small] = photo.url(:thumb_small)
|
||||||
|
|
@ -383,7 +383,7 @@ class User < ApplicationRecord
|
||||||
|
|
||||||
params.stringify_keys!
|
params.stringify_keys!
|
||||||
params.slice!(*(Profile.column_names+['tag_string', 'date']))
|
params.slice!(*(Profile.column_names+['tag_string', 'date']))
|
||||||
if self.profile.update_attributes(params)
|
if profile.update(params)
|
||||||
deliver_profile_update
|
deliver_profile_update
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class User
|
||||||
if destroy
|
if destroy
|
||||||
contact.destroy
|
contact.destroy
|
||||||
else
|
else
|
||||||
contact.update_attributes(direction => false)
|
contact.update(direction => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -112,4 +112,4 @@ end
|
||||||
# the logging gem is no-op. See: https://github.com/TwP/logging/issues/11
|
# the logging gem is no-op. See: https://github.com/TwP/logging/issues/11
|
||||||
Logging::Logger.send :alias_method, :local_level, :level
|
Logging::Logger.send :alias_method, :local_level, :level
|
||||||
Logging::Logger.send :alias_method, :local_level=, :level=
|
Logging::Logger.send :alias_method, :local_level=, :level=
|
||||||
Logging::Logger.send :include, LoggerSilence
|
Logging::Logger.include ActiveSupport::LoggerSilence
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class CleanupAspectsAndAddUniqueIndex < ActiveRecord::Migration[5.1]
|
||||||
Aspect.where(user_id: 0).delete_all
|
Aspect.where(user_id: 0).delete_all
|
||||||
Aspect.joins("INNER JOIN aspects as a2 ON aspects.user_id = a2.user_id AND aspects.name = a2.name")
|
Aspect.joins("INNER JOIN aspects as a2 ON aspects.user_id = a2.user_id AND aspects.name = a2.name")
|
||||||
.where("aspects.id > a2.id").each do |aspect|
|
.where("aspects.id > a2.id").each do |aspect|
|
||||||
aspect.update_attributes(name: "#{aspect.name}_#{UUID.generate(:compact)}")
|
aspect.update(name: "#{aspect.name}_#{UUID.generate(:compact)}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class IntegrationSessionsController < ActionController::Base
|
class IntegrationSessionsController < ActionController::Base
|
||||||
|
prepend_view_path(Rails.root.join("features/support"))
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@user_id = params[:user_id]
|
@user_id = params[:user_id]
|
||||||
render file: 'features/support/integration_sessions_form', layout: false
|
render template: "integration_sessions_form", layout: false
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
sign_in_and_redirect User.find(params[:user_id])
|
sign_in_and_redirect User.find(params[:user_id])
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,6 @@ class AccountDeleter
|
||||||
end
|
end
|
||||||
|
|
||||||
def mark_account_deletion_complete
|
def mark_account_deletion_complete
|
||||||
AccountDeletion.find_by(person: person)&.update_attributes(completed_at: Time.now.utc)
|
AccountDeletion.find_by(person: person)&.update(completed_at: Time.now.utc)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ module Diaspora
|
||||||
|
|
||||||
if persisted_photo
|
if persisted_photo
|
||||||
persisted_photo.tap do |photo|
|
persisted_photo.tap do |photo|
|
||||||
photo.update_attributes(
|
photo.update(
|
||||||
text: entity.text,
|
text: entity.text,
|
||||||
public: entity.public,
|
public: entity.public,
|
||||||
created_at: entity.created_at,
|
created_at: entity.created_at,
|
||||||
|
|
@ -145,7 +145,7 @@ module Diaspora
|
||||||
|
|
||||||
def self.profile(entity)
|
def self.profile(entity)
|
||||||
author_of(entity).profile.tap do |profile|
|
author_of(entity).profile.tap do |profile|
|
||||||
profile.update_attributes(
|
profile.update(
|
||||||
first_name: entity.first_name,
|
first_name: entity.first_name,
|
||||||
last_name: entity.last_name,
|
last_name: entity.last_name,
|
||||||
image_url: entity.image_url,
|
image_url: entity.image_url,
|
||||||
|
|
|
||||||
|
|
@ -98,8 +98,8 @@ describe AspectsController, :type => :controller do
|
||||||
|
|
||||||
describe "update_order" do
|
describe "update_order" do
|
||||||
it "updates the aspect order" do
|
it "updates the aspect order" do
|
||||||
@alices_aspect_1.update_attributes(order_id: 10)
|
@alices_aspect_1.update(order_id: 10)
|
||||||
@alices_aspect_2.update_attributes(order_id: 20)
|
@alices_aspect_2.update(order_id: 20)
|
||||||
ordered_aspect_ids = [@alices_aspect_2.id, @alices_aspect_1.id]
|
ordered_aspect_ids = [@alices_aspect_2.id, @alices_aspect_1.id]
|
||||||
|
|
||||||
put :update_order, params: {ordered_aspect_ids: ordered_aspect_ids}
|
put :update_order, params: {ordered_aspect_ids: ordered_aspect_ids}
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ describe ContactsController, :type => :controller do
|
||||||
|
|
||||||
it "returns only contacts which are receiving (the user is sharing with them)" do
|
it "returns only contacts which are receiving (the user is sharing with them)" do
|
||||||
contact = bob.contacts.first
|
contact = bob.contacts.first
|
||||||
contact.update_attributes(receiving: false)
|
contact.update(receiving: false)
|
||||||
|
|
||||||
get :index, params: {params: {page: "1"}}, format: :json
|
get :index, params: {params: {page: "1"}}, format: :json
|
||||||
contact_ids = JSON.parse(response.body).map {|c| c["id"] }
|
contact_ids = JSON.parse(response.body).map {|c| c["id"] }
|
||||||
|
|
@ -88,7 +88,7 @@ describe ContactsController, :type => :controller do
|
||||||
context "set: all" do
|
context "set: all" do
|
||||||
before do
|
before do
|
||||||
contact = bob.contacts.first
|
contact = bob.contacts.first
|
||||||
contact.update_attributes(receiving: false)
|
contact.update(receiving: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns all contacts (sharing and receiving)" do
|
it "returns all contacts (sharing and receiving)" do
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ describe InvitationsController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "displays an error when no invitations are left" do
|
it "displays an error when no invitations are left" do
|
||||||
alice.invitation_code.update_attributes(count: 0)
|
alice.invitation_code.update(count: 0)
|
||||||
|
|
||||||
post :create, params: invite_params
|
post :create, params: invite_params
|
||||||
|
|
||||||
|
|
@ -127,7 +127,7 @@ describe InvitationsController, type: :controller do
|
||||||
|
|
||||||
it "does not display an error when registration is open" do
|
it "does not display an error when registration is open" do
|
||||||
AppConfig.settings.invitations.open = false
|
AppConfig.settings.invitations.open = false
|
||||||
alice.invitation_code.update_attributes(count: 0)
|
alice.invitation_code.update(count: 0)
|
||||||
|
|
||||||
post :create, params: invite_params
|
post :create, params: invite_params
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ describe RegistrationsController, type: :controller do
|
||||||
|
|
||||||
it "does redirect if there are no invites available with this code" do
|
it "does redirect if there are no invites available with this code" do
|
||||||
code = InvitationCode.create(user: bob)
|
code = InvitationCode.create(user: bob)
|
||||||
code.update_attributes(count: 0)
|
code.update(count: 0)
|
||||||
|
|
||||||
get :new, params: {invite: {token: code.token}}
|
get :new, params: {invite: {token: code.token}}
|
||||||
expect(response).to redirect_to registrations_closed_path
|
expect(response).to redirect_to registrations_closed_path
|
||||||
|
|
@ -67,7 +67,7 @@ describe RegistrationsController, type: :controller do
|
||||||
AppConfig.settings.enable_registrations = true
|
AppConfig.settings.enable_registrations = true
|
||||||
|
|
||||||
code = InvitationCode.create(user: bob)
|
code = InvitationCode.create(user: bob)
|
||||||
code.update_attributes(count: 0)
|
code.update(count: 0)
|
||||||
|
|
||||||
get :new, params: {invite: {token: code.token}}
|
get :new, params: {invite: {token: code.token}}
|
||||||
expect(response).not_to be_redirect
|
expect(response).not_to be_redirect
|
||||||
|
|
|
||||||
|
|
@ -138,22 +138,22 @@ describe UsersController, :type => :controller do
|
||||||
before do
|
before do
|
||||||
allow(@controller).to receive(:current_user).and_return(@user)
|
allow(@controller).to receive(:current_user).and_return(@user)
|
||||||
allow(@user).to receive(:update_with_password)
|
allow(@user).to receive(:update_with_password)
|
||||||
allow(@user).to receive(:update_attributes)
|
allow(@user).to receive(:update)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "uses devise's update with password" do
|
it "uses devise's update with password" do
|
||||||
put :update, params: params
|
put :update, params: params
|
||||||
|
|
||||||
expect(@user).to have_received(:update_with_password).with(hash_including(password_params))
|
expect(@user).to have_received(:update_with_password).with(hash_including(password_params))
|
||||||
expect(@user).not_to have_received(:update_attributes).with(hash_including(password_params))
|
expect(@user).not_to have_received(:update).with(hash_including(password_params))
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not update the password without the change_password param" do
|
it "does not update the password without the change_password param" do
|
||||||
put :update, params: params.except(:change_password).deep_merge(user: {language: "de"})
|
put :update, params: params.except(:change_password).deep_merge(user: {language: "de"})
|
||||||
|
|
||||||
expect(@user).not_to have_received(:update_with_password).with(hash_including(password_params))
|
expect(@user).not_to have_received(:update_with_password).with(hash_including(password_params))
|
||||||
expect(@user).not_to have_received(:update_attributes).with(hash_including(password_params))
|
expect(@user).not_to have_received(:update).with(hash_including(password_params))
|
||||||
expect(@user).to have_received(:update_attributes).with(hash_including(language: "de"))
|
expect(@user).to have_received(:update).with(hash_including(language: "de"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -163,13 +163,13 @@ describe UsersController, :type => :controller do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(@controller).to receive(:current_user).and_return(@user)
|
allow(@controller).to receive(:current_user).and_return(@user)
|
||||||
allow(@user).to receive(:update_attributes)
|
allow(@user).to receive(:update)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not accept the params" do
|
it "does not accept the params" do
|
||||||
put :update, params: params
|
put :update, params: params
|
||||||
|
|
||||||
expect(@user).not_to have_received(:update_attributes)
|
expect(@user).not_to have_received(:update)
|
||||||
.with(hash_including(:otp_required_for_login, :otp_secret))
|
.with(hash_including(:otp_required_for_login, :otp_secret))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -128,13 +128,13 @@ describe NotificationsHelper, type: :helper do
|
||||||
let(:notification) { Notifications::ContactsBirthday.create(recipient: alice, target: bob.person) }
|
let(:notification) { Notifications::ContactsBirthday.create(recipient: alice, target: bob.person) }
|
||||||
|
|
||||||
it "contains the date" do
|
it "contains the date" do
|
||||||
bob.profile.update_attributes(birthday: Time.zone.today)
|
bob.profile.update(birthday: Time.zone.today)
|
||||||
link = object_link(notification, notification_people_link(notification))
|
link = object_link(notification, notification_people_link(notification))
|
||||||
expect(link).to include(I18n.l(Time.zone.today, format: I18n.t("date.formats.fullmonth_day")))
|
expect(link).to include(I18n.l(Time.zone.today, format: I18n.t("date.formats.fullmonth_day")))
|
||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't break, when the person removes the birthday date" do
|
it "doesn't break, when the person removes the birthday date" do
|
||||||
bob.profile.update_attributes(birthday: nil)
|
bob.profile.update(birthday: nil)
|
||||||
link = object_link(notification, notification_people_link(notification))
|
link = object_link(notification, notification_people_link(notification))
|
||||||
expect(link).to include(I18n.l(Time.zone.today, format: I18n.t("date.formats.fullmonth_day")))
|
expect(link).to include(I18n.l(Time.zone.today, format: I18n.t("date.formats.fullmonth_day")))
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -516,7 +516,7 @@ describe Notifier, type: :mailer do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "has the inviter id if the name is nil" do
|
it "has the inviter id if the name is nil" do
|
||||||
bob.person.profile.update_attributes(first_name: "", last_name: "")
|
bob.person.profile.update(first_name: "", last_name: "")
|
||||||
mail = Notifier.invite(alice.email, bob, "1234", "en")
|
mail = Notifier.invite(alice.email, bob, "1234", "en")
|
||||||
expect(email.body.encoded).to_not include("#{bob.name} (#{bob.diaspora_handle})")
|
expect(email.body.encoded).to_not include("#{bob.name} (#{bob.diaspora_handle})")
|
||||||
expect(mail.body.encoded).to include(bob.person.diaspora_handle)
|
expect(mail.body.encoded).to include(bob.person.diaspora_handle)
|
||||||
|
|
@ -573,7 +573,7 @@ describe Notifier, type: :mailer do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "FROM: header should be 'pod_name (username)' when there is no first and last name" do
|
it "FROM: header should be 'pod_name (username)' when there is no first and last name" do
|
||||||
bob.person.profile.update_attributes(first_name: "", last_name: "")
|
bob.person.profile.update(first_name: "", last_name: "")
|
||||||
mail = Notifier.send_notification("started_sharing", alice.id, bob.person.id)
|
mail = Notifier.send_notification("started_sharing", alice.id, bob.person.id)
|
||||||
expect(mail["From"].to_s).to eq("\"#{pod_name} (#{bob.person.username})\" <#{AppConfig.mail.sender_address}>")
|
expect(mail["From"].to_s).to eq("\"#{pod_name} (#{bob.person.username})\" <#{AppConfig.mail.sender_address}>")
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ describe User::Querying, :type => :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not pull back hidden posts" do
|
it "does not pull back hidden posts" do
|
||||||
@status.share_visibilities.where(user_id: alice.id).first.update_attributes(hidden: true)
|
@status.share_visibilities.where(user_id: alice.id).first.update(hidden: true)
|
||||||
expect(alice.visible_shareable_ids(Post).include?(@status.id)).to be false
|
expect(alice.visible_shareable_ids(Post).include?(@status.id)).to be false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ describe "status_messages/_status_message.mobile.haml" do
|
||||||
)
|
)
|
||||||
post = FactoryGirl.create(:status_message, public: true, open_graph_cache: open_graph_cache)
|
post = FactoryGirl.create(:status_message, public: true, open_graph_cache: open_graph_cache)
|
||||||
|
|
||||||
render file: "status_messages/_status_message.mobile.haml", locals: {post: post, photos: post.photos}
|
render template: "status_messages/_status_message.mobile.haml", locals: {post: post, photos: post.photos}
|
||||||
|
|
||||||
expect(rendered).to_not include("<script>")
|
expect(rendered).to_not include("<script>")
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ describe Workers::CheckBirthday do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
Timecop.freeze(Time.zone.local(1999, 9, 9))
|
Timecop.freeze(Time.zone.local(1999, 9, 9))
|
||||||
birthday_profile.update_attributes(birthday: "1990-09-09")
|
birthday_profile.update(birthday: "1990-09-09")
|
||||||
allow(Notifications::ContactsBirthday).to receive(:notify)
|
allow(Notifications::ContactsBirthday).to receive(:notify)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -22,13 +22,13 @@ describe Workers::CheckBirthday do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does nothing if the birthday does not exist" do
|
it "does nothing if the birthday does not exist" do
|
||||||
birthday_profile.update_attributes(birthday: nil)
|
birthday_profile.update(birthday: nil)
|
||||||
Workers::CheckBirthday.new.perform
|
Workers::CheckBirthday.new.perform
|
||||||
expect(Notifications::ContactsBirthday).not_to have_received(:notify)
|
expect(Notifications::ContactsBirthday).not_to have_received(:notify)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does nothing if the person's birthday is not today" do
|
it "does nothing if the person's birthday is not today" do
|
||||||
birthday_profile.update_attributes(birthday: "1988-04-15")
|
birthday_profile.update(birthday: "1988-04-15")
|
||||||
Workers::CheckBirthday.new.perform
|
Workers::CheckBirthday.new.perform
|
||||||
expect(Notifications::ContactsBirthday).not_to have_received(:notify)
|
expect(Notifications::ContactsBirthday).not_to have_received(:notify)
|
||||||
end
|
end
|
||||||
|
|
@ -41,14 +41,14 @@ describe Workers::CheckBirthday do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not call notify method if a contact user is not :receiving from the birthday person" do
|
it "does not call notify method if a contact user is not :receiving from the birthday person" do
|
||||||
contact2.update_attributes(receiving: false)
|
contact2.update(receiving: false)
|
||||||
Workers::CheckBirthday.new.perform
|
Workers::CheckBirthday.new.perform
|
||||||
expect(Notifications::ContactsBirthday).to have_received(:notify).with(contact1, [])
|
expect(Notifications::ContactsBirthday).to have_received(:notify).with(contact1, [])
|
||||||
expect(Notifications::ContactsBirthday).not_to have_received(:notify).with(contact2, [])
|
expect(Notifications::ContactsBirthday).not_to have_received(:notify).with(contact2, [])
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not call notify method if a birthday person is not :sharing with the contact user" do
|
it "does not call notify method if a birthday person is not :sharing with the contact user" do
|
||||||
contact2.update_attributes(sharing: false)
|
contact2.update(sharing: false)
|
||||||
Workers::CheckBirthday.new.perform
|
Workers::CheckBirthday.new.perform
|
||||||
expect(Notifications::ContactsBirthday).to have_received(:notify).with(contact1, [])
|
expect(Notifications::ContactsBirthday).to have_received(:notify).with(contact1, [])
|
||||||
expect(Notifications::ContactsBirthday).not_to have_received(:notify).with(contact2, [])
|
expect(Notifications::ContactsBirthday).not_to have_received(:notify).with(contact2, [])
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue