decidim-dev 0.30.2 → 0.31.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/decidim/dev/dummy_resource.rb +2 -6
- data/app/packs/entrypoints/decidim_dev.scss +1 -1
- data/app/packs/src/decidim/dev/accessibility.js +2 -2
- data/app/packs/stylesheets/decidim/dev.scss +4 -4
- data/app/presenters/decidim/dev/dummy_resource_presenter.rb +2 -2
- data/config/assets.rb +2 -2
- data/config/locales/ar.yml +0 -2
- data/config/locales/bg.yml +0 -2
- data/config/locales/bs-BA.yml +0 -8
- data/config/locales/ca-IT.yml +2 -2
- data/config/locales/ca.yml +2 -2
- data/config/locales/cs.yml +2 -2
- data/config/locales/de.yml +2 -2
- data/config/locales/el.yml +0 -2
- data/config/locales/en.yml +2 -2
- data/config/locales/es-MX.yml +2 -2
- data/config/locales/es-PY.yml +2 -2
- data/config/locales/es.yml +2 -2
- data/config/locales/eu.yml +4 -4
- data/config/locales/fi-plain.yml +2 -2
- data/config/locales/fi.yml +2 -2
- data/config/locales/fr-CA.yml +0 -2
- data/config/locales/fr.yml +0 -2
- data/config/locales/gl.yml +0 -2
- data/config/locales/hu.yml +0 -2
- data/config/locales/it.yml +0 -2
- data/config/locales/ja.yml +2 -2
- data/config/locales/lt.yml +0 -2
- data/config/locales/lv.yml +0 -2
- data/config/locales/nl.yml +0 -2
- data/config/locales/no.yml +0 -2
- data/config/locales/pl.yml +0 -2
- data/config/locales/pt-BR.yml +0 -2
- data/config/locales/pt.yml +0 -2
- data/config/locales/ro-RO.yml +0 -2
- data/config/locales/sk.yml +0 -2
- data/config/locales/sr-CS.yml +0 -8
- data/config/locales/sv.yml +2 -2
- data/config/locales/tr-TR.yml +0 -2
- data/config/locales/zh-CN.yml +0 -2
- data/config/locales/zh-TW.yml +0 -2
- data/config/rubocop/capybara/configuration.yml +1 -0
- data/config/rubocop/capybara/disabled.yml +7 -0
- data/config/rubocop/disabled.yml +1 -41
- data/config/rubocop/factory_bot/configuration.yml +1 -0
- data/config/rubocop/factory_bot/disabled.yml +10 -0
- data/config/rubocop/{faker.yml → faker/configuration.yml} +1 -1
- data/config/rubocop/faker/disabled.yml +3 -0
- data/config/rubocop/{graphql.yml → graphql/configuration.yml} +2 -1
- data/config/rubocop/graphql/disabled.yml +4 -0
- data/config/rubocop/performance/configuration.yml +1 -0
- data/config/rubocop/{performance.yml → performance/disabled.yml} +1 -1
- data/config/rubocop/{rails.yml → rails/configuration.yml} +1 -24
- data/config/rubocop/rails/disabled.yml +46 -0
- data/config/rubocop/{rspec.yml → rspec/configuration.yml} +2 -29
- data/config/rubocop/rspec/disabled.yml +49 -0
- data/config/rubocop/{ruby.yml → ruby/configuration.yml} +3 -38
- data/config/rubocop/ruby/disabled.yml +106 -0
- data/decidim-dev.gemspec +10 -10
- data/lib/decidim/dev/assets/assemblies.json +6 -11
- data/lib/decidim/dev/assets/assemblies_with_null.json +0 -1
- data/lib/decidim/dev/assets/census_all_invalid.csv +4 -0
- data/lib/decidim/dev/assets/census_duplicate_emails.csv +4 -0
- data/lib/decidim/dev/assets/census_no_header.csv +2 -0
- data/lib/decidim/dev/assets/census_with_missing_email.csv +3 -0
- data/lib/decidim/dev/assets/census_with_missing_token.csv +3 -0
- data/lib/decidim/dev/assets/empty_file.csv +0 -0
- data/lib/decidim/dev/assets/participatory_processes.json +0 -1
- data/lib/decidim/dev/assets/participatory_processes_with_null.json +0 -1
- data/lib/decidim/dev/assets/valid_election_census.csv +3 -0
- data/lib/decidim/dev/assets/valid_emails.csv +27 -0
- data/lib/decidim/dev/common_rake.rb +0 -1
- data/lib/decidim/dev/component.rb +2 -2
- data/lib/decidim/dev/engine.rb +1 -1
- data/lib/decidim/dev/test/base_spec_helper.rb +9 -0
- data/lib/decidim/dev/test/factories.rb +5 -12
- data/lib/decidim/dev/test/rspec_support/active_job.rb +12 -0
- data/lib/decidim/dev/test/rspec_support/activestorage_matchers.rb +1 -1
- data/lib/decidim/dev/test/rspec_support/capybara.rb +11 -18
- data/lib/decidim/dev/test/rspec_support/comments.rb +1 -1
- data/lib/decidim/dev/test/rspec_support/component.rb +2 -2
- data/lib/decidim/dev/test/rspec_support/editor_context.rb +1 -13
- data/lib/decidim/dev/test/rspec_support/gamification.rb +1 -1
- data/lib/decidim/dev/test/rspec_support/helpers.rb +16 -0
- data/lib/decidim/dev/test/rspec_support/rake_tasks.rb +0 -16
- data/lib/decidim/dev/test/rspec_support/screenshot_helper.rb +2 -2
- data/lib/decidim/dev/test/rspec_support/{webpacker.rb → shakapacker.rb} +2 -2
- data/lib/decidim/dev/test/spec_helper.rb +1 -1
- data/lib/decidim/dev/version.rb +1 -1
- data/rubocop-decidim.yml +17 -9
- metadata +91 -37
@@ -15,8 +15,6 @@ FactoryBot.define do
|
|
15
15
|
transient do
|
16
16
|
skip_injection { false }
|
17
17
|
users { nil }
|
18
|
-
# user_groups correspondence to users is by sorting order
|
19
|
-
user_groups { [] }
|
20
18
|
end
|
21
19
|
title { generate_localized_title(:dummy_resource_title, skip_injection:) }
|
22
20
|
component { create(:dummy_component, skip_injection:) }
|
@@ -27,11 +25,11 @@ FactoryBot.define do
|
|
27
25
|
published_at { Time.current }
|
28
26
|
end
|
29
27
|
|
30
|
-
trait :
|
28
|
+
trait :with_likes do
|
31
29
|
after :create do |resource, evaluator|
|
32
30
|
5.times.collect do
|
33
|
-
create(:
|
34
|
-
|
31
|
+
create(:like, resource:, skip_injection: evaluator.skip_injection,
|
32
|
+
author: build(:user, organization: resource.component.organization, skip_injection: evaluator.skip_injection))
|
35
33
|
end
|
36
34
|
end
|
37
35
|
end
|
@@ -61,13 +59,8 @@ FactoryBot.define do
|
|
61
59
|
|
62
60
|
after :build do |resource, evaluator|
|
63
61
|
evaluator.authors_list.each do |coauthor|
|
64
|
-
resource.coauthorships <<
|
65
|
-
|
66
|
-
organization: evaluator.component.organization, skip_injection: evaluator.skip_injection)
|
67
|
-
else
|
68
|
-
build(:coauthorship, author: coauthor, coauthorable: resource, organization: evaluator.component.organization,
|
69
|
-
skip_injection: evaluator.skip_injection)
|
70
|
-
end
|
62
|
+
resource.coauthorships << build(:coauthorship, author: coauthor, coauthorable: resource, organization: evaluator.component.organization,
|
63
|
+
skip_injection: evaluator.skip_injection)
|
71
64
|
end
|
72
65
|
end
|
73
66
|
end
|
@@ -1,7 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
module DecidimActiveJobExtensions
|
4
|
+
def wait_enqueued_jobs(&block)
|
5
|
+
while enqueued_jobs.size.positive?
|
6
|
+
perform_enqueued_jobs
|
7
|
+
sleep(1)
|
8
|
+
end
|
9
|
+
|
10
|
+
yield block
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
3
14
|
RSpec.configure do |config|
|
4
15
|
config.include ActiveJob::TestHelper
|
16
|
+
config.include DecidimActiveJobExtensions
|
5
17
|
end
|
6
18
|
|
7
19
|
ActiveJob::Base.queue_adapter = :test
|
@@ -28,7 +28,7 @@ module ActiveStorageMatchers
|
|
28
28
|
when :redirect, :representation
|
29
29
|
ActiveStorage::Blob.find_signed(key_match)
|
30
30
|
when :disk
|
31
|
-
decoded = ActiveStorage.verifier.verified(key_match, purpose: :blob_key)
|
31
|
+
decoded = ActiveStorage.verifier.verified(key_match, purpose: :blob_key).with_indifferent_access
|
32
32
|
ActiveStorage::Blob.find_by(key: decoded[:key]) if decoded
|
33
33
|
end
|
34
34
|
end
|
@@ -30,28 +30,21 @@ module Decidim
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
|
34
|
-
|
33
|
+
# Expected values: "", "2", "3", etc. (see parallel_tests documentation)
|
34
|
+
parallel_run_idx = ENV.fetch("TEST_ENV_NUMBER", "").to_i
|
35
|
+
parallel_run_idx -= 1 if parallel_run_idx.positive?
|
36
|
+
Capybara.server_port = 1.step do |num|
|
37
|
+
port = 4999 + num + (100 * parallel_run_idx)
|
38
|
+
next if port == 5432 # Reserved for PostgreSQL
|
35
39
|
next if port == 6379 # Reserved for Redis
|
36
40
|
|
41
|
+
# Make sure the port is not reserved by any other application.
|
37
42
|
begin
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
if ParallelTests.last_process?
|
43
|
-
redis.del("decidim_test_capybara_reserved_ports")
|
44
|
-
else
|
45
|
-
redis.set("decidim_test_capybara_reserved_ports", reserved_ports.sort.join(","))
|
46
|
-
end
|
47
|
-
break
|
48
|
-
end
|
49
|
-
rescue Redis::CannotConnectError
|
50
|
-
# Redis is not available
|
51
|
-
break
|
43
|
+
Socket.tcp("127.0.0.1", port, connect_timeout: 5).close
|
44
|
+
warn "Port #{port} is already in use, trying another one."
|
45
|
+
rescue Errno::ECONNREFUSED
|
46
|
+
break port
|
52
47
|
end
|
53
|
-
ensure
|
54
|
-
Capybara.server_port = port
|
55
48
|
end
|
56
49
|
|
57
50
|
Capybara.register_driver :headless_chrome do |app|
|
@@ -18,7 +18,7 @@ RSpec.configure do |config|
|
|
18
18
|
t.datetime :published_at
|
19
19
|
t.datetime :deleted_at
|
20
20
|
t.integer :coauthorships_count, null: false, default: 0
|
21
|
-
t.integer :
|
21
|
+
t.integer :likes_count, null: false, default: 0
|
22
22
|
t.integer :comments_count, null: false, default: 0
|
23
23
|
t.integer :follows_count, null: false, default: 0
|
24
24
|
|
@@ -53,7 +53,7 @@ RSpec.configure do |config|
|
|
53
53
|
t.datetime :published_at
|
54
54
|
t.datetime :deleted_at
|
55
55
|
t.integer :coauthorships_count, null: false, default: 0
|
56
|
-
t.integer :
|
56
|
+
t.integer :likes_count, null: false, default: 0
|
57
57
|
t.integer :comments_count, null: false, default: 0
|
58
58
|
|
59
59
|
t.references :decidim_component, index: false
|
@@ -1,32 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
shared_context "with editor content containing
|
4
|
-
let(:hashtag) { create(:hashtag, organization:) }
|
5
|
-
let(:hashtag2) { create(:hashtag, organization:) }
|
3
|
+
shared_context "with editor content containing mentions" do
|
6
4
|
let(:user) { create(:user, :confirmed, organization:) }
|
7
5
|
let(:user2) { create(:user, :confirmed, organization:) }
|
8
|
-
let(:user_group) { create(:user_group, :confirmed, organization:) }
|
9
|
-
let(:user_group2) { create(:user_group, :confirmed, organization:) }
|
10
6
|
|
11
7
|
let(:html) do
|
12
8
|
<<~HTML
|
13
|
-
<p>Paragraph with a hashtag #{hashtag.to_global_id} and another hashtag #{hashtag2.to_global_id}</p>
|
14
9
|
<p>Paragraph with a user mention #{user.to_global_id} and another user mention #{user2.to_global_id}</p>
|
15
|
-
<p>Paragraph with a user group mention #{user_group.to_global_id} and another user group mention #{user_group2.to_global_id}</p>
|
16
10
|
HTML
|
17
11
|
end
|
18
12
|
let(:editor_html) do
|
19
13
|
<<~HTML
|
20
|
-
<p>Paragraph with a hashtag #{html_hashtag(hashtag)} and another hashtag #{html_hashtag(hashtag2)}</p>
|
21
14
|
<p>Paragraph with a user mention #{html_mention(user)} and another user mention #{html_mention(user2)}</p>
|
22
|
-
<p>Paragraph with a user group mention #{html_mention(user_group)} and another user group mention #{html_mention(user_group2)}</p>
|
23
15
|
HTML
|
24
16
|
end
|
25
17
|
|
26
|
-
def html_hashtag(hashtag)
|
27
|
-
%(<span data-type="hashtag" data-label="##{hashtag.name}">##{hashtag.name}</span>)
|
28
|
-
end
|
29
|
-
|
30
18
|
def html_mention(mentionable)
|
31
19
|
mention = "@#{mentionable.nickname}"
|
32
20
|
label = "#{mention} (#{CGI.escapeHTML(mentionable.name)})"
|
@@ -134,6 +134,22 @@ module Decidim
|
|
134
134
|
JS
|
135
135
|
)
|
136
136
|
end
|
137
|
+
|
138
|
+
def select_text(selector)
|
139
|
+
page.execute_script(
|
140
|
+
<<~JS
|
141
|
+
var selection = document.getSelection();
|
142
|
+
var range = document.createRange();
|
143
|
+
var element = document.querySelector("#{selector}");
|
144
|
+
|
145
|
+
range.selectNodeContents(element);
|
146
|
+
selection.removeAllRanges();
|
147
|
+
selection.addRange(range);
|
148
|
+
document.dispatchEvent(new MouseEvent("selectstart"));
|
149
|
+
document.dispatchEvent(new MouseEvent("mouseup"));
|
150
|
+
JS
|
151
|
+
)
|
152
|
+
end
|
137
153
|
end
|
138
154
|
|
139
155
|
module FrontEndFileTestHelpers
|
@@ -40,22 +40,6 @@ module RakeTaskOutputHelpers
|
|
40
40
|
$stdout = original_stdout
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
44
|
-
def check_no_errors_have_been_printed
|
45
|
-
expect($stdout.string).not_to include("ERROR:")
|
46
|
-
end
|
47
|
-
|
48
|
-
def check_some_errors_have_been_printed
|
49
|
-
expect($stdout.string).to include("ERROR:")
|
50
|
-
end
|
51
|
-
|
52
|
-
def check_error_printed(type)
|
53
|
-
expect($stdout.string).to include("ERROR: [#{type}]")
|
54
|
-
end
|
55
|
-
|
56
|
-
def check_message_printed(message)
|
57
|
-
expect($stdout.string).to include(message)
|
58
|
-
end
|
59
43
|
end
|
60
44
|
|
61
45
|
RSpec.configure do |config|
|
@@ -20,9 +20,9 @@ module ActionDispatch
|
|
20
20
|
end
|
21
21
|
|
22
22
|
# Add the file URI scheme so terminal emulators can open one click
|
23
|
-
def display_image
|
23
|
+
def display_image(html:, **)
|
24
24
|
message = "[Screenshot Image]: file://#{image_path}\n"
|
25
|
-
message << "[Screenshot HTML]: file://#{html_path}\n" if
|
25
|
+
message << "[Screenshot HTML]: file://#{html_path}\n" if html
|
26
26
|
|
27
27
|
case output_type
|
28
28
|
when "artifact"
|
@@ -6,12 +6,12 @@ RSpec.configure do |config|
|
|
6
6
|
raise "package.json file does not exist" unless Rails.root.join("package.json").exist?
|
7
7
|
raise "Node modules directory does not exist" unless Rails.root.join("node_modules").exist?
|
8
8
|
|
9
|
-
Dir.chdir(Rails.root) {
|
9
|
+
Dir.chdir(Rails.root) { Shakapacker.compile }
|
10
10
|
rescue Errno::ENOENT
|
11
11
|
node_modules_contents = `ls #{Rails.root.join("node_modules")}`
|
12
12
|
|
13
13
|
message = <<~ERROR
|
14
|
-
There was an error during the
|
14
|
+
There was an error during the Shakapacker compilation
|
15
15
|
#{"=" * 80}
|
16
16
|
Node version: #{`node -v`}
|
17
17
|
#{"=" * 80}
|
@@ -24,7 +24,7 @@ RSpec.configure do |config|
|
|
24
24
|
config.raise_errors_for_deprecations!
|
25
25
|
config.example_status_persistence_file_path = ".rspec-failures"
|
26
26
|
config.filter_run_when_matching :focus
|
27
|
-
config.profile_examples = 10
|
27
|
+
config.profile_examples = 10 unless ENV.fetch("CI", false)
|
28
28
|
config.default_formatter = "doc" if config.files_to_run.one?
|
29
29
|
|
30
30
|
# If you are not using ActiveRecord, or you'd prefer not to run each of your
|
data/lib/decidim/dev/version.rb
CHANGED
data/rubocop-decidim.yml
CHANGED
@@ -5,16 +5,24 @@
|
|
5
5
|
# For further details, see:
|
6
6
|
# https://github.com/rubocop/rubocop/issues/4154#issuecomment-316004878
|
7
7
|
|
8
|
-
|
8
|
+
plugins:
|
9
9
|
- rubocop-rubycw
|
10
|
-
- rubocop-capybara
|
11
|
-
- rubocop-factory_bot
|
12
10
|
|
13
11
|
inherit_from:
|
14
|
-
- config/rubocop/
|
15
|
-
- config/rubocop/
|
16
|
-
- config/rubocop/
|
17
|
-
- config/rubocop/
|
18
|
-
- config/rubocop/
|
19
|
-
- config/rubocop/
|
12
|
+
- config/rubocop/capybara/configuration.yml
|
13
|
+
- config/rubocop/capybara/disabled.yml
|
14
|
+
- config/rubocop/performance/configuration.yml
|
15
|
+
- config/rubocop/performance/disabled.yml
|
16
|
+
- config/rubocop/ruby/configuration.yml
|
17
|
+
- config/rubocop/ruby/disabled.yml
|
18
|
+
- config/rubocop/rails/configuration.yml
|
19
|
+
- config/rubocop/rails/disabled.yml
|
20
|
+
- config/rubocop/rspec/configuration.yml
|
21
|
+
- config/rubocop/rspec/disabled.yml
|
22
|
+
- config/rubocop/faker/configuration.yml
|
23
|
+
- config/rubocop/faker/disabled.yml
|
24
|
+
- config/rubocop/graphql/configuration.yml
|
25
|
+
- config/rubocop/graphql/disabled.yml
|
26
|
+
- config/rubocop/factory_bot/configuration.yml
|
27
|
+
- config/rubocop/factory_bot/disabled.yml
|
20
28
|
- config/rubocop/disabled.yml
|