-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #927 from rubyforgood/free-specs-from-seeding
Free specs from seeding
- Loading branch information
Showing
24 changed files
with
143 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
class GenerateLandingPageJson < ActiveInteraction::Base | ||
object :system_setting | ||
object :organization | ||
|
||
def execute | ||
{ | ||
landing_page_text_what: sanitize(system_setting.landing_page_text_what), | ||
landing_page_text_who: sanitize(system_setting.landing_page_text_who), | ||
landing_page_text_how: sanitize(system_setting.landing_page_text_how), | ||
organization_name: organization.name, | ||
}.to_json | ||
end | ||
|
||
private | ||
|
||
def sanitize string | ||
HtmlSanitizer.new(string).sanitize | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
class PeerToPeerMatchMailer < ApplicationMailer | ||
def peer_to_peer_email(contribution, peer_alias:, message:) | ||
@peer_email_address = contribution.person.email | ||
def peer_to_peer_email(contribution, peer_alias:, message:, organization:) | ||
peer_email_address = contribution.person.email | ||
|
||
email_subject = if contribution.ask? | ||
"#{peer_alias} is offering to meet your ask" | ||
elsif contribution.offer? # TODO: check if community resource when added | ||
"#{peer_alias} would like to accept your offer" | ||
end | ||
|
||
mail(to: @peer_email_address, subject: email_subject) do |format| | ||
format.html { render locals: { contribution: contribution, message: message } } | ||
mail(to: peer_email_address, subject: email_subject) do |format| | ||
format.html do | ||
render locals: { | ||
contribution: contribution, | ||
message: message, | ||
organization: organization, | ||
peer_email_address: peer_email_address, | ||
} | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
app/views/peer_to_peer_match_mailer/peer_to_peer_email.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
require 'rails_helper' | ||
|
||
RSpec.describe GenerateLandingPageJson do | ||
let(:system_setting) do | ||
build :system_setting, { | ||
landing_page_text_what: 'what?', | ||
landing_page_text_who: 'who?', | ||
landing_page_text_how: 'how?', | ||
} | ||
end | ||
|
||
let(:organization) { build :organization, name: 'org_name' } | ||
|
||
subject(:json) do | ||
GenerateLandingPageJson.run! system_setting: system_setting, organization: organization | ||
end | ||
|
||
it 'pulls landing page text from system settings' do | ||
expect(JSON.parse(json)).to include( | ||
"landing_page_text_what" => 'what?', | ||
"landing_page_text_who" => 'who?', | ||
"landing_page_text_how" => 'how?', | ||
) | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.