Module: LocalServicesHelper

Defined in:
lib/govuk_content_models/test_helpers/local_services.rb

Instance Method Summary collapse

Instance Method Details

#add_service_interaction(existing_authority, lgsl_code) ⇒ Object



9
10
11
12
# File 'lib/govuk_content_models/test_helpers/local_services.rb', line 9

def add_service_interaction(existing_authority, lgsl_code)
  FactoryGirl.create(:local_interaction, local_authority: existing_authority,
                     lgsl_code: lgsl_code)
end

#make_authority(tier, options) ⇒ Object



2
3
4
5
6
7
# File 'lib/govuk_content_models/test_helpers/local_services.rb', line 2

def make_authority(tier, options)
  authority = FactoryGirl.create(:local_authority_with_contact,
                                 snac: options[:snac], tier: tier)
  add_service_interaction(authority, options[:lgsl]) if options[:lgsl]
  authority
end

#make_authority_providing(lgsl_code) ⇒ Object



18
19
20
21
22
23
# File 'lib/govuk_content_models/test_helpers/local_services.rb', line 18

def make_authority_providing(lgsl_code)
  council = FactoryGirl.create(:local_authority, snac: "00AA", tier: "county")
  FactoryGirl.create(:local_interaction, local_authority: council,
                     lgsl_code: lgsl_code)
  council
end

#make_service(lgsl_code, providing_tier) ⇒ Object



14
15
16
# File 'lib/govuk_content_models/test_helpers/local_services.rb', line 14

def make_service(lgsl_code, providing_tier)
  LocalService.create!(lgsl_code: lgsl_code, providing_tier: providing_tier)
end