Rubocop spec/models/supporter_note_spec.rb
This commit is contained in:
parent
83e7c33e45
commit
916fd18da5
2 changed files with 111 additions and 99 deletions
|
@ -594,7 +594,6 @@ AllCops:
|
|||
- 'spec/models/campaign_gift_purchase_spec.rb'
|
||||
- 'spec/models/custom_field_master_spec.rb'
|
||||
- 'spec/models/user_spec.rb'
|
||||
- 'spec/models/supporter_note_spec.rb'
|
||||
- 'spec/models/modern_campaign_gift_spec.rb'
|
||||
- 'spec/models/import_request_spec.rb'
|
||||
- 'spec/models/nonprofit_spec.rb'
|
||||
|
|
|
@ -3,11 +3,13 @@
|
|||
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
|
||||
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
|
||||
require 'rails_helper'
|
||||
|
||||
# rubocop:disable RSpec/MessageSpies
|
||||
# rubocop:disable RSpec/ExampleLength
|
||||
# rubocop:disable RSpec/MultipleExpectations
|
||||
RSpec.describe SupporterNote, type: :model do
|
||||
include_context :shared_donation_charge_context
|
||||
let(:content) { "CONTENT"}
|
||||
let(:content2) {"CONTENT2"}
|
||||
let(:content) { 'CONTENT' }
|
||||
let(:content2) { 'CONTENT2' }
|
||||
|
||||
let(:supporter_note) { supporter.supporter_notes.create(content: content, user: user) }
|
||||
|
||||
|
@ -18,7 +20,9 @@ RSpec.describe SupporterNote, type: :model do
|
|||
it 'announces created' do
|
||||
expect(Houdini.event_publisher).to receive(:announce).with(:supporter_created, anything)
|
||||
expect(Houdini.event_publisher).to receive(:announce).with(:supporter_address_created, anything)
|
||||
expect(Houdini.event_publisher).to receive(:announce).with(:supporter_note_created, {
|
||||
expect(Houdini.event_publisher).to receive(:announce).with(
|
||||
:supporter_note_created,
|
||||
{
|
||||
'id' => match_houid('objevt'),
|
||||
'object' => 'object_event',
|
||||
'type' => 'supporter_note.created',
|
||||
|
@ -37,10 +41,11 @@ RSpec.describe SupporterNote, type: :model do
|
|||
'id' => user.id,
|
||||
'object' => 'user'
|
||||
},
|
||||
'supporter' => supporter_to_builder_base.merge({'name' => "Fake Supporter Name"})
|
||||
'supporter' => supporter_to_builder_base.merge({ 'name' => 'Fake Supporter Name' })
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
supporter_note
|
||||
end
|
||||
|
@ -49,7 +54,9 @@ RSpec.describe SupporterNote, type: :model do
|
|||
expect(Houdini.event_publisher).to receive(:announce).with(:supporter_created, anything)
|
||||
expect(Houdini.event_publisher).to receive(:announce).with(:supporter_address_created, anything)
|
||||
expect(Houdini.event_publisher).to receive(:announce).with(:supporter_note_created, anything).ordered
|
||||
expect(Houdini.event_publisher).to receive(:announce).with(:supporter_note_updated, {
|
||||
expect(Houdini.event_publisher).to receive(:announce).with(
|
||||
:supporter_note_updated,
|
||||
{
|
||||
'id' => match_houid('objevt'),
|
||||
'object' => 'object_event',
|
||||
'type' => 'supporter_note.updated',
|
||||
|
@ -68,10 +75,11 @@ RSpec.describe SupporterNote, type: :model do
|
|||
'id' => user.id,
|
||||
'object' => 'user'
|
||||
},
|
||||
'supporter' => supporter_to_builder_base.merge({'name' => "Fake Supporter Name"})
|
||||
'supporter' => supporter_to_builder_base.merge({ 'name' => 'Fake Supporter Name' })
|
||||
}
|
||||
}
|
||||
}).ordered
|
||||
}
|
||||
).ordered
|
||||
|
||||
supporter_note
|
||||
supporter_note.content = content2
|
||||
|
@ -79,10 +87,13 @@ RSpec.describe SupporterNote, type: :model do
|
|||
end
|
||||
|
||||
it 'announces deleted' do
|
||||
allow(Houdini.event_publisher)
|
||||
expect(Houdini.event_publisher).to receive(:announce).with(:supporter_created, anything)
|
||||
expect(Houdini.event_publisher).to receive(:announce).with(:supporter_address_created, anything)
|
||||
expect(Houdini.event_publisher).to receive(:announce).with(:supporter_note_created, anything).ordered
|
||||
expect(Houdini.event_publisher).to receive(:announce).with(:supporter_note_deleted, {
|
||||
expect(Houdini.event_publisher).to receive(:announce).with(
|
||||
:supporter_note_deleted,
|
||||
{
|
||||
'id' => match_houid('objevt'),
|
||||
'object' => 'object_event',
|
||||
'type' => 'supporter_note.deleted',
|
||||
|
@ -101,12 +112,14 @@ RSpec.describe SupporterNote, type: :model do
|
|||
'id' => user.id,
|
||||
'object' => 'user'
|
||||
},
|
||||
'supporter' => supporter_to_builder_base.merge({'name' => "Fake Supporter Name"})
|
||||
'supporter' => supporter_to_builder_base.merge({ 'name' => 'Fake Supporter Name' })
|
||||
}
|
||||
}
|
||||
}).ordered
|
||||
}
|
||||
).ordered
|
||||
|
||||
supporter_note.discard!
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
# rubocop:enable all
|
||||
|
|
Loading…
Reference in a new issue