Skip to content

Commit

Permalink
Add extra tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrayner committed Oct 4, 2018
1 parent 4410d4d commit 2c49432
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 13 deletions.
3 changes: 2 additions & 1 deletion app/serializers/page_serializer/base_page_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ class BasePageSerializer < BaseSerializer
attr_reader :request, :request_id, :data_alternates, :request_original_url
include ActionDispatch::Routing::UrlFor

# @param [ActionDispatch::Request] request the current request object
# @param [ActionDispatch::Request] request the current request object.
# @param [Array<Hash>] data_alternates array containing the href and type of the alternative data urls.
def initialize(request: nil, data_alternates: nil)
@request = request
@request_id = request.try(:env)&.fetch('ApplicationInsights.request.id', nil) if request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

it 'when given a display_data argument returns a hash containing the name and data' do
serializer = described_class.new(link: '/mps', text: 'MPs', download: true, display_data: 'display_data')
create_fixture(serializer, 'with_display_data')

expected = get_fixture('with_display_data')

expect(serializer.to_yaml).to eq expected
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../../rails_helper'

RSpec.describe PageSerializer::BasePageSerializer do
include_context "sample request", :include_shared => true
include_context "sample request", include_shared: true

let(:base_page_serializer) { described_class.new(request: request) }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../../rails_helper'

RSpec.describe PageSerializer::GroupsShowPageSerializer do
include_context "sample request", :include_shared => true
include_context "sample request", include_shared: true

let(:group) do
double('group',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../../rails_helper'

RSpec.describe PageSerializer::HomePageSerializer, vcr: true do
include_context "sample request", :include_shared => true
include_context "sample request", include_shared: true

context '#to_h' do
it 'produces a JSON hash' do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../../rails_helper'

RSpec.describe PageSerializer::LaidThingShowPageSerializer do
include_context "sample request", :include_shared => true
include_context "sample request", include_shared: true

let(:laying_body) { double('laying_body', name: 'LayingBodyTest', graph_id: 'E1234567') }
let(:laying_person) { double('laying_person', display_name: 'LayingPersonTest', graph_id: 'F1234567') }
Expand All @@ -21,7 +21,6 @@

context '#to_h' do
it 'produces the expected JSON hash' do
create_fixture(subject, 'fixture')
expected = get_fixture('fixture')

expect(subject.to_yaml).to eq expected
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../../rails_helper'

RSpec.describe PageSerializer::ListPageSerializer do
include_context "sample request", :include_shared => true
include_context "sample request", include_shared: true

subject { described_class.new(request: request, page_title: 'Test page', list_components: [{ list_component: 'list component' }]) }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../../rails_helper'

RSpec.describe PageSerializer::ProposedNegativeStatutoryInstrumentsShowPageSerializer do
include_context "sample request", :include_shared => true
include_context "sample request", include_shared: true

let(:laying_body) { double('laying_body', name: 'LayingBodyTest', graph_id: 'E1234567') }
let(:laying_person) { double('laying_person', display_name: 'LayingPersonTest', graph_id: 'F1234567') }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../../../rails_helper'

RSpec.describe PageSerializer::SearchPage::LandingPageSerializer do
include_context "sample request", :include_shared => true
include_context "sample request", include_shared: true

context '#to_h' do
context 'without a query' do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../../../rails_helper'

RSpec.describe PageSerializer::SearchPage::ResultsPageSerializer do
include_context "sample request", :include_shared => true
include_context "sample request", include_shared: true

let(:pagination_hash) { { start_index: 11, count: 100, results_total: 345, query: 'hello' } }
let(:result_one) {
Expand Down
2 changes: 1 addition & 1 deletion spec/serializers/page_serializer/search_page_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../../rails_helper'

RSpec.describe PageSerializer::SearchPage do
include_context "sample request", :include_shared => true
include_context "sample request", include_shared: true

let(:results) { double('results', totalResults: 658) }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../../rails_helper'

RSpec.describe PageSerializer::StatutoryInstrumentsShowPageSerializer do
include_context "sample request", :include_shared => true
include_context "sample request", include_shared: true

let(:laying_body) { double('laying_body', name: 'LayingBodyTest', graph_id: 'E1234567') }
let(:laying_person) { double('laying_person', display_name: 'LayingPersonTest', graph_id: 'F1234567') }
Expand Down

0 comments on commit 2c49432

Please sign in to comment.