Skip to content
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.

Commit

Permalink
Remove start page parts of content item presenter
Browse files Browse the repository at this point in the history
* Refactor LicenceFinderFormContentItemPresenter into
LicenceFinderContentItemPresenter
  • Loading branch information
fofr committed Jun 20, 2017
1 parent a9aa8dd commit 566760c
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 63 deletions.
2 changes: 1 addition & 1 deletion app/notifiers/publishing_api_notifier.rb
Expand Up @@ -11,7 +11,7 @@ class PublishingApiNotifier

def self.publish
LICENCE_FINDER_FORM_DETAILS.each do |base_path, content_id|
new.publish(LicenceFinderFormContentItemPresenter.new(base_path, content_id))
new.publish(LicenceFinderContentItemPresenter.new(base_path, content_id))
end
end

Expand Down
11 changes: 5 additions & 6 deletions app/presenters/licence_finder_content_item_presenter.rb
@@ -1,18 +1,17 @@
class LicenceFinderContentItemPresenter
def base_path
"/" + metadata[:slug]
end
attr_reader :base_path, :content_id

def content_id
metadata[:content_id]
def initialize(base_path, content_id)
@base_path = base_path
@content_id = content_id
end

def update_type
'minor'
end

def route_type
'exact'
'prefix'
end

def payload
Expand Down
12 changes: 0 additions & 12 deletions app/presenters/licence_finder_form_content_item_presenter.rb

This file was deleted.

1 change: 0 additions & 1 deletion config/initializers/application_metadata.rb
@@ -1,6 +1,5 @@
APPLICATION_METADATA = {
slug: APP_SLUG,
content_id: "69af22e0-da49-4810-9ee4-22b4666ac627",
title: "Licence Finder",
description: "Find out which licences you might need for your activity or business."
}
7 changes: 0 additions & 7 deletions spec/notifiers/publishing_api_notifier_spec.rb
Expand Up @@ -17,12 +17,5 @@

PublishingApiNotifier.publish
end

it "does not publish the start page" do
expect(Services.publishing_api).not_to receive(:put_content).with("69af22e0-da49-4810-9ee4-22b4666ac627", be_valid_against_schema('generic'))
expect(Services.publishing_api).not_to receive(:publish).with("69af22e0-da49-4810-9ee4-22b4666ac627", 'minor')

PublishingApiNotifier.publish
end
end
end
10 changes: 5 additions & 5 deletions spec/presenters/licence_finder_content_item_presenter_spec.rb
@@ -1,11 +1,11 @@
require 'spec_helper'

RSpec.describe LicenceFinderContentItemPresenter do
let(:subject) { LicenceFinderContentItemPresenter.new }
let(:subject) { LicenceFinderContentItemPresenter.new("/licence-finder/sectors", "4ade13fa-7e79-4bee-b809-61dbe5c3aa22") }

describe "#base_path" do
it "has the correct base path" do
expect(subject.base_path).to eq "/licence-finder"
expect(subject.base_path).to eq "/licence-finder/sectors"
end
end

Expand All @@ -18,14 +18,14 @@
expect(subject.payload[:title]).to eq "Licence Finder"
end

it 'uses an exact route' do
expect(subject.payload[:routes].first[:type]).to eql('exact')
it 'uses a prefix route' do
expect(subject.payload[:routes].first[:type]).to eql('prefix')
end
end

describe '#content_id' do
it 'has the expected content_id' do
expect(subject.content_id).to eql("69af22e0-da49-4810-9ee4-22b4666ac627")
expect(subject.content_id).to eql("4ade13fa-7e79-4bee-b809-61dbe5c3aa22")
end
end
end
31 changes: 0 additions & 31 deletions spec/presenters/licence_finder_form_content_item_presenter_spec.rb

This file was deleted.

0 comments on commit 566760c

Please sign in to comment.