parliament-utils 0.8.4 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9d242c466e583463358d74beb1c5655f77a46b2
4
- data.tar.gz: cd664416336d28c0b905d494ccd9aa8984127704
3
+ metadata.gz: a93c4e7d7614401ed2be2cce1d75216064cb8a05
4
+ data.tar.gz: 6d4483d22db5f03fdbf05d93e1f9d8aee233b45c
5
5
  SHA512:
6
- metadata.gz: d0eec92f910807f073bae3da16ed4bfd2dfead76405bd19224a81cb7f0745ecac4d097ce7bac4e3f5aebea37f1cd41049cefdc46a23f33afdc5e13a4d4dfd1f2
7
- data.tar.gz: c1e86d2ed0a3a67bddc5a3fecdfefe01d193c573eb12a0ea330be13fb6d4825d9cf463d2e127416ac6d2697264b14deb9862f72372b32ee3be80c267d17ea04d
6
+ metadata.gz: 5ee2a42fb6a4f7bc3c03ed3f2c8be735a82a280adbe1f7f2a3a77a9f1fa0efe4d164de7dfdb82933cbcf8afeed1ebc932040cb27611443feac6a734054e6936d
7
+ data.tar.gz: bf8f28a614588820653311e0a56c0ad51a53acfc6f87001798e0f8497b6482bb89248f196e43ceacd5be3326c0fa8c3f24066212271f8ad480bea20ffc667f92
@@ -62,9 +62,7 @@ if defined?(Airbrake) && ENV['AIRBRAKE_PROJECT_ID'].present? && ENV['AIRBRAKE_PR
62
62
  # Airbrake. This can be based on type, message, file, region or any other part
63
63
  # of the error's JSON
64
64
  Airbrake.add_filter do |notice|
65
- if notice[:errors].any? { |error| error[:type] == 'ActionController::RoutingError' }
66
- notice.ignore!
67
- end
65
+ notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActionController::RoutingError' }
68
66
  end
69
67
 
70
68
  # If you want to convert your log messages to Airbrake errors, we offer an
@@ -7,47 +7,47 @@ module Parliament
7
7
  # Note: All of the below are used to generate MIME types that our application will answer to, but NOT the
8
8
  # alternatives shown in our header. See ALTERNATIVE_MIME_TYPE_CONFIG.
9
9
  API_MIME_TYPE_CONFIG = [
10
- {
11
- nt: 'application/n-triples'
12
- },
13
- {
14
- ttl: 'text/turtle'
15
- },
16
- {
17
- tsv: 'text/tab-separated-values'
18
- },
19
- {
20
- csv: 'text/csv'
21
- },
22
- {
23
- rj: 'application/json+rdf'
24
- },
25
- {
26
- jsonld: 'application/json+ld',
27
- json: 'application/json'
28
- },
29
- {
30
- rdfxml: 'application/rdf+xml',
31
- rdf: 'application/xml',
32
- xml: 'text/xml'
33
- }
10
+ {
11
+ nt: 'application/n-triples'
12
+ },
13
+ {
14
+ ttl: 'text/turtle'
15
+ },
16
+ {
17
+ tsv: 'text/tab-separated-values'
18
+ },
19
+ {
20
+ csv: 'text/csv'
21
+ },
22
+ {
23
+ rj: 'application/json+rdf'
24
+ },
25
+ {
26
+ jsonld: 'application/json+ld',
27
+ json: 'application/json'
28
+ },
29
+ {
30
+ rdfxml: 'application/rdf+xml',
31
+ rdf: 'application/xml',
32
+ xml: 'text/xml'
33
+ }
34
34
  ].freeze
35
35
 
36
36
  # Use the above, minus the last two entries (json & xml), to build an alternative URL list.
37
37
  # Then re-create JSON and XML with the correct alternatives
38
- ALTERNATIVE_MIME_TYPE_CONFIG = API_MIME_TYPE_CONFIG.take(API_MIME_TYPE_CONFIG.size-2).concat(
39
- [
40
- {
41
- json: 'application/json+ld'
42
- },
43
- {
44
- xml: 'application/rdf+xml'
45
- }
46
- ]
38
+ ALTERNATIVE_MIME_TYPE_CONFIG = API_MIME_TYPE_CONFIG.take(API_MIME_TYPE_CONFIG.size - 2).concat(
39
+ [
40
+ {
41
+ json: 'application/json+ld'
42
+ },
43
+ {
44
+ xml: 'application/rdf+xml'
45
+ }
46
+ ]
47
47
  )
48
48
 
49
- API_MIME_TYPES = Parliament::Utils::Helpers::ApplicationHelper::API_MIME_TYPE_CONFIG.map { |mime_type| mime_type.values }.flatten.freeze
50
- API_FILE_EXTENSIONS = Parliament::Utils::Helpers::ApplicationHelper::API_MIME_TYPE_CONFIG.map { |mime_type| mime_type.keys }.flatten.freeze
49
+ API_MIME_TYPES = Parliament::Utils::Helpers::ApplicationHelper::API_MIME_TYPE_CONFIG.map(&:values).flatten.freeze
50
+ API_FILE_EXTENSIONS = Parliament::Utils::Helpers::ApplicationHelper::API_MIME_TYPE_CONFIG.map(&:keys).flatten.freeze
51
51
  ALTERNATIVE_MIME_TYPES_FLATTENED = Parliament::Utils::Helpers::ApplicationHelper::ALTERNATIVE_MIME_TYPE_CONFIG.reduce(:merge)
52
52
 
53
53
  # Sets the title for a page.
@@ -58,6 +58,7 @@ module Parliament
58
58
  content_for(:title) { page_title }
59
59
  page_title
60
60
  end
61
+
61
62
  # Before every request that provides data, see if the user is requesting a format that can be served by the data API.
62
63
  # If they are, transparently redirect them with a '302: Found' status code
63
64
  def data_check
@@ -81,7 +82,7 @@ module Parliament
81
82
  request_extension = File.extname(URI.parse(request.url).path)
82
83
  redirect_url.path = redirect_url.path + request_extension if request_extension != ''
83
84
 
84
- return redirect_to(redirect_url.to_s)
85
+ redirect_to(redirect_url.to_s)
85
86
  end
86
87
 
87
88
  # Get the data URL for our current controller and action OR raise a StandardError
@@ -107,7 +108,7 @@ module Parliament
107
108
  alternates = []
108
109
 
109
110
  ALTERNATIVE_MIME_TYPES_FLATTENED.each do |extension, format| # (key, value)
110
- uri = URI.parse(url)
111
+ uri = URI.parse(url)
111
112
  uri.path = "#{uri.path}.#{extension}"
112
113
 
113
114
  alternates << { type: format, href: uri.to_s }
@@ -127,7 +128,6 @@ module Parliament
127
128
  def reset_alternates
128
129
  Pugin.alternates = []
129
130
  end
130
-
131
131
  end
132
132
  end
133
133
  end
@@ -10,7 +10,7 @@ module Parliament
10
10
  #
11
11
  # @return [Parliament::Response::NTripleResponse] Ntriple response filtered by types
12
12
  def self.filter(request, *types)
13
- types_to_filter = self.filter_types(*types)
13
+ types_to_filter = filter_types(*types)
14
14
  Parliament::Utils::Helpers::RequestHelper.filter_response_data(
15
15
  request, *types_to_filter
16
16
  )
@@ -46,10 +46,10 @@ module Parliament
46
46
  #
47
47
  # @return [Parliament::Response::NTripleResponse] Ntriple response filtered by letters
48
48
  def self.filter_sort(request, sort_type, type, letters)
49
- type, letters = self.filter(request, type, letters)
49
+ type, letters = filter(request, type, letters)
50
50
  type = type.sort_by(sort_type)
51
51
  letters = letters.map(&:value)
52
- return type, letters
52
+ [type, letters]
53
53
  end
54
54
  end
55
55
  end
@@ -2,77 +2,79 @@ module Parliament
2
2
  module Utils
3
3
  module Helpers
4
4
  module HousesHelper
5
- # Checks if house is the House of Commons and sets @commons_id and @lords_id if not already set.
6
- #
7
- # @param [Grom::Node] house a Grom::Node with type https://id.parliament.uk/schema/House.
8
- # @return [Boolean] boolean depending on whether the house has the same id as the House of Commons.
9
- def self.commons?(house)
10
- set_ids
11
-
12
- house.graph_id == @commons_id
13
- end
14
-
15
- # Checks if house is the House of Lords and sets @commons_id and @lords_id if not already set.
16
- #
17
- # @param [Grom::Node] house a Grom::Node with type https://id.parliament.uk/schema/House.
18
- # @return [Boolean] boolean depending on whether the house has the same id as the House of Lords.
19
- def self.lords?(house)
20
- !commons?(house)
21
- end
22
-
23
- # Sets and returns the id for the House of Commons.
24
- #
25
- # @return [String] @commons_id the id for the House of Commons.
26
- def self.commons_id
27
- set_ids
28
-
29
- @commons_id
30
- end
31
-
32
- # Sets and returns the id for the House of Lords.
33
- #
34
- # @return [String] @lords_id the id for the House of Lords.
35
- def self.lords_id
36
- set_ids
37
-
38
- @lords_id
39
- end
40
-
41
- # Returns the current house id for the page alongside the other house id.
42
- #
43
- # @param [Grom::Node] house The house that a particular person is linked to.
44
- # @return [Array<String, String>] The current house id and other house id.
45
- def self.house_id_string(house)
46
- is_commons = self.commons?(house)
47
-
48
- house_ids = [commons_id, lords_id]
49
- return house_ids if is_commons
50
-
51
- house_ids.reverse
52
- end
53
-
54
- # Returns the current
55
- #
56
- # @param [Grom::Node] house The house that a particular person is linked to.
57
- # @return [Array<String, String>] The current person type and other person type.
58
- def self.person_type_string(house)
59
- is_mp = self.commons?(house)
60
-
61
- types = [I18n.t('mp_plural'), I18n.t('lord_plural')]
62
-
63
- return types if is_mp
64
-
65
- types.reverse
66
- end
67
-
68
- private_class_method
69
-
70
- def self.set_ids
71
- return if @commons_id && @lords_id
72
- houses = Parliament::Utils::Helpers::ParliamentHelper.parliament_request.house_index.get.filter('https://id.parliament.uk/schema/House').sort_by(:name)
73
-
74
- @commons_id = houses.first.graph_id
75
- @lords_id = houses.last.graph_id
5
+ class << self
6
+ # Checks if house is the House of Commons and sets @commons_id and @lords_id if not already set.
7
+ #
8
+ # @param [Grom::Node] house a Grom::Node with type https://id.parliament.uk/schema/House.
9
+ # @return [Boolean] boolean depending on whether the house has the same id as the House of Commons.
10
+ def commons?(house)
11
+ set_ids
12
+
13
+ house.graph_id == @commons_id
14
+ end
15
+
16
+ # Checks if house is the House of Lords and sets @commons_id and @lords_id if not already set.
17
+ #
18
+ # @param [Grom::Node] house a Grom::Node with type https://id.parliament.uk/schema/House.
19
+ # @return [Boolean] boolean depending on whether the house has the same id as the House of Lords.
20
+ def lords?(house)
21
+ !commons?(house)
22
+ end
23
+
24
+ # Sets and returns the id for the House of Commons.
25
+ #
26
+ # @return [String] @commons_id the id for the House of Commons.
27
+ def commons_id
28
+ set_ids
29
+
30
+ @commons_id
31
+ end
32
+
33
+ # Sets and returns the id for the House of Lords.
34
+ #
35
+ # @return [String] @lords_id the id for the House of Lords.
36
+ def lords_id
37
+ set_ids
38
+
39
+ @lords_id
40
+ end
41
+
42
+ # Returns the current house id for the page alongside the other house id.
43
+ #
44
+ # @param [Grom::Node] house The house that a particular person is linked to.
45
+ # @return [Array<String, String>] The current house id and other house id.
46
+ def house_id_string(house)
47
+ is_commons = commons?(house)
48
+
49
+ house_ids = [commons_id, lords_id]
50
+ return house_ids if is_commons
51
+
52
+ house_ids.reverse
53
+ end
54
+
55
+ # Returns the current
56
+ #
57
+ # @param [Grom::Node] house The house that a particular person is linked to.
58
+ # @return [Array<String, String>] The current person type and other person type.
59
+ def person_type_string(house)
60
+ is_mp = commons?(house)
61
+
62
+ types = [I18n.t('mp_plural'), I18n.t('lord_plural')]
63
+
64
+ return types if is_mp
65
+
66
+ types.reverse
67
+ end
68
+
69
+ private_class_method
70
+
71
+ def set_ids
72
+ return if @commons_id && @lords_id
73
+ houses = Parliament::Utils::Helpers::ParliamentHelper.parliament_request.house_index.get.filter('https://id.parliament.uk/schema/House').sort_by(:name)
74
+
75
+ @commons_id = houses.first.graph_id
76
+ @lords_id = houses.last.graph_id
77
+ end
76
78
  end
77
79
  end
78
80
  end
@@ -6,7 +6,6 @@ module Parliament
6
6
  module Utils
7
7
  module Helpers
8
8
  module PostcodeHelper
9
-
10
9
  include Parliament::Utils::Helpers::TranslationHelper
11
10
 
12
11
  attr_accessor :previous_path
@@ -40,7 +40,7 @@ module Parliament
40
40
  #
41
41
  # @return [String] uri with specific path added for filtering parliamentary data within sparql queries
42
42
  def self.namespace_uri_path(path)
43
- self.namespace_uri + path
43
+ namespace_uri + path
44
44
  end
45
45
 
46
46
  # Returns uri with schema path and specific type added for filtering parliamentary data within sparql queries
@@ -49,7 +49,7 @@ module Parliament
49
49
  #
50
50
  # @return [String] uri with schema path and specific type added for filtering parliamentary data within sparql queries
51
51
  def self.namespace_uri_schema_path(type)
52
- self.namespace_uri_path("/schema/#{type}")
52
+ namespace_uri_path("/schema/#{type}")
53
53
  end
54
54
  end
55
55
  end
@@ -3,7 +3,7 @@ module Parliament
3
3
  module Helpers
4
4
  module TranslationHelper
5
5
  require 'i18n'
6
-
6
+
7
7
  I18n.load_path = ['config/locales/en.yml']
8
8
  I18n.backend.load_translations
9
9
  end
@@ -1,3 +1,5 @@
1
+ require 'vcard'
2
+
1
3
  # Namespace for helper methods to generate a vcard.
2
4
  module Parliament
3
5
  module Utils
@@ -10,13 +12,15 @@ module Parliament
10
12
  def create_vcard(contact_point)
11
13
  Vcard::Vcard::Maker.make2 do |maker|
12
14
  maker.add_name do |name|
13
- person_set(contact_point, name)
14
- postal_address_set(contact_point, maker)
15
15
  contacts_set(contact_point, maker)
16
+ postal_address_set(contact_point, maker)
17
+ person_set(contact_point, name)
16
18
  end
17
19
  end
18
20
  end
19
21
 
22
+ private
23
+
20
24
  # Sets the contact details of a vcard.
21
25
  #
22
26
  # @param [Grom::Node] contact_point a Grom::Node with type: https://id.parliament.uk/schema/ContactPoint.
@@ -13,7 +13,7 @@ module Parliament
13
13
  #
14
14
  def autolink(link, link_type)
15
15
  if link_type == :url
16
- return parliament_live_video_embed(link) if link.match(/parliamentlive.tv\/event\/index\/[a-z0-9-]{36}/i)
16
+ return parliament_live_video_embed(link) if link =~ /parliamentlive.tv\/event\/index\/[a-z0-9-]{36}/i
17
17
  end
18
18
 
19
19
  link # call super instead if we actually want autolinking
@@ -5,8 +5,8 @@ module Parliament
5
5
  # Overrides default sanitization allowing Parliament tags and/or attributes
6
6
  def initialize
7
7
  super
8
- self.tags = %w(p div h1 h2 h3 h4 h5 h6 span a ol li ul strong em i itag strike del u sup sub blockquote cite table thead tbody tfoot tr th td iframe image pre code dl dt dd hr br)
9
- self.attributes = %w(class href src name title allowfullscreen seamless frameborder style)
8
+ self.tags = %w[p div h1 h2 h3 h4 h5 h6 span a ol li ul strong em i itag strike del u sup sub blockquote cite table thead tbody tfoot tr th td iframe image pre code dl dt dd hr br]
9
+ self.attributes = %w[class href src name title allowfullscreen seamless frameborder style]
10
10
  end
11
11
 
12
12
  def skip_node?(node)
@@ -6,8 +6,8 @@ module Parliament
6
6
  module TestHelpers
7
7
  module BandieraHelper
8
8
  def self.load_rspec_config(config)
9
- #Stubs Bandiera::Client methods enabled? and get_features_for_group to clean up logs
10
- #and streamline cassettes
9
+ # Stubs Bandiera::Client methods enabled? and get_features_for_group to clean up logs
10
+ # and streamline cassettes
11
11
  config.before(:each) do
12
12
  allow(BANDIERA_CLIENT).to receive(:enabled?).and_return(false)
13
13
  allow(Pugin::PuginBandieraClient::BANDIERA_CLIENT).to receive(:get_features_for_group).and_return({})
@@ -4,33 +4,33 @@ module Parliament
4
4
  module RailsHelper
5
5
  def self.load_rspec_config(config)
6
6
  Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
7
- # # RSpec Rails can automatically mix in different behaviours to your tests
8
- # # based on their file location, for example enabling you to call `get` and
9
- # # `post` in specs under `spec/controllers`.
10
- # #
11
- # # You can disable this behaviour by removing the line below, and instead
12
- # # explicitly tag your specs with their type, e.g.:
13
- # #
14
- # # RSpec.describe UsersController, :type => :controller do
15
- # # # ...
16
- # # end
17
- # #
18
- # # The different available types are documented in the features, such as in
19
- # # https://relishapp.com/rspec/rspec-rails/docs
7
+ # # RSpec Rails can automatically mix in different behaviours to your tests
8
+ # # based on their file location, for example enabling you to call `get` and
9
+ # # `post` in specs under `spec/controllers`.
10
+ # #
11
+ # # You can disable this behaviour by removing the line below, and instead
12
+ # # explicitly tag your specs with their type, e.g.:
13
+ # #
14
+ # # RSpec.describe UsersController, :type => :controller do
15
+ # # # ...
16
+ # # end
17
+ # #
18
+ # # The different available types are documented in the features, such as in
19
+ # # https://relishapp.com/rspec/rspec-rails/docs
20
20
  config.infer_spec_type_from_file_location!
21
- #
22
- # # Filter lines from Rails gems in backtraces.
21
+ #
22
+ # # Filter lines from Rails gems in backtraces.
23
23
  config.filter_rails_from_backtrace!
24
- # # arbitrary gems may also be filtered via:
25
- # # config.filter_gems_from_backtrace("gem name")
24
+ # # arbitrary gems may also be filtered via:
25
+ # # config.filter_gems_from_backtrace("gem name")
26
26
  config.include Parliament::Utils::Helpers::ApplicationHelper
27
- #
28
- # # Set Parliament::Utils::Helpers::HousesHelper#set_ids instance variables to nil after each spec.
29
- # # Calling certain Parliament::Utils::Helpers::HousesHelper methods (e.g. Parliament::Utils::Helpers::HousesHelper#commons?) causes
30
- # # Parliament::Utils::Helpers::HousesHelper#set_ids to be called which sets @commons_id and @lords_id.
31
- # # Setting these to nil causes each spec that requires them to make another
32
- # # Parliament::Utils::Helpers::ParliamentHelper request and generate a VCR cassette and stops any RSpec
33
- # # ordering issues where they may or may not have been set by the previous spec.
27
+ #
28
+ # # Set Parliament::Utils::Helpers::HousesHelper#set_ids instance variables to nil after each spec.
29
+ # # Calling certain Parliament::Utils::Helpers::HousesHelper methods (e.g. Parliament::Utils::Helpers::HousesHelper#commons?) causes
30
+ # # Parliament::Utils::Helpers::HousesHelper#set_ids to be called which sets @commons_id and @lords_id.
31
+ # # Setting these to nil causes each spec that requires them to make another
32
+ # # Parliament::Utils::Helpers::ParliamentHelper request and generate a VCR cassette and stops any RSpec
33
+ # # ordering issues where they may or may not have been set by the previous spec.
34
34
  config.after(:each) do
35
35
  Parliament::Utils::Helpers::HousesHelper.instance_variable_set(:@commons_id, nil)
36
36
  Parliament::Utils::Helpers::HousesHelper.instance_variable_set(:@lords_id, nil)
@@ -2,72 +2,71 @@ module Parliament
2
2
  module Utils
3
3
  module TestHelpers
4
4
  module RSpecHelper
5
-
6
5
  def self.load_rspec_config(config)
7
6
  # RSpec.configure do |config|
8
- # rspec-expectations config goes here. You can use an alternate
9
- # assertion/expectation library such as wrong or the stdlib/minitest
10
- # assertions if you prefer.
11
- config.expect_with :rspec do |expectations|
12
- # This option will default to `true` in RSpec 4. It makes the `description`
13
- # and `failure_message` of custom matchers include text for helper methods
14
- # defined using `chain`, e.g.:
15
- # be_bigger_than(2).and_smaller_than(4).description
16
- # # => "be bigger than 2 and smaller than 4"
17
- # ...rather than:
18
- # # => "be bigger than 2"
19
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
20
- end
7
+ # rspec-expectations config goes here. You can use an alternate
8
+ # assertion/expectation library such as wrong or the stdlib/minitest
9
+ # assertions if you prefer.
10
+ config.expect_with :rspec do |expectations|
11
+ # This option will default to `true` in RSpec 4. It makes the `description`
12
+ # and `failure_message` of custom matchers include text for helper methods
13
+ # defined using `chain`, e.g.:
14
+ # be_bigger_than(2).and_smaller_than(4).description
15
+ # # => "be bigger than 2 and smaller than 4"
16
+ # ...rather than:
17
+ # # => "be bigger than 2"
18
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
19
+ end
21
20
 
22
- # rspec-mocks config goes here. You can use an alternate test double
23
- # library (such as bogus or mocha) by changing the `mock_with` option here.
24
- config.mock_with :rspec do |mocks|
25
- # Prevents you from mocking or stubbing a method that does not exist on
26
- # a real object. This is generally recommended, and will default to
27
- # `true` in RSpec 4.
28
- mocks.verify_partial_doubles = true
29
- end
21
+ # rspec-mocks config goes here. You can use an alternate test double
22
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
23
+ config.mock_with :rspec do |mocks|
24
+ # Prevents you from mocking or stubbing a method that does not exist on
25
+ # a real object. This is generally recommended, and will default to
26
+ # `true` in RSpec 4.
27
+ mocks.verify_partial_doubles = true
28
+ end
30
29
 
31
- # These two settings work together to allow you to limit a spec run
32
- # to individual examples or groups you care about by tagging them with
33
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
34
- # get run.
35
- config.filter_run :focus
36
- config.run_all_when_everything_filtered = true
30
+ # These two settings work together to allow you to limit a spec run
31
+ # to individual examples or groups you care about by tagging them with
32
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
33
+ # get run.
34
+ config.filter_run :focus
35
+ config.run_all_when_everything_filtered = true
37
36
 
38
- # Disable RSpec exposing methods globally on `Module` and `main`
39
- config.disable_monkey_patching!
37
+ # Disable RSpec exposing methods globally on `Module` and `main`
38
+ config.disable_monkey_patching!
40
39
 
41
- # Many RSpec users commonly either run the entire suite or an individual
42
- # file, and it's useful to allow more verbose output when running an
43
- # individual spec file.
44
- if config.files_to_run.one?
45
- # Use the documentation formatter for detailed output,
46
- # unless a formatter has already been configured
47
- # (e.g. via a command-line flag).
48
- config.default_formatter = 'doc'
49
- end
40
+ # Many RSpec users commonly either run the entire suite or an individual
41
+ # file, and it's useful to allow more verbose output when running an
42
+ # individual spec file.
43
+ if config.files_to_run.one?
44
+ # Use the documentation formatter for detailed output,
45
+ # unless a formatter has already been configured
46
+ # (e.g. via a command-line flag).
47
+ config.default_formatter = 'doc'
48
+ end
50
49
 
51
- # Print the 10 slowest examples and example groups at the
52
- # end of the spec run, to help surface which specs are running
53
- # particularly slow.
54
- config.profile_examples = 10
50
+ # Print the 10 slowest examples and example groups at the
51
+ # end of the spec run, to help surface which specs are running
52
+ # particularly slow.
53
+ config.profile_examples = 10
55
54
 
56
- config.expect_with :rspec do |c|
57
- c.syntax = :expect
58
- end
55
+ config.expect_with :rspec do |c|
56
+ c.syntax = :expect
57
+ end
59
58
 
60
- # Run specs in random order to surface order dependencies. If you find an
61
- # order dependency and want to debug it, you can fix the order by providing
62
- # the seed, which is printed after each run.
63
- # --seed 1234
64
- config.order = :random
59
+ # Run specs in random order to surface order dependencies. If you find an
60
+ # order dependency and want to debug it, you can fix the order by providing
61
+ # the seed, which is printed after each run.
62
+ # --seed 1234
63
+ config.order = :random
65
64
 
66
- # Seed global randomization in this process using the `--seed` CLI option.
67
- # Setting this allows you to use `--seed` to deterministically reproduce
68
- # test failures related to randomization by passing the same `--seed` value
69
- # as the one that triggered the failure.
70
- Kernel.srand config.seed
65
+ # Seed global randomization in this process using the `--seed` CLI option.
66
+ # Setting this allows you to use `--seed` to deterministically reproduce
67
+ # test failures related to randomization by passing the same `--seed` value
68
+ # as the one that triggered the failure.
69
+ Kernel.srand config.seed
71
70
  # end
72
71
  end
73
72
  end
@@ -5,13 +5,17 @@ module Parliament
5
5
  require 'coveralls'
6
6
  require 'simplecov'
7
7
 
8
- def self.load_rspec_config(config)
8
+ def self.load_rspec_config(_config)
9
9
  SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
10
- Coveralls::SimpleCov::Formatter,
11
- SimpleCov::Formatter::HTMLFormatter
12
- ])
10
+ Coveralls::SimpleCov::Formatter,
11
+ SimpleCov::Formatter::HTMLFormatter
12
+ ])
13
+
13
14
  profile = defined?(Rails) ? 'rails' : nil
