Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

adapt spec expectations

ulfertsf174a10dcc45
diff --git a/spec/helpers/individual_principal_hooks_helper_spec.rb b/spec/helpers/individual_principal_hooks_helper_spec.rb
index b087c414d80..074bfae738b 100644
--- a/spec/helpers/individual_principal_hooks_helper_spec.rb
+++ b/spec/helpers/individual_principal_hooks_helper_spec.rb
@@ -36,43 +36,48 @@ describe IndividualPrincipalHooksHelper, type: :helper do
describe '#individual_principal_key' do
it 'returns the class name in underscore format' do
- expect(helper.individual_principal_key(user)).to eql(:user)
- expect(helper.individual_principal_key(placeholder_user)).to eql(:placeholder_user)
+ expect(helper.individual_principal_key(user)).to be(:user)
+ expect(helper.individual_principal_key(placeholder_user)).to be(:placeholder_user)
end
end
describe '#call_individual_principals_memberships_hook' do
- context 'with user and without context' do
- before do
- expect(helper).to receive(:call_hook).with(:view_users_memberships_table_foo,
- user: user)
- end
+ before do
+ allow(helper)
+ .to receive(:call_hook)
+ end
+ context 'with user and without context' do
it 'call call_hook with the correct arguments' do
helper.call_individual_principals_memberships_hook(user, 'foo')
+
+ expect(helper)
+ .to have_received(:call_hook)
+ .with(:view_users_memberships_table_foo,
+ user: user)
end
end
context 'with placeholder user and without context' do
- before do
- expect(helper).to receive(:call_hook).with(:view_placeholder_users_memberships_table_foo,
- placeholder_user: placeholder_user)
- end
-
it 'call call_hook with the correct arguments' do
helper.call_individual_principals_memberships_hook(placeholder_user, 'foo')
+
+ expect(helper)
+ .to have_received(:call_hook)
+ .with(:view_placeholder_users_memberships_table_foo,
+ placeholder_user: placeholder_user)
end
end
context 'with user and with context' do
- before do
- expect(helper).to receive(:call_hook).with(:view_users_memberships_table_foo,
- user: user,
- yay: 'yo')
- end
-
it 'call call_hook with the correct arguments' do
helper.call_individual_principals_memberships_hook(user, 'foo', yay: 'yo')
+
+ expect(helper)
+ .to have_received(:call_hook)
+ .with(:view_users_memberships_table_foo,
+ user: user,
+ yay: 'yo')
end
end
end
diff --git a/spec/lib/open_project/configuration_spec.rb b/spec/lib/open_project/configuration_spec.rb
index 7da8a6c1928..32df4e03933 100644
--- a/spec/lib/open_project/configuration_spec.rb
+++ b/spec/lib/open_project/configuration_spec.rb
@@ -437,7 +437,14 @@ describe OpenProject::Configuration do
end
describe '.configure_legacy_action_mailer' do
- let(:action_mailer) { double('ActionMailer::Base', deliveries: []) }
+ let(:action_mailer) do
+ class_double('ActionMailer::Base',
+ deliveries: []).tap do |mailer|
+ allow(mailer).to receive(:perform_deliveries=)
+ allow(mailer).to receive(:delivery_method=)
+ allow(mailer).to receive(:smtp_settings=)
+ end
+ end
let(:config) do
{ 'email_delivery_method' => 'smtp',
'smtp_address' => 'smtp.example.net',
@@ -449,11 +456,18 @@ describe OpenProject::Configuration do
end
it 'enables deliveries and configure ActionMailer smtp delivery' do
- expect(action_mailer).to receive(:perform_deliveries=).with(true)
- expect(action_mailer).to receive(:delivery_method=).with(:smtp)
- expect(action_mailer).to receive(:smtp_settings=).with(address: 'smtp.example.net',
- port: '25')
described_class.send(:configure_legacy_action_mailer, config)
+
+ expect(action_mailer)
+ .to have_received(:perform_deliveries=)
+ .with(true)
+ expect(action_mailer)
+ .to have_received(:delivery_method=)
+ .with(:smtp)
+ expect(action_mailer)
+ .to have_received(:smtp_settings=)
+ .with(address: 'smtp.example.net',
+ port: '25')
end
end