decidim-dev 0.7.4 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +10 -2
- data/config/locales/pt.yml +9 -0
- data/lib/decidim/dev/assets/id.jpg +0 -0
- data/lib/decidim/dev/test/base_spec_helper.rb +3 -0
- data/lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb +1 -1
- data/lib/decidim/dev/test/rspec_support/action_mailer.rb +0 -14
- data/lib/decidim/dev/test/rspec_support/active_job.rb +0 -4
- data/lib/decidim/dev/test/rspec_support/authorization.rb +43 -0
- data/lib/decidim/dev/test/rspec_support/capybara.rb +29 -14
- data/lib/decidim/dev/test/rspec_support/capybara_select2.rb +7 -18
- data/lib/decidim/dev/test/rspec_support/{factory_girl.rb → factory_bot.rb} +1 -1
- data/lib/decidim/dev/test/rspec_support/feature.rb +16 -13
- data/lib/decidim/dev/test/rspec_support/feature_context.rb +16 -12
- data/lib/decidim/dev/test/rspec_support/helpers.rb +4 -0
- data/lib/decidim/dev/test/rspec_support/webmock.rb +2 -1
- data/lib/decidim/dev/test/spec_helper.rb +1 -1
- data/lib/decidim/dev/version.rb +1 -1
- data/lib/tasks/test_app.rake +9 -17
- metadata +76 -80
- data/lib/decidim/dev/test/rspec_support/authenticated_controller_context.rb +0 -10
- data/lib/decidim/dev/test/rspec_support/authorization_handlers.rb +0 -14
- data/lib/decidim/dev/test/rspec_support/phantomjs_polyfills/phantomjs-shim.js +0 -208
- data/lib/generators/decidim/dummy_generator.rb +0 -85
- data/lib/generators/decidim/templates/autoprefixer.yml +0 -8
- data/lib/generators/decidim/templates/autoprefixer_initializer.rb +0 -18
- data/lib/generators/decidim/templates/no_animations.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 18dcc6c4476ff8323824e9ac13b028ce3bc10ca6
|
4
|
+
data.tar.gz: 4f67b818d5cba71eef2e2fa63bb431a9998faa0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1084217ce160757c1cb1baf581c73e97f34fd4a7e91d565f09b2c647f3d8fefd95b50c7526249e6b5e6d3a5f789f12cabd2c535ece5f651d84467adf041b1846
|
7
|
+
data.tar.gz: 1fb5a1db999733b377cc102fcca452332a459f012836d28db3711b519c0b90f4b714696c95ccb831ea81b3ccc6ab1e8e7180977492f20d4caac2fedbef08f534
|
data/README.md
CHANGED
@@ -3,9 +3,14 @@
|
|
3
3
|
This gem allows local development of decidim's features and other features.
|
4
4
|
|
5
5
|
## Usage
|
6
|
-
|
6
|
+
|
7
|
+
`decidim-dev` provides some testing utils such as shared contexts, examples, and
|
8
|
+
dummy assets or resources that you can use to test your own plugins. It also
|
9
|
+
provides a `decidim:generate_external_test_app` rake task that you can use to
|
10
|
+
generate a dummy application to test your plugin.
|
7
11
|
|
8
12
|
## Installation
|
13
|
+
|
9
14
|
Add this line to your application's Gemfile:
|
10
15
|
|
11
16
|
```ruby
|
@@ -13,12 +18,15 @@ gem 'decidim-dev'
|
|
13
18
|
```
|
14
19
|
|
15
20
|
And then execute:
|
21
|
+
|
16
22
|
```bash
|
17
|
-
|
23
|
+
bundle
|
18
24
|
```
|
19
25
|
|
20
26
|
## Contributing
|
27
|
+
|
21
28
|
See [Decidim](https://github.com/decidim/decidim).
|
22
29
|
|
23
30
|
## License
|
31
|
+
|
24
32
|
See [Decidim](https://github.com/decidim/decidim).
|
Binary file
|
@@ -22,9 +22,12 @@ require "decidim/core"
|
|
22
22
|
require "decidim/core/test"
|
23
23
|
|
24
24
|
require_relative "rspec_support/feature.rb"
|
25
|
+
require_relative "rspec_support/authorization.rb"
|
25
26
|
|
26
27
|
require "#{Decidim::Dev.dummy_app_path}/config/environment"
|
27
28
|
|
28
29
|
Dir["#{engine_spec_dir}/shared/**/*.rb"].each { |f| require f }
|
29
30
|
|
31
|
+
require "paper_trail/frameworks/rspec"
|
32
|
+
|
30
33
|
require_relative "spec_helper"
|
@@ -57,17 +57,3 @@ end
|
|
57
57
|
RSpec.configure do |config|
|
58
58
|
config.include MailerHelpers
|
59
59
|
end
|
60
|
-
|
61
|
-
RSpec.configure do |config|
|
62
|
-
config.before :example, perform_enqueued: true do
|
63
|
-
@old_perform_enqueued_jobs = ActiveJob::Base.queue_adapter.perform_enqueued_jobs
|
64
|
-
@old_perform_enqueued_at_jobs = ActiveJob::Base.queue_adapter.perform_enqueued_at_jobs
|
65
|
-
ActiveJob::Base.queue_adapter.perform_enqueued_jobs = true
|
66
|
-
ActiveJob::Base.queue_adapter.perform_enqueued_at_jobs = true
|
67
|
-
end
|
68
|
-
|
69
|
-
config.after :example, perform_enqueued: true do
|
70
|
-
ActiveJob::Base.queue_adapter.perform_enqueued_jobs = @old_perform_enqueued_jobs
|
71
|
-
ActiveJob::Base.queue_adapter.perform_enqueued_at_jobs = @old_perform_enqueued_at_jobs
|
72
|
-
end
|
73
|
-
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "decidim/verifications/workflows"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module Verifications
|
7
|
+
module DummyVerification
|
8
|
+
# Dummy engine to be able to test verifications.
|
9
|
+
class Engine < ::Rails::Engine
|
10
|
+
isolate_namespace Decidim::Verifications::DummyVerification
|
11
|
+
|
12
|
+
routes do
|
13
|
+
root to: proc { [200, {}, ["DUMMY VERIFICATION ENGINE"]] }
|
14
|
+
get :edit_authorization, to: proc { [200, {}, ["CONTINUE YOUR VERIFICATION"]] }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
Decidim::Verifications.register_workflow(:dummy_authorization_workflow) do |workflow|
|
22
|
+
workflow.engine = Decidim::Verifications::DummyVerification::Engine
|
23
|
+
end
|
24
|
+
|
25
|
+
RSpec.configure do |config|
|
26
|
+
config.around(:example, :with_authorization_workflows) do |example|
|
27
|
+
begin
|
28
|
+
previous_workflows = Decidim::Verifications.workflows.dup
|
29
|
+
|
30
|
+
new_workflows = example.metadata[:with_authorization_workflows].map do |name|
|
31
|
+
Decidim::Verifications.find_workflow_manifest(name)
|
32
|
+
end
|
33
|
+
|
34
|
+
Decidim::Verifications.reset_workflows(*new_workflows)
|
35
|
+
Rails.application.reload_routes!
|
36
|
+
|
37
|
+
example.run
|
38
|
+
ensure
|
39
|
+
Decidim::Verifications.reset_workflows(*previous_workflows)
|
40
|
+
Rails.application.reload_routes!
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -22,11 +22,33 @@ module Decidim
|
|
22
22
|
end
|
23
23
|
|
24
24
|
Capybara.register_driver :headless_chrome do |app|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
http_client = Selenium::WebDriver::Remote::Http::Default.new
|
26
|
+
http_client.read_timeout = 120
|
27
|
+
|
28
|
+
options = ::Selenium::WebDriver::Chrome::Options.new
|
29
|
+
options.args << "--headless"
|
30
|
+
options.args << "--no-sandbox"
|
31
|
+
options.args << "--window-size=1024,768"
|
32
|
+
|
33
|
+
Capybara::Selenium::Driver.new(
|
34
|
+
app,
|
35
|
+
browser: :chrome,
|
36
|
+
options: options,
|
37
|
+
http_client: http_client
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Monkeypatch the other place where capybara can timeout. We should contribute
|
42
|
+
# the configurability to capybara if this works consistently and proves to be
|
43
|
+
# useful
|
44
|
+
module Capybara
|
45
|
+
class Server
|
46
|
+
def wait_for_pending_requests
|
47
|
+
Timeout.timeout(120) { sleep(0.01) while pending_requests? }
|
48
|
+
rescue Timeout::Error
|
49
|
+
raise "Requests did not finish in 60 seconds"
|
50
|
+
end
|
51
|
+
end
|
30
52
|
end
|
31
53
|
|
32
54
|
Capybara::Screenshot.prune_strategy = :keep_last_run
|
@@ -41,6 +63,8 @@ Capybara.configure do |config|
|
|
41
63
|
config.default_driver = :headless_chrome
|
42
64
|
end
|
43
65
|
|
66
|
+
Capybara.asset_host = "http://localhost:3000"
|
67
|
+
|
44
68
|
RSpec.configure do |config|
|
45
69
|
config.before :each, type: :feature do
|
46
70
|
Capybara.current_session.driver.reset!
|
@@ -48,13 +72,4 @@ RSpec.configure do |config|
|
|
48
72
|
end
|
49
73
|
|
50
74
|
config.include Decidim::CapybaraTestHelpers, type: :feature
|
51
|
-
|
52
|
-
if ENV["CI"]
|
53
|
-
require "rspec/repeat"
|
54
|
-
|
55
|
-
config.include RSpec::Repeat
|
56
|
-
config.around :each, type: :feature do |example|
|
57
|
-
repeat example, 5.times, wait: 1, verbose: true
|
58
|
-
end
|
59
|
-
end
|
60
75
|
end
|
@@ -1,32 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Adapted from https://github.com/goodwill/capybara-select2
|
4
|
-
|
5
3
|
module Capybara
|
6
4
|
module Select2
|
7
|
-
def select2(value,
|
8
|
-
expect(page).to have_xpath(
|
9
|
-
select2_container = find(:xpath,
|
5
|
+
def select2(value, from:)
|
6
|
+
expect(page).to have_xpath("//select[@id='#{from}']/..")
|
7
|
+
select2_container = find(:xpath, "//select[@id='#{from}']/..")
|
10
8
|
|
11
9
|
expect(select2_container).to have_selector(".select2-selection")
|
12
10
|
select2_container.find(".select2-selection").click
|
13
11
|
|
14
|
-
if search
|
15
|
-
body = find(:xpath, "//body")
|
16
|
-
expect(body).to have_selector(".select2-search input.select2-search__field")
|
17
|
-
body.find(".select2-search input.select2-search__field").set(value)
|
18
|
-
|
19
|
-
page.execute_script(%|$("input.select2-search__field:visible").keyup();|)
|
20
|
-
drop_container = ".select2-results"
|
21
|
-
else
|
22
|
-
drop_container = ".select2-dropdown"
|
23
|
-
end
|
24
|
-
|
25
12
|
expect(page).to have_no_content("Searching...")
|
26
13
|
|
27
14
|
body = find(:xpath, "//body")
|
28
|
-
expect(body).to have_selector("
|
29
|
-
|
15
|
+
expect(body).to have_selector(".select2-dropdown li.select2-results__option", text: value)
|
16
|
+
|
17
|
+
body.find(".select2-dropdown li.select2-results__option", text: value).click
|
18
|
+
expect(page).to have_select(from, with_options: [value])
|
30
19
|
end
|
31
20
|
end
|
32
21
|
end
|
@@ -41,6 +41,7 @@ module Decidim
|
|
41
41
|
include HasScope
|
42
42
|
include Decidim::Comments::Commentable
|
43
43
|
include Followable
|
44
|
+
include Traceable
|
44
45
|
|
45
46
|
feature_manifest_name "dummy"
|
46
47
|
|
@@ -115,19 +116,21 @@ end
|
|
115
116
|
|
116
117
|
RSpec.configure do |config|
|
117
118
|
config.before(:suite) do
|
118
|
-
|
119
|
-
ActiveRecord::
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
119
|
+
ActiveRecord::Migration.suppress_messages do
|
120
|
+
unless ActiveRecord::Base.connection.data_source_exists?("decidim_dummy_resources")
|
121
|
+
ActiveRecord::Migration.create_table :decidim_dummy_resources do |t|
|
122
|
+
t.string :title
|
123
|
+
t.text :address
|
124
|
+
t.float :latitude
|
125
|
+
t.float :longitude
|
126
|
+
|
127
|
+
t.references :decidim_feature, index: true
|
128
|
+
t.references :decidim_author, index: true
|
129
|
+
t.references :decidim_category, index: true
|
130
|
+
t.references :decidim_scope, index: true
|
131
|
+
|
132
|
+
t.timestamps
|
133
|
+
end
|
131
134
|
end
|
132
135
|
end
|
133
136
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
shared_context "feature" do
|
3
|
+
shared_context "with a feature" do
|
4
4
|
let(:manifest) { Decidim.find_feature_manifest(manifest_name) }
|
5
5
|
|
6
6
|
let(:user) { create :user, :confirmed, organization: organization }
|
@@ -32,18 +32,11 @@ shared_context "feature" do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
shared_context "feature
|
36
|
-
include_context "feature"
|
35
|
+
shared_context "when managing a feature" do
|
36
|
+
include_context "with a feature"
|
37
37
|
|
38
38
|
let(:current_feature) { feature }
|
39
39
|
|
40
|
-
let(:user) do
|
41
|
-
create :user,
|
42
|
-
:admin,
|
43
|
-
:confirmed,
|
44
|
-
organization: organization
|
45
|
-
end
|
46
|
-
|
47
40
|
before do
|
48
41
|
login_as user, scope: :user
|
49
42
|
visit_feature_admin
|
@@ -63,8 +56,19 @@ shared_context "feature admin" do
|
|
63
56
|
end
|
64
57
|
end
|
65
58
|
|
66
|
-
shared_context "feature
|
67
|
-
include_context "feature
|
59
|
+
shared_context "when managing a feature as an admin" do
|
60
|
+
include_context "when managing a feature"
|
61
|
+
|
62
|
+
let(:user) do
|
63
|
+
create :user,
|
64
|
+
:admin,
|
65
|
+
:confirmed,
|
66
|
+
organization: organization
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
shared_context "when managing a feature as a process admin" do
|
71
|
+
include_context "when managing a feature"
|
68
72
|
|
69
73
|
let(:user) do
|
70
74
|
create :user,
|
data/lib/decidim/dev/version.rb
CHANGED
data/lib/tasks/test_app.rake
CHANGED
@@ -1,29 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "generators/decidim/
|
3
|
+
require "generators/decidim/app_generator"
|
4
4
|
|
5
5
|
namespace :decidim do
|
6
|
-
desc "Generates a dummy app for testing"
|
7
|
-
task :generate_test_app do
|
8
|
-
dummy_app_path = File.expand_path(File.join(Dir.pwd, "spec", "decidim_dummy_app"))
|
9
|
-
|
10
|
-
Bundler.with_clean_env do
|
11
|
-
Decidim::Generators::DummyGenerator.start(
|
12
|
-
[
|
13
|
-
"--dummy_app_path=#{dummy_app_path}"
|
14
|
-
]
|
15
|
-
)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
6
|
desc "Generates a dummy app for testing in external installations"
|
20
7
|
task :generate_external_test_app do
|
21
8
|
dummy_app_path = File.expand_path(File.join(Dir.pwd, "spec", "decidim_dummy_app"))
|
22
9
|
|
23
|
-
Decidim::Generators::
|
10
|
+
Decidim::Generators::AppGenerator.start(
|
24
11
|
[
|
25
|
-
|
26
|
-
"--
|
12
|
+
dummy_app_path,
|
13
|
+
"--path",
|
14
|
+
"../..",
|
15
|
+
"--recreate_db",
|
16
|
+
"--app_const_base=DummyApplication",
|
17
|
+
"--skip_gemfile",
|
18
|
+
"--demo"
|
27
19
|
]
|
28
20
|
)
|
29
21
|
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.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
@@ -10,36 +10,36 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-12-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: capybara
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: '2.15'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version:
|
28
|
+
version: '2.15'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
|
-
name:
|
30
|
+
name: capybara-screenshot
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- - "
|
33
|
+
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: '0'
|
35
|
+
version: '1.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'
|
42
|
+
version: '1.0'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: database_cleaner
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -55,89 +55,89 @@ dependencies:
|
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '1.6'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
|
-
name:
|
58
|
+
name: decidim
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - '='
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
63
|
+
version: 0.8.0
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - '='
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
70
|
+
version: 0.8.0
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
72
|
+
name: factory_bot_rails
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
75
|
- - "~>"
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
77
|
+
version: '4.8'
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - "~>"
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: '
|
84
|
+
version: '4.8'
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
|
-
name:
|
86
|
+
name: byebug
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
|
-
- - "
|
89
|
+
- - ">="
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version: '
|
91
|
+
version: '0'
|
92
92
|
type: :runtime
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
|
-
- - "
|
96
|
+
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: '
|
98
|
+
version: '0'
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
|
-
name:
|
100
|
+
name: codecov
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
103
|
- - "~>"
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version:
|
105
|
+
version: 0.1.9
|
106
106
|
type: :runtime
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
110
|
- - "~>"
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
112
|
+
version: 0.1.9
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
|
-
name:
|
114
|
+
name: db-query-matchers
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- - "
|
117
|
+
- - "~>"
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version:
|
119
|
+
version: 0.9.0
|
120
120
|
type: :runtime
|
121
121
|
prerelease: false
|
122
122
|
version_requirements: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
|
-
- - "
|
124
|
+
- - "~>"
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version:
|
126
|
+
version: 0.9.0
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
|
-
name:
|
128
|
+
name: i18n-tasks
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
|
-
- -
|
131
|
+
- - '='
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version: 0.
|
133
|
+
version: 0.9.18
|
134
134
|
type: :runtime
|
135
135
|
prerelease: false
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
|
-
- -
|
138
|
+
- - '='
|
139
139
|
- !ruby/object:Gem::Version
|
140
|
-
version: 0.
|
140
|
+
version: 0.9.18
|
141
141
|
- !ruby/object:Gem::Dependency
|
142
142
|
name: listen
|
143
143
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,63 +153,63 @@ dependencies:
|
|
153
153
|
- !ruby/object:Gem::Version
|
154
154
|
version: '3.1'
|
155
155
|
- !ruby/object:Gem::Dependency
|
156
|
-
name:
|
156
|
+
name: nokogiri
|
157
157
|
requirement: !ruby/object:Gem::Requirement
|
158
158
|
requirements:
|
159
|
-
- -
|
159
|
+
- - "~>"
|
160
160
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
161
|
+
version: '1.8'
|
162
162
|
type: :runtime
|
163
163
|
prerelease: false
|
164
164
|
version_requirements: !ruby/object:Gem::Requirement
|
165
165
|
requirements:
|
166
|
-
- -
|
166
|
+
- - "~>"
|
167
167
|
- !ruby/object:Gem::Version
|
168
|
-
version:
|
168
|
+
version: '1.8'
|
169
169
|
- !ruby/object:Gem::Dependency
|
170
|
-
name:
|
170
|
+
name: puma
|
171
171
|
requirement: !ruby/object:Gem::Requirement
|
172
172
|
requirements:
|
173
173
|
- - "~>"
|
174
174
|
- !ruby/object:Gem::Version
|
175
|
-
version: '
|
175
|
+
version: '3.10'
|
176
176
|
type: :runtime
|
177
177
|
prerelease: false
|
178
178
|
version_requirements: !ruby/object:Gem::Requirement
|
179
179
|
requirements:
|
180
180
|
- - "~>"
|
181
181
|
- !ruby/object:Gem::Version
|
182
|
-
version: '
|
182
|
+
version: '3.10'
|
183
183
|
- !ruby/object:Gem::Dependency
|
184
|
-
name:
|
184
|
+
name: rails-controller-testing
|
185
185
|
requirement: !ruby/object:Gem::Requirement
|
186
186
|
requirements:
|
187
187
|
- - "~>"
|
188
188
|
- !ruby/object:Gem::Version
|
189
|
-
version: 0
|
189
|
+
version: '1.0'
|
190
190
|
type: :runtime
|
191
191
|
prerelease: false
|
192
192
|
version_requirements: !ruby/object:Gem::Requirement
|
193
193
|
requirements:
|
194
194
|
- - "~>"
|
195
195
|
- !ruby/object:Gem::Version
|
196
|
-
version: 0
|
196
|
+
version: '1.0'
|
197
197
|
- !ruby/object:Gem::Dependency
|
198
|
-
name:
|
198
|
+
name: rspec-html-matchers
|
199
199
|
requirement: !ruby/object:Gem::Requirement
|
200
200
|
requirements:
|
201
201
|
- - "~>"
|
202
202
|
- !ruby/object:Gem::Version
|
203
|
-
version: 0.
|
203
|
+
version: 0.9.1
|
204
204
|
type: :runtime
|
205
205
|
prerelease: false
|
206
206
|
version_requirements: !ruby/object:Gem::Requirement
|
207
207
|
requirements:
|
208
208
|
- - "~>"
|
209
209
|
- !ruby/object:Gem::Version
|
210
|
-
version: 0.
|
210
|
+
version: 0.9.1
|
211
211
|
- !ruby/object:Gem::Dependency
|
212
|
-
name:
|
212
|
+
name: rspec-rails
|
213
213
|
requirement: !ruby/object:Gem::Requirement
|
214
214
|
requirements:
|
215
215
|
- - "~>"
|
@@ -223,89 +223,89 @@ dependencies:
|
|
223
223
|
- !ruby/object:Gem::Version
|
224
224
|
version: '3.7'
|
225
225
|
- !ruby/object:Gem::Dependency
|
226
|
-
name:
|
226
|
+
name: rubocop
|
227
227
|
requirement: !ruby/object:Gem::Requirement
|
228
228
|
requirements:
|
229
229
|
- - "~>"
|
230
230
|
- !ruby/object:Gem::Version
|
231
|
-
version:
|
231
|
+
version: 0.51.0
|
232
232
|
type: :runtime
|
233
233
|
prerelease: false
|
234
234
|
version_requirements: !ruby/object:Gem::Requirement
|
235
235
|
requirements:
|
236
236
|
- - "~>"
|
237
237
|
- !ruby/object:Gem::Version
|
238
|
-
version:
|
238
|
+
version: 0.51.0
|
239
239
|
- !ruby/object:Gem::Dependency
|
240
|
-
name:
|
240
|
+
name: rubocop-rspec
|
241
241
|
requirement: !ruby/object:Gem::Requirement
|
242
242
|
requirements:
|
243
243
|
- - "~>"
|
244
244
|
- !ruby/object:Gem::Version
|
245
|
-
version:
|
245
|
+
version: '1.20'
|
246
246
|
type: :runtime
|
247
247
|
prerelease: false
|
248
248
|
version_requirements: !ruby/object:Gem::Requirement
|
249
249
|
requirements:
|
250
250
|
- - "~>"
|
251
251
|
- !ruby/object:Gem::Version
|
252
|
-
version:
|
252
|
+
version: '1.20'
|
253
253
|
- !ruby/object:Gem::Dependency
|
254
|
-
name:
|
254
|
+
name: selenium-webdriver
|
255
255
|
requirement: !ruby/object:Gem::Requirement
|
256
256
|
requirements:
|
257
257
|
- - "~>"
|
258
258
|
- !ruby/object:Gem::Version
|
259
|
-
version:
|
259
|
+
version: '3.7'
|
260
260
|
type: :runtime
|
261
261
|
prerelease: false
|
262
262
|
version_requirements: !ruby/object:Gem::Requirement
|
263
263
|
requirements:
|
264
264
|
- - "~>"
|
265
265
|
- !ruby/object:Gem::Version
|
266
|
-
version:
|
266
|
+
version: '3.7'
|
267
267
|
- !ruby/object:Gem::Dependency
|
268
|
-
name:
|
268
|
+
name: simplecov
|
269
269
|
requirement: !ruby/object:Gem::Requirement
|
270
270
|
requirements:
|
271
271
|
- - "~>"
|
272
272
|
- !ruby/object:Gem::Version
|
273
|
-
version: '
|
273
|
+
version: '0.13'
|
274
274
|
type: :runtime
|
275
275
|
prerelease: false
|
276
276
|
version_requirements: !ruby/object:Gem::Requirement
|
277
277
|
requirements:
|
278
278
|
- - "~>"
|
279
279
|
- !ruby/object:Gem::Version
|
280
|
-
version: '
|
280
|
+
version: '0.13'
|
281
281
|
- !ruby/object:Gem::Dependency
|
282
|
-
name:
|
282
|
+
name: webmock
|
283
283
|
requirement: !ruby/object:Gem::Requirement
|
284
284
|
requirements:
|
285
285
|
- - "~>"
|
286
286
|
- !ruby/object:Gem::Version
|
287
|
-
version: '3.
|
287
|
+
version: '3.0'
|
288
288
|
type: :runtime
|
289
289
|
prerelease: false
|
290
290
|
version_requirements: !ruby/object:Gem::Requirement
|
291
291
|
requirements:
|
292
292
|
- - "~>"
|
293
293
|
- !ruby/object:Gem::Version
|
294
|
-
version: '3.
|
294
|
+
version: '3.0'
|
295
295
|
- !ruby/object:Gem::Dependency
|
296
|
-
name:
|
296
|
+
name: wisper-rspec
|
297
297
|
requirement: !ruby/object:Gem::Requirement
|
298
298
|
requirements:
|
299
299
|
- - "~>"
|
300
300
|
- !ruby/object:Gem::Version
|
301
|
-
version:
|
301
|
+
version: 0.0.3
|
302
302
|
type: :runtime
|
303
303
|
prerelease: false
|
304
304
|
version_requirements: !ruby/object:Gem::Requirement
|
305
305
|
requirements:
|
306
306
|
- - "~>"
|
307
307
|
- !ruby/object:Gem::Version
|
308
|
-
version:
|
308
|
+
version: 0.0.3
|
309
309
|
description: Utilities and tools we need to develop Decidim
|
310
310
|
email:
|
311
311
|
- josepjaume@gmail.com
|
@@ -328,6 +328,7 @@ files:
|
|
328
328
|
- config/locales/it.yml
|
329
329
|
- config/locales/nl.yml
|
330
330
|
- config/locales/pl.yml
|
331
|
+
- config/locales/pt.yml
|
331
332
|
- config/locales/ru.yml
|
332
333
|
- config/locales/uk.yml
|
333
334
|
- lib/decidim/dev.rb
|
@@ -337,6 +338,7 @@ files:
|
|
337
338
|
- lib/decidim/dev/assets/city2.jpeg
|
338
339
|
- lib/decidim/dev/assets/city3.jpeg
|
339
340
|
- lib/decidim/dev/assets/icon.png
|
341
|
+
- lib/decidim/dev/assets/id.jpg
|
340
342
|
- lib/decidim/dev/assets/malicious.jpg
|
341
343
|
- lib/decidim/dev/common_rake.rb
|
342
344
|
- lib/decidim/dev/railtie.rb
|
@@ -346,19 +348,17 @@ files:
|
|
346
348
|
- lib/decidim/dev/test/rspec_support/action_mailer.rb
|
347
349
|
- lib/decidim/dev/test/rspec_support/active_job.rb
|
348
350
|
- lib/decidim/dev/test/rspec_support/attachments.rb
|
349
|
-
- lib/decidim/dev/test/rspec_support/
|
350
|
-
- lib/decidim/dev/test/rspec_support/authorization_handlers.rb
|
351
|
+
- lib/decidim/dev/test/rspec_support/authorization.rb
|
351
352
|
- lib/decidim/dev/test/rspec_support/capybara.rb
|
352
353
|
- lib/decidim/dev/test/rspec_support/capybara_select2.rb
|
353
354
|
- lib/decidim/dev/test/rspec_support/comments.rb
|
354
355
|
- lib/decidim/dev/test/rspec_support/database_cleaner.rb
|
355
|
-
- lib/decidim/dev/test/rspec_support/
|
356
|
+
- lib/decidim/dev/test/rspec_support/factory_bot.rb
|
356
357
|
- lib/decidim/dev/test/rspec_support/feature.rb
|
357
358
|
- lib/decidim/dev/test/rspec_support/feature_context.rb
|
358
359
|
- lib/decidim/dev/test/rspec_support/geocoder.rb
|
359
360
|
- lib/decidim/dev/test/rspec_support/helpers.rb
|
360
361
|
- lib/decidim/dev/test/rspec_support/html_matchers.rb
|
361
|
-
- lib/decidim/dev/test/rspec_support/phantomjs_polyfills/phantomjs-shim.js
|
362
362
|
- lib/decidim/dev/test/rspec_support/route_helpers.rb
|
363
363
|
- lib/decidim/dev/test/rspec_support/translation_helpers.rb
|
364
364
|
- lib/decidim/dev/test/rspec_support/warden.rb
|
@@ -366,10 +366,6 @@ files:
|
|
366
366
|
- lib/decidim/dev/test/rspec_support/wisper.rb
|
367
367
|
- lib/decidim/dev/test/spec_helper.rb
|
368
368
|
- lib/decidim/dev/version.rb
|
369
|
-
- lib/generators/decidim/dummy_generator.rb
|
370
|
-
- lib/generators/decidim/templates/autoprefixer.yml
|
371
|
-
- lib/generators/decidim/templates/autoprefixer_initializer.rb
|
372
|
-
- lib/generators/decidim/templates/no_animations.rb
|
373
369
|
- lib/tasks/locale_checker.rake
|
374
370
|
- lib/tasks/test_app.rake
|
375
371
|
homepage: https://github.com/decidim/decidim
|
@@ -392,7 +388,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
392
388
|
version: '0'
|
393
389
|
requirements: []
|
394
390
|
rubyforge_project:
|
395
|
-
rubygems_version: 2.
|
391
|
+
rubygems_version: 2.6.13
|
396
392
|
signing_key:
|
397
393
|
specification_version: 4
|
398
394
|
summary: Decidim Dev tools
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.configure do |config|
|
4
|
-
config.around(:example, without_authorizations: true) do |example|
|
5
|
-
begin
|
6
|
-
previous_handlers = Decidim.authorization_handlers
|
7
|
-
Decidim.authorization_handlers = []
|
8
|
-
|
9
|
-
example.run
|
10
|
-
ensure
|
11
|
-
Decidim.authorization_handlers = previous_handlers
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,208 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Adapted from https://github.com/Raynos/function-bind
|
3
|
-
* Copyright 2013 Raynos.
|
4
|
-
* MIT license, see license.md for detail.
|
5
|
-
*/
|
6
|
-
|
7
|
-
(function() {
|
8
|
-
if (Function.prototype.bind) {
|
9
|
-
return;
|
10
|
-
}
|
11
|
-
|
12
|
-
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
13
|
-
var slice = Array.prototype.slice;
|
14
|
-
var toStr = Object.prototype.toString;
|
15
|
-
var funcType = '[object Function]';
|
16
|
-
|
17
|
-
Function.prototype.bind = function bind(that) {
|
18
|
-
var target = this;
|
19
|
-
if (typeof target !== 'function' || toStr.call(target) !== funcType) {
|
20
|
-
throw new TypeError(ERROR_MESSAGE + target);
|
21
|
-
}
|
22
|
-
var args = slice.call(arguments, 1);
|
23
|
-
|
24
|
-
var binder = function () {
|
25
|
-
if (this instanceof bound) {
|
26
|
-
var result = target.apply(this, args.concat(slice.call(arguments)));
|
27
|
-
if (Object(result) === result) {
|
28
|
-
return result;
|
29
|
-
}
|
30
|
-
return this;
|
31
|
-
} else {
|
32
|
-
return target.apply(that, args.concat(slice.call(arguments)));
|
33
|
-
}
|
34
|
-
};
|
35
|
-
|
36
|
-
var boundLength = Math.max(0, target.length - args.length);
|
37
|
-
var boundArgs = [];
|
38
|
-
for (var i = 0; i < boundLength; i++) {
|
39
|
-
boundArgs.push('$' + i);
|
40
|
-
}
|
41
|
-
|
42
|
-
var bound = Function('binder', 'return function (' + boundArgs.join(',') +
|
43
|
-
'){ return binder.apply(this,arguments); }')(binder);
|
44
|
-
|
45
|
-
if (target.prototype) {
|
46
|
-
var Empty = function Empty() {};
|
47
|
-
Empty.prototype = target.prototype;
|
48
|
-
bound.prototype = new Empty();
|
49
|
-
Empty.prototype = null;
|
50
|
-
}
|
51
|
-
|
52
|
-
return bound;
|
53
|
-
};
|
54
|
-
|
55
|
-
}());
|
56
|
-
|
57
|
-
/**
|
58
|
-
* Polyfill for requestAnimationFrame
|
59
|
-
* http://paulirish.com/2011/requestanimationframe-for-smart-animating/
|
60
|
-
* http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
|
61
|
-
* requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
|
62
|
-
* MIT license
|
63
|
-
*/
|
64
|
-
(function() {
|
65
|
-
var lastTime = 0;
|
66
|
-
var vendors = ['ms', 'moz', 'webkit', 'o'];
|
67
|
-
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
|
68
|
-
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
|
69
|
-
window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame']
|
70
|
-
|| window[vendors[x] + 'CancelRequestAnimationFrame'];
|
71
|
-
}
|
72
|
-
if(!window.requestAnimationFrame)
|
73
|
-
window.requestAnimationFrame = function(callback, element) {
|
74
|
-
var currTime = new Date().getTime();
|
75
|
-
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
76
|
-
var id = window.setTimeout(function() {
|
77
|
-
callback(currTime + timeToCall);
|
78
|
-
},
|
79
|
-
timeToCall);
|
80
|
-
lastTime = currTime + timeToCall;
|
81
|
-
return id;
|
82
|
-
};
|
83
|
-
if(!window.cancelAnimationFrame)
|
84
|
-
window.cancelAnimationFrame = function(id) {
|
85
|
-
clearTimeout(id);
|
86
|
-
};
|
87
|
-
}());
|
88
|
-
|
89
|
-
/**
|
90
|
-
* Polyfill for String.startsWith
|
91
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
|
92
|
-
*/
|
93
|
-
(function() {
|
94
|
-
if (!String.prototype.startsWith) {
|
95
|
-
String.prototype.startsWith = function(searchString, position) {
|
96
|
-
position = position || 0;
|
97
|
-
return this.indexOf(searchString, position) === position;
|
98
|
-
};
|
99
|
-
}
|
100
|
-
})();
|
101
|
-
|
102
|
-
/**
|
103
|
-
* Polyfill for String.repeat
|
104
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat
|
105
|
-
*/
|
106
|
-
(function() {
|
107
|
-
if (!String.prototype.repeat) {
|
108
|
-
String.prototype.repeat = function(count) {
|
109
|
-
'use strict';
|
110
|
-
if (this == null) {
|
111
|
-
throw new TypeError('can\'t convert ' + this + ' to object');
|
112
|
-
}
|
113
|
-
var str = '' + this;
|
114
|
-
count = +count;
|
115
|
-
if (count != count) {
|
116
|
-
count = 0;
|
117
|
-
}
|
118
|
-
if (count < 0) {
|
119
|
-
throw new RangeError('repeat count must be non-negative');
|
120
|
-
}
|
121
|
-
if (count == Infinity) {
|
122
|
-
throw new RangeError('repeat count must be less than infinity');
|
123
|
-
}
|
124
|
-
count = Math.floor(count);
|
125
|
-
if (str.length == 0 || count == 0) {
|
126
|
-
return '';
|
127
|
-
}
|
128
|
-
// Ensuring count is a 31-bit integer allows us to heavily optimize the
|
129
|
-
// main part. But anyway, most current (August 2014) browsers can't handle
|
130
|
-
// strings 1 << 28 chars or longer, so:
|
131
|
-
if (str.length * count >= 1 << 28) {
|
132
|
-
throw new RangeError('repeat count must not overflow maximum string size');
|
133
|
-
}
|
134
|
-
var rpt = '';
|
135
|
-
for (;;) {
|
136
|
-
if ((count & 1) == 1) {
|
137
|
-
rpt += str;
|
138
|
-
}
|
139
|
-
count >>>= 1;
|
140
|
-
if (count == 0) {
|
141
|
-
break;
|
142
|
-
}
|
143
|
-
str += str;
|
144
|
-
}
|
145
|
-
// Could we try:
|
146
|
-
// return Array(count + 1).join(this);
|
147
|
-
return rpt;
|
148
|
-
}
|
149
|
-
}})();
|
150
|
-
|
151
|
-
/**
|
152
|
-
* Polyfill for String.includes
|
153
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
|
154
|
-
*/
|
155
|
-
(function() {
|
156
|
-
if (!String.prototype.includes) {
|
157
|
-
String.prototype.includes = function(search, start) {
|
158
|
-
'use strict';
|
159
|
-
if (typeof start !== 'number') {
|
160
|
-
start = 0;
|
161
|
-
}
|
162
|
-
|
163
|
-
if (start + search.length > this.length) {
|
164
|
-
return false;
|
165
|
-
} else {
|
166
|
-
return this.indexOf(search, start) !== -1;
|
167
|
-
}
|
168
|
-
};
|
169
|
-
}
|
170
|
-
})();
|
171
|
-
|
172
|
-
/**
|
173
|
-
* Polyfill for Object.assign
|
174
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
175
|
-
*/
|
176
|
-
if (typeof Object.assign != 'function') {
|
177
|
-
(function () {
|
178
|
-
Object.assign = function (target) {
|
179
|
-
'use strict';
|
180
|
-
if (target === undefined || target === null) {
|
181
|
-
throw new TypeError('Cannot convert undefined or null to object');
|
182
|
-
}
|
183
|
-
|
184
|
-
var output = Object(target);
|
185
|
-
for (var index = 1; index < arguments.length; index++) {
|
186
|
-
var source = arguments[index];
|
187
|
-
if (source !== undefined && source !== null) {
|
188
|
-
for (var nextKey in source) {
|
189
|
-
if (source.hasOwnProperty(nextKey)) {
|
190
|
-
output[nextKey] = source[nextKey];
|
191
|
-
}
|
192
|
-
}
|
193
|
-
}
|
194
|
-
}
|
195
|
-
return output;
|
196
|
-
};
|
197
|
-
})();
|
198
|
-
}
|
199
|
-
|
200
|
-
/**
|
201
|
-
* Polyfill for Array.from
|
202
|
-
*/
|
203
|
-
if (!Array.from) {
|
204
|
-
Array.from = function (object) {
|
205
|
-
'use strict';
|
206
|
-
return [].slice.call(object);
|
207
|
-
};
|
208
|
-
}
|
@@ -1,85 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "rails/generators"
|
4
|
-
require "generators/decidim/app_generator"
|
5
|
-
|
6
|
-
module Decidim
|
7
|
-
module Generators
|
8
|
-
# Generates a dummy test Rails app for the given library folder. It uses
|
9
|
-
# the `AppGenerator` class to actually generate the Rails app, so this
|
10
|
-
# generator only sets the path and some flags.
|
11
|
-
#
|
12
|
-
# The Rails app will be installed with some flags to disable git, tests,
|
13
|
-
# Gemfile and other options. Refer to the `create_dummy_app` method to see
|
14
|
-
# all the flags passed to the `AppGenerator` class, which is the one that
|
15
|
-
# actually generates the Rails app.
|
16
|
-
#
|
17
|
-
# Remember that, because of how generators work, actions are executed based
|
18
|
-
# on the definition order of the public methods.
|
19
|
-
class DummyGenerator < Rails::Generators::Base
|
20
|
-
desc "Generate dummy app for testing purposes"
|
21
|
-
|
22
|
-
class_option :dummy_app_path, type: :string,
|
23
|
-
desc: "The path where the dummy app will be installed"
|
24
|
-
class_option :skip_gemfile, type: :boolean,
|
25
|
-
default: false,
|
26
|
-
desc: "Don't generate a Gemfile for the application"
|
27
|
-
|
28
|
-
def source_paths
|
29
|
-
[
|
30
|
-
File.expand_path("templates", __dir__)
|
31
|
-
]
|
32
|
-
end
|
33
|
-
|
34
|
-
def cleanup
|
35
|
-
remove_directory_if_exists(dummy_app_path)
|
36
|
-
end
|
37
|
-
|
38
|
-
def create_dummy_app
|
39
|
-
Decidim::Generators::AppGenerator.start [
|
40
|
-
dummy_app_path,
|
41
|
-
"--path",
|
42
|
-
"../..",
|
43
|
-
"--app_const_base=DummyApplication",
|
44
|
-
"--recreate_db",
|
45
|
-
"--skip_gemfile=#{options[:skip_gemfile]}",
|
46
|
-
"--demo"
|
47
|
-
]
|
48
|
-
end
|
49
|
-
|
50
|
-
def decidim_dev
|
51
|
-
# TODO: Remove these after PhantomJS updates WebKit version (see YML and
|
52
|
-
# initializer comments)
|
53
|
-
template "autoprefixer.yml", "#{dummy_app_path}/config/autoprefixer.yml"
|
54
|
-
template "autoprefixer_initializer.rb", "#{dummy_app_path}/config/initializers/autoprefixer.rb"
|
55
|
-
|
56
|
-
template "no_animations.rb", "#{dummy_app_path}/app/middleware/no_animations.rb"
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_env
|
60
|
-
gsub_file "#{dummy_app_path}/config/environments/test.rb",
|
61
|
-
/allow_forgery_protection = (.*)/, "allow_forgery_protection = true"
|
62
|
-
|
63
|
-
inject_into_file "#{dummy_app_path}/config/environments/test.rb",
|
64
|
-
after: "allow_forgery_protection = true\n" do
|
65
|
-
<<~RUBY.gsub(/^ *\|/, "")
|
66
|
-
|
|
67
|
-
| # Inject middleware to disable CSS animations
|
68
|
-
| config.middleware.use NoAnimations
|
69
|
-
|
|
70
|
-
RUBY
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
private
|
75
|
-
|
76
|
-
def dummy_app_path
|
77
|
-
options[:dummy_app_path]
|
78
|
-
end
|
79
|
-
|
80
|
-
def remove_directory_if_exists(path)
|
81
|
-
remove_dir(path) if File.directory?(path)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# Loading the autoprefixer for WebKit browsers during tests will cause some
|
2
|
-
# tests to fail since parts of the UI are rendered differently. This is due to
|
3
|
-
# WebKit version used in PhantomJS that does not render some of the modern CSS
|
4
|
-
# features the same way as expected by the Foundation framework. For example,
|
5
|
-
# some elements are overlapping other elements which causes the elements to be
|
6
|
-
# inaccessible during the specific tests.
|
7
|
-
browsers:
|
8
|
-
- "Firefox > 2"
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module AutoprefixerRails
|
4
|
-
class Sprockets
|
5
|
-
singleton_class.send(:alias_method, :call_original, :call)
|
6
|
-
|
7
|
-
def self.call(input)
|
8
|
-
filename = input[:name]
|
9
|
-
|
10
|
-
# Disable autoprefixer for the graphiql-rails gem's assets because it
|
11
|
-
# breaks some of the API tests when the '-webkit' prefixes are applied to
|
12
|
-
# its CSS.
|
13
|
-
return if filename.match?(%r{^graphiql/.*})
|
14
|
-
|
15
|
-
call_original(input)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
# Disables CSS3 and jQuery animations
|
5
|
-
#
|
6
|
-
class NoAnimations
|
7
|
-
def initialize(app, _options = {})
|
8
|
-
@app = app
|
9
|
-
end
|
10
|
-
|
11
|
-
def call(env)
|
12
|
-
@status, @headers, @body = @app.call(env)
|
13
|
-
return [@status, @headers, @body] unless html?
|
14
|
-
response = Rack::Response.new([], @status, @headers)
|
15
|
-
|
16
|
-
@body.each { |fragment| response.write inject(fragment) }
|
17
|
-
@body.close if @body.respond_to?(:close)
|
18
|
-
|
19
|
-
response.finish
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def html?
|
25
|
-
@headers["Content-Type"] =~ /html/
|
26
|
-
end
|
27
|
-
|
28
|
-
def inject(fragment)
|
29
|
-
disable_animations = <<~JS
|
30
|
-
<script type="text/javascript">(typeof jQuery !== 'undefined') && (jQuery.fx.off = true);</script>
|
31
|
-
<style>
|
32
|
-
* {
|
33
|
-
-o-transition: none !important;
|
34
|
-
-moz-transition: none !important;
|
35
|
-
-ms-transition: none !important;
|
36
|
-
-webkit-transition: none !important;
|
37
|
-
transition: none !important;
|
38
|
-
-o-transform: none !important;
|
39
|
-
-moz-transform: none !important;
|
40
|
-
-ms-transform: none !important;
|
41
|
-
-webkit-transform: none !important;
|
42
|
-
transform: none !important;
|
43
|
-
-webkit-animation: none !important;
|
44
|
-
-moz-animation: none !important;
|
45
|
-
-o-animation: none !important;
|
46
|
-
-ms-animation: none !important;
|
47
|
-
animation: none !important;
|
48
|
-
}
|
49
|
-
</style>
|
50
|
-
JS
|
51
|
-
|
52
|
-
fragment.gsub(%r{</head>}, disable_animations + "</head>")
|
53
|
-
end
|
54
|
-
end
|