decidim-dev 0.28.2 → 0.28.3

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
  SHA256:
3
- metadata.gz: bc9d821614ad42d1eb20f682ab82321b933753c5b4d951fea170751b8f6a5bcf
4
- data.tar.gz: e256ccb91d7c4ffc96a7722dcd4cb047bfd76724a1199d86ed04527fe0c8829b
3
+ metadata.gz: d6b9973be99a2087203195bd53e2d70c217f03e931d9dd65b41131175847f279
4
+ data.tar.gz: a11250967979f905fc8f477dddae1dcef632895fc3259657dd18b0ccc40883f4
5
5
  SHA512:
6
- metadata.gz: ccaee176486a56c7b99979f06c2debc99e93b44ada6f251db4a6e57684a065858e46eb32884ff9c9696f225f5d243fd5fdfe8cf8eff2ab8ce84df59277a39e3a
7
- data.tar.gz: b74b0ee53ae4c5b2db19932c575793fecf546458c51bc0bd62dc3692646c621e04786de35f0a540a166c7ad9ca91869e8c160b58c82ad3d67fe6bc3d4d21fdea
6
+ metadata.gz: 1a845fc6a1a4228598a8b2c1f4f0b83e269075ad3433ebb9596c17c866650dccf9ddec58f233d3a8e2cdc0ee8232e583206370897c2b585a4b76d8896c2901e9
7
+ data.tar.gz: 75b487e53ab3b1b30918dc3adae0e3039d280c53963863145fbcdc49a3dc0c345948735cd4e1e9239dc4b2f5c09b3d8a4b8cbe09a775d436ff9980adaefb2a07
@@ -4,7 +4,7 @@ sv:
4
4
  attributes:
5
5
  dummy_resource:
6
6
  created_at: Skapad
7
- decidim_scope_id: Omfattning
7
+ decidim_scope_id: Indelning
8
8
  field: Mitt fält
9
9
  start_date: Startdatum
10
10
  title: Titel
data/decidim-dev.gemspec CHANGED
@@ -58,6 +58,8 @@ Gem::Specification.new do |s|
58
58
  s.add_dependency "selenium-webdriver", "~> 4.9"
59
59
  s.add_dependency "simplecov", "~> 0.22.0"
60
60
  s.add_dependency "simplecov-cobertura", "~> 2.1.0"
61
+ s.add_dependency "spring", "~> 2.0"
62
+ s.add_dependency "spring-watcher-listen", "~> 2.0"
61
63
  s.add_dependency "w3c_rspec_validators", "~> 0.3.0"
62
64
  s.add_dependency "webmock", "~> 3.18"
63
65
  s.add_dependency "wisper-rspec", "~> 1.0"
@@ -0,0 +1,148 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveStorageMatchers
4
+ def be_blob_url(expected)
5
+ BeBlobUrl.new(expected)
6
+ end
7
+
8
+ def include_blob_urls(*expected)
9
+ IncludeBlobUrls.new(expected)
10
+ end
11
+
12
+ class BlobMatch
13
+ BLOB_URL_MATCHERS = {
14
+ redirect: %r{/rails/active_storage/blobs/redirect/([^/]+)/([^/]+)$},
15
+ representation: %r{/rails/active_storage/representations/redirect/([^/]+)/([^/]+)/([^/]+)$},
16
+ disk: %r{/rails/active_storage/disk/([^/]+)/([^/]+)$}
17
+ }.freeze
18
+
19
+ def initialize(url)
20
+ @url = url
21
+ end
22
+
23
+ def blob
24
+ return unless key_match
25
+
26
+ @blob ||=
27
+ case url_type
28
+ when :redirect, :representation
29
+ ActiveStorage::Blob.find_signed(key_match)
30
+ when :disk
31
+ decoded = ActiveStorage.verifier.verified(key_match, purpose: :blob_key)
32
+ ActiveStorage::Blob.find_by(key: decoded[:key]) if decoded
33
+ end
34
+ end
35
+
36
+ def variation
37
+ return unless variation_match
38
+
39
+ blob.representation(variation_match)
40
+ end
41
+
42
+ def key_match
43
+ return unless match
44
+
45
+ match[1]
46
+ end
47
+
48
+ def variation_match
49
+ return unless match
50
+
51
+ match[2] if url_type == :representation
52
+ end
53
+
54
+ def filename_match
55
+ return unless match
56
+
57
+ case url_type
58
+ when :representation
59
+ match[3]
60
+ else
61
+ match[2]
62
+ end
63
+ end
64
+
65
+ private
66
+
67
+ attr_reader :url, :url_type
68
+
69
+ def match
70
+ return @match if @url_type
71
+
72
+ @url_type = :none
73
+ @match = nil
74
+ BLOB_URL_MATCHERS.each do |type, matcher|
75
+ @match = url.match(matcher)
76
+ if @match
77
+ @url_type = type
78
+ break
79
+ end
80
+ end
81
+
82
+ @match
83
+ end
84
+ end
85
+
86
+ class BeBlobUrl
87
+ def initialize(expected)
88
+ @expected = expected
89
+ end
90
+
91
+ def description
92
+ "be a blob URL"
93
+ end
94
+
95
+ def matches?(actual)
96
+ @actual = actual
97
+ match = BlobMatch.new(actual)
98
+ match.blob == expected
99
+ end
100
+
101
+ def failure_message
102
+ "expected #{actual} to match blob with ID #{expected.id}"
103
+ end
104
+
105
+ def failure_message_when_negated
106
+ "expected #{actual} not to match blob with ID #{expected.id}"
107
+ end
108
+
109
+ private
110
+
111
+ attr_reader :expected, :actual
112
+ end
113
+
114
+ class IncludeBlobUrls
115
+ def initialize(expected)
116
+ @expected = expected
117
+ end
118
+
119
+ def description
120
+ "include blob URLs"
121
+ end
122
+
123
+ def matches?(actual)
124
+ @actual = actual
125
+
126
+ actual.all? do |url|
127
+ match = BlobMatch.new(url)
128
+ expected.include?(match.blob)
129
+ end
130
+ end
131
+
132
+ def failure_message
133
+ "expected #{actual.inspect} to match blobs with ID #{expected.map(&:id).join(", ")}"
134
+ end
135
+
136
+ def failure_message_when_negated
137
+ "expected #{actual.inspect} not to match blobs with ID #{expected.map(&:id).join(", ")}"
138
+ end
139
+
140
+ private
141
+
142
+ attr_reader :expected, :actual
143
+ end
144
+ end
145
+
146
+ RSpec.configure do |config|
147
+ config.include ActiveStorageMatchers
148
+ end
@@ -44,6 +44,7 @@ Capybara.register_driver :headless_chrome do |app|
44
44
  options = Selenium::WebDriver::Chrome::Options.new
