Skip to content

Commit

Permalink
[frontend] EventMailer views now use locals
Browse files Browse the repository at this point in the history
  • Loading branch information
hennevogel committed Jun 29, 2017
1 parent 19880d6 commit a1e23a6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/api/app/models/notification/rss_feed_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def description
template: "event_mailer/#{event.template_name}",
layout: false,
format: :txt,
assigns: { e: event.expanded_payload, host: ::Configuration.obs_url, configuration: ::Configuration.first })
assigns: { host: ::Configuration.obs_url, configuration: ::Configuration.first },
locals: { event: event})
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/api/app/views/webui/feeds/notifications.rss.builder
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ xml.rss version: '2.0' do
xml.description notification.description
xml.category "#{notification.event_type}/#{notification.subscription_receiver_role}"
xml.pubDate notification.created_at
xml.author "#{@configuration['title']}"
xml.author @configuration['title'].to_s
end
end
end
Expand Down
7 changes: 4 additions & 3 deletions src/api/spec/models/notification/rss_feed_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
let(:greater_than_max_items_per_group) { max_items_per_group + 5 }

context 'without any RSS items' do
it { expect { Notification::RssFeedItem.cleanup }.not_to change { Notification::RssFeedItem.count } }
it { expect{ Notification::RssFeedItem.cleanup }.not_to(change{ Notification::RssFeedItem.count }) }
end

context 'with a single users' do
Expand All @@ -24,7 +24,7 @@
create_list(:rss_notification, max_items_per_user, subscriber: user)
end

it { expect { Notification::RssFeedItem.cleanup }.not_to change { Notification::RssFeedItem.count } }
it { expect { Notification::RssFeedItem.cleanup }.not_to(change { Notification::RssFeedItem.count }) }
end

context 'and enough RSS items' do
Expand Down Expand Up @@ -95,7 +95,8 @@
template: "event_mailer/#{delete_package_event.template_name}",
layout: false,
format: :txt,
assigns: { e: delete_package_event.expanded_payload, host: ::Configuration.obs_url, configuration: ::Configuration.first })
assigns: { host: ::Configuration.obs_url, configuration: ::Configuration.first },
locals: { event: delete_package_event })
end
subject { create(:rss_notification, event_type: 'Event::DeletePackage', event_payload: payload) }

Expand Down

0 comments on commit a1e23a6

Please sign in to comment.