decidim-dev 0.29.0.rc3 → 0.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/locales/sv.yml +1 -1
- data/decidim-dev.gemspec +2 -0
- data/lib/decidim/dev/test/rspec_support/activestorage_matchers.rb +148 -0
- data/lib/decidim/dev/test/rspec_support/capybara.rb +1 -0
- data/lib/decidim/dev/test/spec_helper.rb +7 -0
- data/lib/decidim/dev/version.rb +1 -1
- metadata +35 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 480ef934e54b5fc844be08f117d10c6c02e99124528ff6869443d4e4d5715865
|
4
|
+
data.tar.gz: 11ca66bdc38faae3b4f3772e3d7a1b0f2fe585617993b919d10f207a0424954d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4033172626237fd53bcb0c8ea786e9f3f45daa64dfd6d894ebbbdbb5aec1ab74a8d9e0a2e24fa60f327c2b5a3118f4f8035dbc800c600614e89ad299eee3aebb
|
7
|
+
data.tar.gz: 0a2b89008c229215fececbe2f60d4a3ef7a8753ce20b95bcc5e8e18b232d3d288c398026d36d39f03f019893f4c259d574669b976c6641696abdb7442f712128
|
data/config/locales/sv.yml
CHANGED
data/decidim-dev.gemspec
CHANGED
@@ -63,6 +63,8 @@ Gem::Specification.new do |s|
|
|
63
63
|
s.add_dependency "selenium-webdriver", "~> 4.9"
|
64
64
|
s.add_dependency "simplecov", "~> 0.22.0"
|
65
65
|
s.add_dependency "simplecov-cobertura", "~> 2.1.0"
|
66
|
+
s.add_dependency "spring", "~> 4.0"
|
67
|
+
s.add_dependency "spring-watcher-listen", "~> 2.0"
|
66
68
|
s.add_dependency "w3c_rspec_validators", "~> 0.3.0"
|
67
69
|
s.add_dependency "webmock", "~> 3.18"
|
68
70
|
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
|
@@ -56,6 +56,7 @@ Capybara.register_driver :headless_chrome do |app|
|
|
56
56
|
options = Selenium::WebDriver::Chrome::Options.new
|
57
57
|
options.args << "--explicitly-allowed-ports=#{Capybara.server_port}"
|
58
58
|
options.args << "--headless=new"
|
59
|
+
options.args << "--disable-search-engine-choice-screen" # Prevents closing the window normally
|
59
60
|
# Do not limit browser resources
|
60
61
|
options.args << "--disable-dev-shm-usage"
|
61
62
|
options.args << "--no-sandbox"
|
@@ -45,4 +45,11 @@ RSpec.configure do |config|
|
|
45
45
|
"connect-src": %W(#{Decidim::Dev::Test::MapServer.host})
|
46
46
|
}
|
47
47
|
end
|
48
|
+
|
49
|
+
config.before do
|
50
|
+
# Ensure that the current host is not set for any spec in order to test that
|
51
|
+
# the automatic current host definition is working correctly in all
|
52
|
+
# situations.
|
53
|
+
ActiveStorage::Current.url_options = {}
|
54
|
+
end
|
48
55
|
end
|
data/lib/decidim/dev/version.rb
CHANGED
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.29.0
|
4
|
+
version: 0.29.0
|
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-
|
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.29.0
|
35
|
+
version: 0.29.0
|
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.29.0
|
42
|
+
version: 0.29.0
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: factory_bot_rails
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -444,6 +444,34 @@ dependencies:
|
|
444
444
|
- - "~>"
|
445
445
|
- !ruby/object:Gem::Version
|
446
446
|
version: 2.1.0
|
447
|
+
- !ruby/object:Gem::Dependency
|
448
|
+
name: spring
|
449
|
+
requirement: !ruby/object:Gem::Requirement
|
450
|
+
requirements:
|
451
|
+
- - "~>"
|
452
|
+
- !ruby/object:Gem::Version
|
453
|
+
version: '4.0'
|
454
|
+
type: :runtime
|
455
|
+
prerelease: false
|
456
|
+
version_requirements: !ruby/object:Gem::Requirement
|
457
|
+
requirements:
|
458
|
+
- - "~>"
|
459
|
+
- !ruby/object:Gem::Version
|
460
|
+
version: '4.0'
|
461
|
+
- !ruby/object:Gem::Dependency
|
462
|
+
name: spring-watcher-listen
|
463
|
+
requirement: !ruby/object:Gem::Requirement
|
464
|
+
requirements:
|
465
|
+
- - "~>"
|
466
|
+
- !ruby/object:Gem::Version
|
467
|
+
version: '2.0'
|
468
|
+
type: :runtime
|
469
|
+
prerelease: false
|
470
|
+
version_requirements: !ruby/object:Gem::Requirement
|
471
|
+
requirements:
|
472
|
+
- - "~>"
|
473
|
+
- !ruby/object:Gem::Version
|
474
|
+
version: '2.0'
|
447
475
|
- !ruby/object:Gem::Dependency
|
448
476
|
name: w3c_rspec_validators
|
449
477
|
requirement: !ruby/object:Gem::Requirement
|
@@ -681,6 +709,7 @@ files:
|
|
681
709
|
- lib/decidim/dev/test/rspec_support/accessibility_examples.rb
|
682
710
|
- lib/decidim/dev/test/rspec_support/action_mailer.rb
|
683
711
|
- lib/decidim/dev/test/rspec_support/active_job.rb
|
712
|
+
- lib/decidim/dev/test/rspec_support/activestorage_matchers.rb
|
684
713
|
- lib/decidim/dev/test/rspec_support/attachment_helpers.rb
|
685
714
|
- lib/decidim/dev/test/rspec_support/authorization.rb
|
686
715
|
- lib/decidim/dev/test/rspec_support/autocomplete_select.rb
|
@@ -756,9 +785,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
756
785
|
version: 3.2.0
|
757
786
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
758
787
|
requirements:
|
759
|
-
- - "
|
788
|
+
- - ">="
|
760
789
|
- !ruby/object:Gem::Version
|
761
|
-
version:
|
790
|
+
version: '0'
|
762
791
|
requirements: []
|
763
792
|
rubygems_version: 3.4.10
|
764
793
|
signing_key:
|