45
45
  options.args << "--explicitly-allowed-ports=#{Capybara.server_port}"
46
46
  options.args << "--headless=new"
47
+ options.args << "--disable-search-engine-choice-screen" # Prevents closing the window normally
47
48
  # Do not limit browser resources
48
49
  options.args << "--disable-dev-shm-usage"
49
50
  options.args << "--no-sandbox"
@@ -44,4 +44,11 @@ RSpec.configure do |config|
44
44
  "img-src": %w(https://via.placeholder.com)
45
45
  }
46
46
  end
47
+
48
+ config.before do
49
+ # Ensure that the current host is not set for any spec in order to test that
50
+ # the automatic current host definition is working correctly in all
51
+ # situations.
52
+ ActiveStorage::Current.host = ""
53
+ end
47
54
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-dev version.
5
5
  module Dev
6
6
  def self.version
7
- "0.28.2"
7
+ "0.28.3"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-dev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.2
4
+ version: 0.28.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-07-16 00:00:00.000000000 Z
13
+ date: 2024-09-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: capybara
@@ -32,14 +32,14 @@ dependencies:
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.28.2
35
+ version: 0.28.3
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.28.2
42
+ version: 0.28.3
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: factory_bot_rails
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -374,6 +374,34 @@ dependencies:
374
374
  - - "~>"
375
375
  - !ruby/object:Gem::Version
376
376
  version: 2.1.0
377
+ - !ruby/object:Gem::Dependency
378
+ name: spring
379
+ requirement: !ruby/object:Gem::Requirement
380
+ requirements:
381
+ - - "~>"
382
+ - !ruby/object:Gem::Version
383
+ version: '2.0'
384
+ type: :runtime
385
+ prerelease: false
386
+ version_requirements: !ruby/object:Gem::Requirement
387
+ requirements:
388
+ - - "~>"
389
+ - !ruby/object:Gem::Version
390
+ version: '2.0'
391
+ - !ruby/object:Gem::Dependency
392
+ name: spring-watcher-listen
393
+ requirement: !ruby/object:Gem::Requirement
394
+ requirements:
395
+ - - "~>"
396
+ - !ruby/object:Gem::Version
397
+ version: '2.0'
398
+ type: :runtime
399
+ prerelease: false
400
+ version_requirements: !ruby/object:Gem::Requirement
401
+ requirements:
402
+ - - "~>"
403
+ - !ruby/object:Gem::Version
404
+ version: '2.0'
377
405
  - !ruby/object:Gem::Dependency
378
406
  name: w3c_rspec_validators
379
407
  requirement: !ruby/object:Gem::Requirement
@@ -607,6 +635,7 @@ files:
607
635
  - lib/decidim/dev/test/rspec_support/accessibility_examples.rb
608
636
  - lib/decidim/dev/test/rspec_support/action_mailer.rb
609
637
  - lib/decidim/dev/test/rspec_support/active_job.rb
638
+ - lib/decidim/dev/test/rspec_support/activestorage_matchers.rb
610
639
  - lib/decidim/dev/test/rspec_support/attachment_helpers.rb
611
640
  - lib/decidim/dev/test/rspec_support/authorization.rb
612
641
  - lib/decidim/dev/test/rspec_support/autocomplete_select.rb