chore: Update dependencies to the latest versions (#5033)
This commit is contained in:
@@ -13,10 +13,10 @@ RSpec.describe User do
|
||||
|
||||
describe 'notification_settings' do
|
||||
it 'gets created with the right default settings' do
|
||||
expect(account_user.user.notification_settings).not_to eq(nil)
|
||||
expect(account_user.user.notification_settings).not_to be_nil
|
||||
|
||||
expect(account_user.user.notification_settings.first.email_conversation_creation?).to eq(false)
|
||||
expect(account_user.user.notification_settings.first.email_conversation_assignment?).to eq(true)
|
||||
expect(account_user.user.notification_settings.first.email_conversation_creation?).to be(false)
|
||||
expect(account_user.user.notification_settings.first.email_conversation_assignment?).to be(true)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ RSpec.describe Attachment, type: :model do
|
||||
message = create(:message)
|
||||
attachment = message.attachments.new(account_id: message.account_id, file_type: :image)
|
||||
attachment.file.attach(io: File.open(Rails.root.join('spec/assets/avatar.png')), filename: 'avatar.png', content_type: 'image/png')
|
||||
expect(attachment.download_url).not_to eq nil
|
||||
expect(attachment.download_url).not_to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,7 +50,7 @@ RSpec.describe AutomationRule, type: :model do
|
||||
|
||||
it 'returns valid record' do
|
||||
rule = FactoryBot.build(:automation_rule, params)
|
||||
expect(rule.valid?).to eq true
|
||||
expect(rule.valid?).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,7 +34,7 @@ RSpec.describe Campaign, type: :model do
|
||||
let(:campaign) { build(:campaign, inbox: facebook_inbox) }
|
||||
|
||||
it 'would not save the campaigns' do
|
||||
expect(campaign.save).to eq false
|
||||
expect(campaign.save).to be false
|
||||
expect(campaign.errors.full_messages.first).to eq 'Inbox Unsupported Inbox type'
|
||||
end
|
||||
end
|
||||
@@ -46,18 +46,18 @@ RSpec.describe Campaign, type: :model do
|
||||
|
||||
it 'would prevent further updates' do
|
||||
campaign.title = 'new name'
|
||||
expect(campaign.save).to eq false
|
||||
expect(campaign.save).to be false
|
||||
expect(campaign.errors.full_messages.first).to eq 'Status The campaign is already completed'
|
||||
end
|
||||
|
||||
it 'can be deleted' do
|
||||
campaign.destroy!
|
||||
expect(described_class.exists?(campaign.id)).to eq false
|
||||
expect(described_class.exists?(campaign.id)).to be false
|
||||
end
|
||||
|
||||
it 'cant be triggered' do
|
||||
expect(Twilio::OneoffSmsCampaignService).not_to receive(:new).with(campaign: campaign)
|
||||
expect(campaign.trigger!).to eq nil
|
||||
expect(campaign.trigger!).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -71,7 +71,7 @@ RSpec.describe Campaign, type: :model do
|
||||
campaign.campaign_type = 'ongoing'
|
||||
campaign.save!
|
||||
expect(campaign.reload.campaign_type).to eq 'one_off'
|
||||
expect(campaign.scheduled_at.present?).to eq true
|
||||
expect(campaign.scheduled_at.present?).to be true
|
||||
end
|
||||
|
||||
it 'calls twilio service on trigger!' do
|
||||
@@ -92,7 +92,7 @@ RSpec.describe Campaign, type: :model do
|
||||
campaign.campaign_type = 'ongoing'
|
||||
campaign.save!
|
||||
expect(campaign.reload.campaign_type).to eq 'one_off'
|
||||
expect(campaign.scheduled_at.present?).to eq true
|
||||
expect(campaign.scheduled_at.present?).to be true
|
||||
end
|
||||
|
||||
it 'calls sms service on trigger!' do
|
||||
|
||||
@@ -8,7 +8,7 @@ RSpec.describe Channel::TwilioSms do
|
||||
let!(:whatsapp_channel) { create(:channel_twilio_sms, medium: :whatsapp) }
|
||||
|
||||
it 'returns true' do
|
||||
expect(whatsapp_channel.messaging_window_enabled?).to eq true
|
||||
expect(whatsapp_channel.messaging_window_enabled?).to be true
|
||||
expect(whatsapp_channel.name).to eq 'Whatsapp'
|
||||
expect(whatsapp_channel.medium).to eq 'whatsapp'
|
||||
end
|
||||
@@ -18,7 +18,7 @@ RSpec.describe Channel::TwilioSms do
|
||||
let!(:sms_channel) { create(:channel_twilio_sms, medium: :sms) }
|
||||
|
||||
it 'returns false' do
|
||||
expect(sms_channel.messaging_window_enabled?).to eq false
|
||||
expect(sms_channel.messaging_window_enabled?).to be false
|
||||
expect(sms_channel.name).to eq 'Twilio SMS'
|
||||
expect(sms_channel.medium).to eq 'sms'
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ RSpec.describe Channel::Whatsapp do
|
||||
|
||||
it 'validates false when provider config is wrong' do
|
||||
stub_request(:get, 'https://graph.facebook.com/v14.0//message_templates?access_token=test_key').to_return(status: 401)
|
||||
expect(channel.save).to eq(false)
|
||||
expect(channel.save).to be(false)
|
||||
end
|
||||
|
||||
it 'validates true when provider config is right' do
|
||||
@@ -17,7 +17,7 @@ RSpec.describe Channel::Whatsapp do
|
||||
body: { data: [{
|
||||
id: '123456789', name: 'test_template'
|
||||
}] }.to_json)
|
||||
expect(channel.save).to eq(true)
|
||||
expect(channel.save).to be(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,6 +4,6 @@ shared_examples_for 'access_tokenable' do
|
||||
let(:obj) { create(described_class.to_s.underscore) }
|
||||
|
||||
it 'creates access token on create' do
|
||||
expect(obj.access_token).not_to eq(nil)
|
||||
expect(obj.access_token).not_to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,8 +21,8 @@ shared_examples_for 'assignment_handler' do
|
||||
end
|
||||
|
||||
it 'creates team assigned and unassigned message activity' do
|
||||
expect(conversation.update(team: team)).to eq true
|
||||
expect(conversation.update(team: nil)).to eq true
|
||||
expect(conversation.update(team: team)).to be true
|
||||
expect(conversation.update(team: nil)).to be true
|
||||
expect(Conversations::ActivityMessageJob).to(have_been_enqueued.at_least(:once)
|
||||
.with(conversation, { account_id: conversation.account_id, inbox_id: conversation.inbox_id, message_type: :activity,
|
||||
content: "Assigned to #{team.name} by #{agent.name}" }))
|
||||
@@ -32,11 +32,11 @@ shared_examples_for 'assignment_handler' do
|
||||
end
|
||||
|
||||
it 'changes assignee to nil if they doesnt belong to the team and allow_auto_assign is false' do
|
||||
expect(team.allow_auto_assign).to eq false
|
||||
expect(team.allow_auto_assign).to be false
|
||||
|
||||
conversation.update(team: team)
|
||||
|
||||
expect(conversation.reload.assignee).to eq nil
|
||||
expect(conversation.reload.assignee).to be_nil
|
||||
end
|
||||
|
||||
it 'changes assignee to a team member if allow_auto_assign is enabled' do
|
||||
@@ -74,7 +74,7 @@ shared_examples_for 'assignment_handler' do
|
||||
let(:assignment_mailer) { instance_double(AgentNotifications::ConversationNotificationsMailer, deliver: true) }
|
||||
|
||||
it 'assigns the agent to conversation' do
|
||||
expect(update_assignee).to eq(true)
|
||||
expect(update_assignee).to be(true)
|
||||
expect(conversation.reload.assignee).to eq(agent)
|
||||
end
|
||||
|
||||
@@ -82,7 +82,7 @@ shared_examples_for 'assignment_handler' do
|
||||
# TODO: FIX me
|
||||
# expect(EventDispatcherJob).to(have_been_enqueued.at_least(:once).with('assignee.changed', anything, anything, anything, anything))
|
||||
expect(EventDispatcherJob).to(have_been_enqueued.at_least(:once))
|
||||
expect(update_assignee).to eq(true)
|
||||
expect(update_assignee).to be(true)
|
||||
end
|
||||
|
||||
context 'when agent is current user' do
|
||||
@@ -91,7 +91,7 @@ shared_examples_for 'assignment_handler' do
|
||||
end
|
||||
|
||||
it 'creates self-assigned message activity' do
|
||||
expect(update_assignee).to eq(true)
|
||||
expect(update_assignee).to be(true)
|
||||
expect(Conversations::ActivityMessageJob).to(have_been_enqueued.at_least(:once)
|
||||
.with(conversation, { account_id: conversation.account_id, inbox_id: conversation.inbox_id,
|
||||
message_type: :activity, content: "#{agent.name} self-assigned this conversation" }))
|
||||
|
||||
@@ -14,21 +14,21 @@ shared_examples_for 'reauthorizable' do
|
||||
|
||||
it 'prompts reauthorization when error threshold is passed' do
|
||||
obj = FactoryBot.create(model.to_s.underscore.tr('/', '_').to_sym)
|
||||
expect(obj.reauthorization_required?).to eq false
|
||||
expect(obj.reauthorization_required?).to be false
|
||||
|
||||
obj.class::AUTHORIZATION_ERROR_THRESHOLD.times do
|
||||
obj.authorization_error!
|
||||
end
|
||||
|
||||
expect(obj.reauthorization_required?).to eq true
|
||||
expect(obj.reauthorization_required?).to be true
|
||||
end
|
||||
|
||||
it 'prompt_reauthorization!' do
|
||||
obj = FactoryBot.create(model.to_s.underscore.tr('/', '_').to_sym)
|
||||
expect(obj.reauthorization_required?).to eq false
|
||||
expect(obj.reauthorization_required?).to be false
|
||||
|
||||
obj.prompt_reauthorization!
|
||||
expect(obj.reauthorization_required?).to eq true
|
||||
expect(obj.reauthorization_required?).to be true
|
||||
end
|
||||
|
||||
it 'reauthorized!' do
|
||||
@@ -36,13 +36,13 @@ shared_examples_for 'reauthorizable' do
|
||||
# setting up the object with the errors to validate its cleared on action
|
||||
obj.authorization_error!
|
||||
obj.prompt_reauthorization!
|
||||
expect(obj.reauthorization_required?).to eq true
|
||||
expect(obj.reauthorization_required?).to be true
|
||||
expect(obj.authorization_error_count).not_to eq 0
|
||||
|
||||
obj.reauthorized!
|
||||
|
||||
# authorization errors are reset
|
||||
expect(obj.authorization_error_count).to eq 0
|
||||
expect(obj.reauthorization_required?).to eq false
|
||||
expect(obj.reauthorization_required?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,7 +31,7 @@ shared_examples_for 'round_robin_handler' do
|
||||
inbox.update(enable_auto_assignment: false)
|
||||
|
||||
# run_round_robin
|
||||
expect(conversation.reload.assignee).to eq(nil)
|
||||
expect(conversation.reload.assignee).to be_nil
|
||||
end
|
||||
|
||||
it 'will not auto assign agent if its a bot conversation' do
|
||||
@@ -45,7 +45,7 @@ shared_examples_for 'round_robin_handler' do
|
||||
)
|
||||
|
||||
# run_round_robin
|
||||
expect(conversation.reload.assignee).to eq(nil)
|
||||
expect(conversation.reload.assignee).to be_nil
|
||||
end
|
||||
|
||||
it 'gets triggered on update only when status changes to open' do
|
||||
|
||||
@@ -8,7 +8,7 @@ RSpec.describe ContactInbox do
|
||||
|
||||
it 'gets created on object create' do
|
||||
obj = contact_inbox
|
||||
expect(obj.pubsub_token).not_to eq(nil)
|
||||
expect(obj.pubsub_token).not_to be_nil
|
||||
end
|
||||
|
||||
it 'does not get updated on object update' do
|
||||
@@ -29,7 +29,7 @@ RSpec.describe ContactInbox do
|
||||
|
||||
# ensure the column is nil in database
|
||||
results = ActiveRecord::Base.connection.execute('Select * from contact_inboxes;')
|
||||
expect(results.first['pubsub_token']).to eq(nil)
|
||||
expect(results.first['pubsub_token']).to be_nil
|
||||
|
||||
new_token = obj.pubsub_token
|
||||
obj.update(source_id: '234234323')
|
||||
|
||||
@@ -52,7 +52,7 @@ RSpec.describe Contact do
|
||||
|
||||
it 'updates phone number when adding valid phone number' do
|
||||
contact = create(:contact)
|
||||
expect(contact.update!(phone_number: '+12312312321')).to eq true
|
||||
expect(contact.update!(phone_number: '+12312312321')).to be true
|
||||
expect(contact.phone_number).to eq '+12312312321'
|
||||
end
|
||||
end
|
||||
@@ -65,7 +65,7 @@ RSpec.describe Contact do
|
||||
|
||||
it 'updates email when adding valid email' do
|
||||
contact = create(:contact)
|
||||
expect(contact.update!(email: 'test@test.com')).to eq true
|
||||
expect(contact.update!(email: 'test@test.com')).to be true
|
||||
expect(contact.email).to eq 'test@test.com'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -221,7 +221,7 @@ RSpec.describe Conversation, type: :model do
|
||||
expect(conversation.label_list).to match_array(labels)
|
||||
|
||||
updated_labels = [second_label, third_label].map(&:title)
|
||||
expect(conversation.update_labels(updated_labels)).to eq(true)
|
||||
expect(conversation.update_labels(updated_labels)).to be(true)
|
||||
expect(conversation.label_list).to match_array(updated_labels)
|
||||
|
||||
expect(Conversations::ActivityMessageJob)
|
||||
@@ -238,25 +238,25 @@ RSpec.describe Conversation, type: :model do
|
||||
describe '#toggle_status' do
|
||||
it 'toggles conversation status to resolved when open' do
|
||||
conversation = create(:conversation, status: 'open')
|
||||
expect(conversation.toggle_status).to eq(true)
|
||||
expect(conversation.toggle_status).to be(true)
|
||||
expect(conversation.reload.status).to eq('resolved')
|
||||
end
|
||||
|
||||
it 'toggles conversation status to open when resolved' do
|
||||
conversation = create(:conversation, status: 'resolved')
|
||||
expect(conversation.toggle_status).to eq(true)
|
||||
expect(conversation.toggle_status).to be(true)
|
||||
expect(conversation.reload.status).to eq('open')
|
||||
end
|
||||
|
||||
it 'toggles conversation status to open when pending' do
|
||||
conversation = create(:conversation, status: 'pending')
|
||||
expect(conversation.toggle_status).to eq(true)
|
||||
expect(conversation.toggle_status).to be(true)
|
||||
expect(conversation.reload.status).to eq('open')
|
||||
end
|
||||
|
||||
it 'toggles conversation status to open when snoozed' do
|
||||
conversation = create(:conversation, status: 'snoozed')
|
||||
expect(conversation.toggle_status).to eq(true)
|
||||
expect(conversation.toggle_status).to be(true)
|
||||
expect(conversation.reload.status).to eq('open')
|
||||
end
|
||||
end
|
||||
@@ -264,9 +264,9 @@ RSpec.describe Conversation, type: :model do
|
||||
describe '#ensure_snooze_until_reset' do
|
||||
it 'resets the snoozed_until when status is toggled' do
|
||||
conversation = create(:conversation, status: 'snoozed', snoozed_until: 2.days.from_now)
|
||||
expect(conversation.snoozed_until).not_to eq nil
|
||||
expect(conversation.toggle_status).to eq(true)
|
||||
expect(conversation.reload.snoozed_until).to eq(nil)
|
||||
expect(conversation.snoozed_until).not_to be_nil
|
||||
expect(conversation.toggle_status).to be(true)
|
||||
expect(conversation.reload.snoozed_until).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -283,12 +283,12 @@ RSpec.describe Conversation, type: :model do
|
||||
|
||||
it 'marks conversation as resolved' do
|
||||
mute!
|
||||
expect(conversation.reload.resolved?).to eq(true)
|
||||
expect(conversation.reload.resolved?).to be(true)
|
||||
end
|
||||
|
||||
it 'marks conversation as muted in redis' do
|
||||
mute!
|
||||
expect(Redis::Alfred.get(conversation.send(:mute_key))).not_to eq(nil)
|
||||
expect(Redis::Alfred.get(conversation.send(:mute_key))).not_to be_nil
|
||||
end
|
||||
|
||||
it 'creates mute message' do
|
||||
@@ -335,11 +335,11 @@ RSpec.describe Conversation, type: :model do
|
||||
|
||||
it 'return true if conversation is muted' do
|
||||
conversation.mute!
|
||||
expect(muted?).to eq(true)
|
||||
expect(muted?).to be(true)
|
||||
end
|
||||
|
||||
it 'returns false if conversation is not muted' do
|
||||
expect(muted?).to eq(false)
|
||||
expect(muted?).to be(false)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -475,7 +475,7 @@ RSpec.describe Conversation, type: :model do
|
||||
let(:conversation) { create(:conversation) }
|
||||
|
||||
it 'returns true' do
|
||||
expect(conversation.can_reply?).to eq true
|
||||
expect(conversation.can_reply?).to be true
|
||||
end
|
||||
|
||||
it 'return true for facebook channels' do
|
||||
@@ -484,8 +484,8 @@ RSpec.describe Conversation, type: :model do
|
||||
facebook_inbox = create(:inbox, channel: facebook_channel, account: facebook_channel.account)
|
||||
fb_conversation = create(:conversation, inbox: facebook_inbox, account: facebook_channel.account)
|
||||
|
||||
expect(fb_conversation.can_reply?).to eq true
|
||||
expect(facebook_channel.messaging_window_enabled?).to eq false
|
||||
expect(fb_conversation.can_reply?).to be true
|
||||
expect(facebook_channel.messaging_window_enabled?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -511,7 +511,7 @@ RSpec.describe Conversation, type: :model do
|
||||
created_at: Time.now - 48.hours
|
||||
)
|
||||
|
||||
expect(conversation.can_reply?).to eq true
|
||||
expect(conversation.can_reply?).to be true
|
||||
end
|
||||
|
||||
it 'return false without HUMAN_AGENT if it is outside of 24 hour window' do
|
||||
@@ -526,7 +526,7 @@ RSpec.describe Conversation, type: :model do
|
||||
created_at: Time.now - 48.hours
|
||||
)
|
||||
|
||||
expect(conversation.can_reply?).to eq false
|
||||
expect(conversation.can_reply?).to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -546,8 +546,8 @@ RSpec.describe Conversation, type: :model do
|
||||
created_at: Time.now - 13.hours
|
||||
)
|
||||
|
||||
expect(api_channel.additional_attributes['agent_reply_time_window']).to eq nil
|
||||
expect(conversation.can_reply?).to eq true
|
||||
expect(api_channel.additional_attributes['agent_reply_time_window']).to be_nil
|
||||
expect(conversation.can_reply?).to be true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -563,7 +563,7 @@ RSpec.describe Conversation, type: :model do
|
||||
)
|
||||
|
||||
expect(api_channel_with_limit.additional_attributes['agent_reply_time_window']).to eq '12'
|
||||
expect(conversation.can_reply?).to eq false
|
||||
expect(conversation.can_reply?).to be false
|
||||
end
|
||||
|
||||
it 'return true if it is inside of agent_reply_time_window' do
|
||||
@@ -574,7 +574,7 @@ RSpec.describe Conversation, type: :model do
|
||||
inbox: api_channel_with_limit.inbox,
|
||||
conversation: conversation
|
||||
)
|
||||
expect(conversation.can_reply?).to eq true
|
||||
expect(conversation.can_reply?).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -595,7 +595,7 @@ RSpec.describe Conversation, type: :model do
|
||||
let(:conversation) { create(:conversation, additional_attributes: { referer: 'javascript' }) }
|
||||
|
||||
it 'returns nil' do
|
||||
expect(conversation['additional_attributes']['referer']).to eq(nil)
|
||||
expect(conversation['additional_attributes']['referer']).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ RSpec.describe CsatSurveyResponse, type: :model do
|
||||
|
||||
it 'validates that the rating can only be in range 1-5' do
|
||||
csat_survey_response = build(:csat_survey_response, rating: 6)
|
||||
expect(csat_survey_response.valid?).to eq false
|
||||
expect(csat_survey_response.valid?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@ RSpec.describe CsatSurveyResponse, type: :model do
|
||||
describe 'validates_factory' do
|
||||
it 'creates valid csat_survey_response object' do
|
||||
csat_survey_response = create(:csat_survey_response)
|
||||
expect(csat_survey_response.valid?).to eq true
|
||||
expect(csat_survey_response.valid?).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@ RSpec.describe DataImport, type: :model do
|
||||
|
||||
describe 'validations' do
|
||||
it 'returns false for invalid data type' do
|
||||
expect(build(:data_import, data_type: 'Xyc').valid?).to eq false
|
||||
expect(build(:data_import, data_type: 'Xyc').valid?).to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -74,7 +74,7 @@ RSpec.describe Inbox do
|
||||
let(:channel_val) { Channel::FacebookPage.new }
|
||||
|
||||
it do
|
||||
expect(inbox.facebook?).to eq(true)
|
||||
expect(inbox.facebook?).to be(true)
|
||||
expect(inbox.inbox_type).to eq('Facebook')
|
||||
end
|
||||
end
|
||||
@@ -83,7 +83,7 @@ RSpec.describe Inbox do
|
||||
let(:channel_val) { Channel::WebWidget.new }
|
||||
|
||||
it do
|
||||
expect(inbox.facebook?).to eq(false)
|
||||
expect(inbox.facebook?).to be(false)
|
||||
expect(inbox.inbox_type).to eq('Website')
|
||||
end
|
||||
end
|
||||
@@ -98,7 +98,7 @@ RSpec.describe Inbox do
|
||||
let(:channel_val) { Channel::WebWidget.new }
|
||||
|
||||
it do
|
||||
expect(inbox.web_widget?).to eq(true)
|
||||
expect(inbox.web_widget?).to be(true)
|
||||
expect(inbox.inbox_type).to eq('Website')
|
||||
end
|
||||
end
|
||||
@@ -107,7 +107,7 @@ RSpec.describe Inbox do
|
||||
let(:channel_val) { Channel::Api.new }
|
||||
|
||||
it do
|
||||
expect(inbox.web_widget?).to eq(false)
|
||||
expect(inbox.web_widget?).to be(false)
|
||||
expect(inbox.inbox_type).to eq('API')
|
||||
end
|
||||
end
|
||||
@@ -122,7 +122,7 @@ RSpec.describe Inbox do
|
||||
let(:channel_val) { Channel::Api.new }
|
||||
|
||||
it do
|
||||
expect(inbox.api?).to eq(true)
|
||||
expect(inbox.api?).to be(true)
|
||||
expect(inbox.inbox_type).to eq('API')
|
||||
end
|
||||
end
|
||||
@@ -131,7 +131,7 @@ RSpec.describe Inbox do
|
||||
let(:channel_val) { Channel::FacebookPage.new }
|
||||
|
||||
it do
|
||||
expect(inbox.api?).to eq(false)
|
||||
expect(inbox.api?).to be(false)
|
||||
expect(inbox.inbox_type).to eq('Facebook')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,14 +16,14 @@ RSpec.describe Integrations::Hook, type: :model do
|
||||
context 'when app allows multiple hooks' do
|
||||
it 'allows to create succesfully' do
|
||||
create(:integrations_hook, account: account, app_id: 'webhook')
|
||||
expect(build(:integrations_hook, account: account, app_id: 'webhook').valid?).to eq true
|
||||
expect(build(:integrations_hook, account: account, app_id: 'webhook').valid?).to be true
|
||||
end
|
||||
end
|
||||
|
||||
context 'when app doesnot allow multiple hooks' do
|
||||
it 'throws invalid error' do
|
||||
create(:integrations_hook, account: account, app_id: 'slack')
|
||||
expect(build(:integrations_hook, account: account, app_id: 'slack').valid?).to eq false
|
||||
expect(build(:integrations_hook, account: account, app_id: 'slack').valid?).to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,27 +8,27 @@ RSpec.describe Label, type: :model do
|
||||
describe 'title validations' do
|
||||
it 'would not let you start title without numbers or letters' do
|
||||
label = FactoryBot.build(:label, title: '_12')
|
||||
expect(label.valid?).to eq false
|
||||
expect(label.valid?).to be false
|
||||
end
|
||||
|
||||
it 'would not let you use special characters' do
|
||||
label = FactoryBot.build(:label, title: 'jell;;2_12')
|
||||
expect(label.valid?).to eq false
|
||||
expect(label.valid?).to be false
|
||||
end
|
||||
|
||||
it 'would not allow space' do
|
||||
label = FactoryBot.build(:label, title: 'heeloo _12')
|
||||
expect(label.valid?).to eq false
|
||||
expect(label.valid?).to be false
|
||||
end
|
||||
|
||||
it 'allows foreign charactes' do
|
||||
label = FactoryBot.build(:label, title: '学中文_12')
|
||||
expect(label.valid?).to eq true
|
||||
expect(label.valid?).to be true
|
||||
end
|
||||
|
||||
it 'converts uppercase letters to lowercase' do
|
||||
label = FactoryBot.build(:label, title: 'Hello_World')
|
||||
expect(label.valid?).to eq true
|
||||
expect(label.valid?).to be true
|
||||
expect(label.title).to eq 'hello_world'
|
||||
end
|
||||
|
||||
@@ -36,7 +36,7 @@ RSpec.describe Label, type: :model do
|
||||
account = create(:account)
|
||||
label = FactoryBot.create(:label, account: account)
|
||||
duplicate_label = FactoryBot.build(:label, title: label.title, account: account)
|
||||
expect(duplicate_label.valid?).to eq false
|
||||
expect(duplicate_label.valid?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -16,20 +16,20 @@ RSpec.describe Message, type: :model do
|
||||
it 'reopens resolved conversation when the message is from a contact' do
|
||||
conversation.resolved!
|
||||
message.save!
|
||||
expect(message.conversation.open?).to eq true
|
||||
expect(message.conversation.open?).to be true
|
||||
end
|
||||
|
||||
it 'reopens snoozed conversation when the message is from a contact' do
|
||||
conversation.snoozed!
|
||||
message.save!
|
||||
expect(message.conversation.open?).to eq true
|
||||
expect(message.conversation.open?).to be true
|
||||
end
|
||||
|
||||
it 'will not reopen if the conversation is muted' do
|
||||
conversation.resolved!
|
||||
conversation.mute!
|
||||
message.save!
|
||||
expect(message.conversation.open?).to eq false
|
||||
expect(message.conversation.open?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ RSpec.describe User do
|
||||
describe 'pubsub_token' do
|
||||
before { user.update(name: Faker::Name.name) }
|
||||
|
||||
it { expect(user.pubsub_token).not_to eq(nil) }
|
||||
it { expect(user.pubsub_token).not_to be_nil }
|
||||
it { expect(user.saved_changes.keys).not_to eq('pubsub_token') }
|
||||
end
|
||||
|
||||
@@ -58,18 +58,18 @@ RSpec.describe User do
|
||||
sso_auth_token2 = user.generate_sso_auth_token
|
||||
expect(sso_auth_token1).present?
|
||||
expect(sso_auth_token2).present?
|
||||
expect(user.valid_sso_auth_token?(sso_auth_token1)).to eq true
|
||||
expect(user.valid_sso_auth_token?(sso_auth_token2)).to eq true
|
||||
expect(user.valid_sso_auth_token?(sso_auth_token1)).to be true
|
||||
expect(user.valid_sso_auth_token?(sso_auth_token2)).to be true
|
||||
end
|
||||
|
||||
it 'wont validate an invalid token' do
|
||||
expect(user.valid_sso_auth_token?(SecureRandom.hex(32))).to eq false
|
||||
expect(user.valid_sso_auth_token?(SecureRandom.hex(32))).to be false
|
||||
end
|
||||
|
||||
it 'wont validate an invalidated token' do
|
||||
sso_auth_token = user.generate_sso_auth_token
|
||||
user.invalidate_sso_auth_token(sso_auth_token)
|
||||
expect(user.valid_sso_auth_token?(sso_auth_token)).to eq false
|
||||
expect(user.valid_sso_auth_token?(sso_auth_token)).to be false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user