Skip to content

Commit

Permalink
Merge 952a08b into 51e1f13
Browse files Browse the repository at this point in the history
  • Loading branch information
jhackett1 authored Oct 13, 2022
2 parents 51e1f13 + 952a08b commit e03995c
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 26 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ TAGS
.ruby-version

# Ignore local uploads
public/uploads/
public/uploads/
vendor/bundle
29 changes: 15 additions & 14 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ AllCops:
- spec/**/*
- config/**/*
- bin/**/*
- vendor/bundle/**/*

require:
- rubocop
Expand All @@ -17,7 +18,7 @@ require:
Layout/LineLength:
Max: 120
Exclude:
- 'spec/**/*'
- "spec/**/*"

Layout/EndOfLine:
EnforcedStyle: lf
Expand All @@ -39,19 +40,19 @@ Rails/Date:
Enabled: true

Metrics/BlockLength:
ExcludedMethods: ['describe', 'context', 'draw', 'namespace']
ExcludedMethods: ["describe", "context", "draw", "namespace"]

Performance:
Exclude:
- '**/test/**/*'
- "**/test/**/*"

Rails:
Enabled: true

Rails/OutputSafety:
Enabled: true
Exclude:
- 'app/presenters/job_presenter.rb'
- "app/presenters/job_presenter.rb"

Bundler/OrderedGems:
Enabled: false
Expand Down Expand Up @@ -114,13 +115,13 @@ Layout/SpaceAroundOperators:
Enabled: true

Layout/SpaceBeforeComma:
Enabled: true
Enabled: true

Layout/SpaceBeforeBlockBraces:
Enabled: true

Layout/SpaceBeforeFirstArg:
Enabled: true
Enabled: true

Layout/SpaceInsideBlockBraces:
Enabled: true
Expand Down Expand Up @@ -159,23 +160,23 @@ Lint/UriEscapeUnescape:
Metrics/MethodLength:
Max: 10
Exclude:
- 'spec/**/*'
- "spec/**/*"

Style/AndOr:
Enabled: true

Style/BlockComments:
Enabled: true
Exclude:
- 'spec/spec_helper.rb'
- "spec/spec_helper.rb"

Style/CaseEquality:
Enabled: false

Style/CollectionMethods:
PreferredMethods:
inject: 'inject'
reduce: 'inject'
inject: "inject"
reduce: "inject"

Style/ColonMethodCall:
Enabled: true
Expand All @@ -192,7 +193,7 @@ Style/FrozenStringLiteralComment:
Style/StringLiterals:
Enabled: true
Exclude:
- 'config/*.rb'
- "config/*.rb"

Style/GuardClause:
Enabled: false
Expand Down Expand Up @@ -253,12 +254,12 @@ Rails/Validation:
Rails/SkipsModelValidations:
Enabled: true
Exclude:
- 'spec/**/*'
- "spec/**/*"

Rails/FilePath:
Enabled: true
Exclude:
- 'spec/rails_helper.rb'
- "spec/rails_helper.rb"

RSpec/MultipleExpectations:
Max: 2
Expand All @@ -269,7 +270,7 @@ RSpec/ExampleLength:
RSpec/SubjectStub:
Enabled: true
Exclude:
- 'spec/models/job_spec.rb'
- "spec/models/job_spec.rb"

RSpec/NestedGroups:
Max: 5
6 changes: 3 additions & 3 deletions app/mailers/event_invitation_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ def invite_coach(event, member, invitation)
@member = member
@invitation = invitation
@host_address = AddressPresenter.new(@event.venue.address)
@everyone_is_invited = !event.audience

subject = "Coach Invitation: #{@event.name}"

mail(mail_args(member, subject), &:html)
mail(mail_args(member, @everyone_is_invited ? "Invitation: #{@event.name}" : "Coach Invitation: #{@event.name}"),
&:html)
end

def attending(event, member, invitation)
Expand Down
4 changes: 2 additions & 2 deletions app/views/event_invitation_mailer/invite_coach.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
= render partial: 'shared_mailers/header', locals: { title: 'Coach Event Invitation' }
= render partial: 'shared_mailers/header', locals: { title: @everyone_is_invited ? 'Event Invitation' : 'Coach Event Invitation' }
%body{ bgcolor: '#FFFFFF' }

= render partial: 'shared_mailers/body_header', locals: { title: 'Coach Event Invitation' }
= render partial: 'shared_mailers/body_header', locals: { title: @everyone_is_invited ? 'Event Invitation' : 'Coach Event Invitation' }

%table{ class: 'body-wrap'}
%tr
Expand Down
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
t.string "surname"
t.string "email"
t.boolean "mailing_list_consent", default: false
t.string "token", null: false
t.string "token", null: false
end

add_index "contacts", ["email", "sponsor_id"], name: "index_contacts_on_email_and_sponsor_id", unique: true, using: :btree
Expand Down
21 changes: 16 additions & 5 deletions spec/mailers/event_invitation_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
RSpec.describe EventInvitationMailer, type: :mailer do
let(:email) { ActionMailer::Base.deliveries.last }
let(:event) { Fabricate(:event, date_and_time: Time.zone.local(2017, 11, 12, 10, 0), name: 'Test event') }
let(:coach_event) { Fabricate(:event, date_and_time: Time.zone.local(2017, 11, 12, 10, 0), name: 'Test event', audience: 'Coaches') }
let(:member) { Fabricate(:member) }
let(:invitation) { Fabricate(:invitation, event: event, member: member) }

Expand All @@ -14,12 +15,22 @@
expect(email.body.encoded).to match('hello@codebar.io')
end

it '#invite_coach' do
email_subject = "Coach Invitation: #{event.name}"
EventInvitationMailer.invite_coach(event, member, invitation).deliver_now
describe '#invite_coach' do
it 'sends a generic invitation if the event has no audiencce' do
email_subject = "Invitation: #{event.name}"
EventInvitationMailer.invite_coach(event, member, invitation).deliver_now

expect(email.subject).to eq(email_subject)
expect(email.body.encoded).to match('hello@codebar.io')
expect(email.subject).to eq(email_subject)
expect(email.body.encoded).to match('hello@codebar.io')
end

it 'sends a coach invitation of the event is for coaches' do
email_subject = "Coach Invitation: #{event.name}"
EventInvitationMailer.invite_coach(coach_event, member, invitation).deliver_now

expect(email.subject).to eq(email_subject)
expect(email.body.encoded).to match('hello@codebar.io')
end
end

it '#attending' do
Expand Down

0 comments on commit e03995c

Please sign in to comment.