14
- SimpleCov.start profile
15
+
16
+ SimpleCov.start profile do
17
+ add_filter 'spec'
18
+ end
15
19
  end
16
20
  end
17
21
  end
@@ -41,7 +41,7 @@ module Parliament
41
41
  parliament_match || bandiera_match || opensearch_match || hybrid_bills_match
42
42
  end
43
43
 
44
- config.default_cassette_options = { match_requests_on: [:method, :filtered_uri] }
44
+ config.default_cassette_options = { match_requests_on: %i[method filtered_uri] }
45
45
 
46
46
  # Dynamically filter our sensitive information
47
47
  config.filter_sensitive_data('<AUTH_TOKEN>') { ENV['PARLIAMENT_AUTH_TOKEN'] } if ENV['PARLIAMENT_AUTH_TOKEN']
@@ -55,7 +55,7 @@ module Parliament
55
55
  should_ignore = ['_:node', '^^<http://www.w3.org/2001/XMLSchema#date>', '^^<http://www.w3.org/2001/XMLSchema#dateTime>', '^^<http://www.w3.org/2001/XMLSchema#integer>']
56
56
 
57
57
  # Check if content type header exists and if it includes application/n-triples
58
- if interaction.response.headers['Content-Type'] && interaction.response.headers['Content-Type'].include?('application/n-triples')
58
+ if interaction.response.headers['Content-Type']&.include?('application/n-triples')
59
59
  # Split our data by line
60
60
  lines = interaction.response.body.split("\n")
61
61
 
@@ -2,7 +2,7 @@ module Parliament
2
2
  module Utils
3
3
  module TestHelpers
4
4
  module WebmockHelper
5
- def self.load_rspec_config(config)
5
+ def self.load_rspec_config(_config)
6
6
  require 'webmock/rspec'
7
7
 
8
8
  WebMock.disable_net_connect!(allow_localhost: true)
@@ -1,5 +1,5 @@
1
1
  module Parliament
2
2
  module Utils
3
- VERSION = '0.8.4'.freeze
3
+ VERSION = '0.8.5'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parliament-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rebecca Appleyard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-21 00:00:00.000000000 Z
11
+ date: 2018-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parliament-ruby
@@ -297,7 +297,6 @@ executables: []
297
297
  extensions: []
298
298
  extra_rdoc_files: []
299
299
  files:
300
- - ".DS_Store"
301
300
  - ".gitignore"
302
301
  - ".hound.yml"
303
302
  - ".rspec"
data/.DS_Store DELETED
Binary file