decidim-dev 0.28.2 → 0.28.4
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 +3 -3
- data/decidim-dev.gemspec +2 -0
- data/lib/decidim/dev/assets/invalid_extension.log +1 -0
- data/lib/decidim/dev/assets/odt_file_reported_as.pdf +0 -0
- data/lib/decidim/dev/auth_engine.rb +33 -0
- data/lib/decidim/dev/test/rspec_support/activestorage_matchers.rb +148 -0
- data/lib/decidim/dev/test/rspec_support/attachment_helpers.rb +1 -3
- data/lib/decidim/dev/test/rspec_support/capybara.rb +1 -0
- data/lib/decidim/dev/test/rspec_support/warden.rb +1 -0
- data/lib/decidim/dev/test/spec_helper.rb +7 -0
- data/lib/decidim/dev/version.rb +1 -1
- data/lib/decidim/dev.rb +1 -0
- metadata +37 -5
- /data/{app/controllers/concerns → lib}/decidim/dev/needs_development_tools.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 709de1e0a80758a653fbea7fe04973aa8d743b96fa30627176ab75ff1cd374e3
|
4
|
+
data.tar.gz: ab6b6c96839e40dc7b3719634dfca59be20c9988fb3ccfb4610fb52861e3a8d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 504edd0ddea96311c2eee40a71d677eeaae369f27350e7c6ae0c37765c778348f04dc51325cfd58476a27fd52c5525fd9f5a5893d6bf91c70a85f357e40fd177
|
7
|
+
data.tar.gz: 3160e3c14ea1dfec2dd8f8d2c0c75e4378728bb94a888963abbdb67a79a1c1f7da16ce90d052454371bb653cf7ac73ff227647e956c69ad615f45196c75810e5
|
data/config/locales/sv.yml
CHANGED
@@ -4,7 +4,7 @@ sv:
|
|
4
4
|
attributes:
|
5
5
|
dummy_resource:
|
6
6
|
created_at: Skapad
|
7
|
-
decidim_scope_id:
|
7
|
+
decidim_scope_id: Indelning
|
8
8
|
field: Mitt fält
|
9
9
|
start_date: Startdatum
|
10
10
|
title: Titel
|
@@ -28,8 +28,8 @@ sv:
|
|
28
28
|
baz: Baz
|
29
29
|
foo: Foo
|
30
30
|
step:
|
31
|
-
endorsements_blocked:
|
32
|
-
endorsements_enabled:
|
31
|
+
endorsements_blocked: Blockera gilla-markeringar
|
32
|
+
endorsements_enabled: Aktivera gilla-markeringar
|
33
33
|
readonly_step_attribute: Skrivskyddade steg attribut
|
34
34
|
test_options:
|
35
35
|
bar: Bar
|
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 @@
|
|
1
|
+
FooBar
|
Binary file
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "decidim/dev/needs_development_tools"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module Dev
|
7
|
+
# Example engine overriding the core authentication routes.
|
8
|
+
class AuthEngine < ::Rails::Engine
|
9
|
+
isolate_namespace Decidim::Dev
|
10
|
+
engine_name "decidim_dev_auth"
|
11
|
+
|
12
|
+
routes do
|
13
|
+
devise_scope :user do
|
14
|
+
match(
|
15
|
+
"/users/auth/test/callback",
|
16
|
+
to: "omniauth_callbacks#dev_callback",
|
17
|
+
as: "user_test_omniauth_authorize",
|
18
|
+
via: [:get, :post]
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
initializer "decidim_dev_auth.mount_test_routes", before: :add_routing_paths do
|
24
|
+
next unless Rails.env.test?
|
25
|
+
|
26
|
+
# Required for overriding the callback route.
|
27
|
+
Decidim::Core::Engine.routes.prepend do
|
28
|
+
mount Decidim::Dev::AuthEngine => "/"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -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
|
@@ -14,12 +14,10 @@ module AttachmentHelpers
|
|
14
14
|
# Used in non-system tests that need files.
|
15
15
|
def upload_test_file(file, options = {})
|
16
16
|
filename = options[:filename] || upload_test_file_filename(file)
|
17
|
-
content_type = options[:content_type] || upload_test_file_content_type(file)
|
18
17
|
|
19
18
|
blob = ActiveStorage::Blob.create_and_upload!(
|
20
19
|
io: File.open(file),
|
21
|
-
filename
|
22
|
-
content_type:
|
20
|
+
filename:
|
23
21
|
)
|
24
22
|
return blob if options[:return_blob]
|
25
23
|
|
@@ -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
|
data/lib/decidim/dev/version.rb
CHANGED
data/lib/decidim/dev.rb
CHANGED
@@ -5,6 +5,7 @@ require "decidim/dev/railtie"
|
|
5
5
|
require "decidim/dev/admin"
|
6
6
|
require "decidim/dev/engine"
|
7
7
|
require "decidim/dev/admin_engine"
|
8
|
+
require "decidim/dev/auth_engine"
|
8
9
|
# We shall not load the component here, as it will complain there is no method register_component
|
9
10
|
# for Decidim module. To fix that we need to require 'decidim/core', which will cause a major
|
10
11
|
# performance setback, as this file is usually the first request in "spec_helpers".
|
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.
|
4
|
+
version: 0.28.4
|
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-10-02 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.
|
35
|
+
version: 0.28.4
|
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.
|
42
|
+
version: 0.28.4
|
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
|
@@ -428,7 +456,6 @@ files:
|
|
428
456
|
- README.md
|
429
457
|
- Rakefile
|
430
458
|
- app/commands/decidim/dev/create_dummy_resource.rb
|
431
|
-
- app/controllers/concerns/decidim/dev/needs_development_tools.rb
|
432
459
|
- app/controllers/decidim/dev/dummy_resources_controller.rb
|
433
460
|
- app/events/decidim/dev/dummy_resource_event.rb
|
434
461
|
- app/forms/decidim/dev/dummy_resource_form.rb
|
@@ -576,9 +603,11 @@ files:
|
|
576
603
|
- lib/decidim/dev/assets/import_voting_census_with_ballot_styles.csv
|
577
604
|
- lib/decidim/dev/assets/import_voting_census_without_headers.csv
|
578
605
|
- lib/decidim/dev/assets/invalid.jpeg
|
606
|
+
- lib/decidim/dev/assets/invalid_extension.log
|
579
607
|
- lib/decidim/dev/assets/iso-8859-15.md
|
580
608
|
- lib/decidim/dev/assets/logo.png
|
581
609
|
- lib/decidim/dev/assets/malicious.jpg
|
610
|
+
- lib/decidim/dev/assets/odt_file_reported_as.pdf
|
582
611
|
- lib/decidim/dev/assets/participatory_processes.json
|
583
612
|
- lib/decidim/dev/assets/participatory_processes_with_null.json
|
584
613
|
- lib/decidim/dev/assets/participatory_text.md
|
@@ -594,10 +623,12 @@ files:
|
|
594
623
|
- lib/decidim/dev/assets/ssl-key.pem
|
595
624
|
- lib/decidim/dev/assets/test_excel.xlsx
|
596
625
|
- lib/decidim/dev/assets/verify_user_groups.csv
|
626
|
+
- lib/decidim/dev/auth_engine.rb
|
597
627
|
- lib/decidim/dev/common_rake.rb
|
598
628
|
- lib/decidim/dev/component.rb
|
599
629
|
- lib/decidim/dev/dummy_translator.rb
|
600
630
|
- lib/decidim/dev/engine.rb
|
631
|
+
- lib/decidim/dev/needs_development_tools.rb
|
601
632
|
- lib/decidim/dev/railtie.rb
|
602
633
|
- lib/decidim/dev/test/authorization_shared_examples.rb
|
603
634
|
- lib/decidim/dev/test/base_spec_helper.rb
|
@@ -607,6 +638,7 @@ files:
|
|
607
638
|
- lib/decidim/dev/test/rspec_support/accessibility_examples.rb
|
608
639
|
- lib/decidim/dev/test/rspec_support/action_mailer.rb
|
609
640
|
- lib/decidim/dev/test/rspec_support/active_job.rb
|
641
|
+
- lib/decidim/dev/test/rspec_support/activestorage_matchers.rb
|
610
642
|
- lib/decidim/dev/test/rspec_support/attachment_helpers.rb
|
611
643
|
- lib/decidim/dev/test/rspec_support/authorization.rb
|
612
644
|
- lib/decidim/dev/test/rspec_support/autocomplete_select.rb
|
File without changes
|