decidim-dev 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -0
- data/app/assets/images/decidim/dummy.svg +4 -0
- data/config/i18n-tasks.yml +3 -1
- data/config/locales/ca.yml +4 -0
- data/config/locales/en.yml +4 -0
- data/config/locales/es.yml +4 -0
- data/config/locales/eu.yml +4 -0
- data/lib/decidim/dev/common_rake.rb +2 -5
- data/lib/decidim/dev/dummy_authorization_handler.rb +1 -0
- data/lib/decidim/dev/railtie.rb +1 -0
- data/lib/decidim/dev/test/authorization_shared_examples.rb +1 -0
- data/lib/decidim/dev/test/base_spec_helper.rb +2 -1
- data/lib/decidim/dev/test/{i18n_spec.rb → i18n_shared_examples.rb} +9 -6
- data/lib/decidim/dev/test/rspec_support/action_mailer.rb +1 -0
- data/lib/decidim/dev/test/rspec_support/authenticated_controller_context.rb +1 -0
- data/lib/decidim/dev/test/rspec_support/authorization_handlers.rb +1 -0
- data/lib/decidim/dev/test/rspec_support/capybara.rb +3 -3
- data/lib/decidim/dev/test/rspec_support/database_cleaner.rb +1 -0
- data/lib/decidim/dev/test/rspec_support/engine_routes.rb +1 -0
- data/lib/decidim/dev/test/rspec_support/factory_girl.rb +1 -0
- data/lib/decidim/dev/test/rspec_support/feature.rb +30 -0
- data/lib/decidim/dev/test/rspec_support/feature_context.rb +1 -0
- data/lib/decidim/dev/test/rspec_support/geocoder.rb +1 -0
- data/lib/decidim/dev/test/rspec_support/html_matchers.rb +1 -0
- data/lib/decidim/dev/test/rspec_support/i18n.rb +1 -0
- data/lib/decidim/dev/test/rspec_support/translation_helpers.rb +1 -0
- data/lib/decidim/dev/test/rspec_support/warden.rb +1 -0
- data/lib/decidim/dev/test/rspec_support/webmock.rb +1 -0
- data/lib/decidim/dev/test/rspec_support/wisper.rb +1 -0
- data/lib/decidim/dev/test/spec_helper.rb +1 -0
- data/lib/generators/decidim/dummy_generator.rb +3 -6
- data/lib/generators/decidim/templates/autoprefixer_initializer.rb +2 -1
- data/lib/generators/decidim/templates/decidim_dev.rb +1 -0
- data/lib/tasks/locale_checker.rake +21 -0
- data/lib/tasks/test_app.rake +1 -2
- metadata +19 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12dcf714d8a9abfc804e8544ac8d2211fd935a74
|
4
|
+
data.tar.gz: a3dd5baa0335e8d6e9a5a2c6ba8b96de3b45f962
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2e1ea0f488ab105d567d35dfdda55e82fa15f7098e53e77c8774a954454926e0b208d2eb39c9e6c889383a4a7b728b58648cb97647df581b980b06d9feb94e3
|
7
|
+
data.tar.gz: da77423932d049cc22901275eeed03c528c41191f24040a668ae626d80a6a7e5f480c42951babff39605f320c5304f20fefa5c636f6447e5ef72ad7486a6d578
|
data/Rakefile
CHANGED
data/config/i18n-tasks.yml
CHANGED
data/config/locales/ca.yml
CHANGED
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
data/config/locales/eu.yml
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "bundler/gem_tasks"
|
3
4
|
require "rspec/core/rake_task"
|
4
5
|
|
5
|
-
RSpec::Core::RakeTask.new(:spec)
|
6
|
-
# The i18n_spec part needs to go first or it won't be include. It seems like a
|
7
|
-
# bug in RSpec to me... https://github.com/rspec/rspec-core/issues/2418
|
8
|
-
t.rspec_opts = "--pattern #{__dir__}/test/i18n_spec.rb,**/*_spec.rb"
|
9
|
-
end
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
10
7
|
task default: [:spec]
|
data/lib/decidim/dev/railtie.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
ENV["RAILS_ENV"] ||= "test"
|
3
4
|
|
4
5
|
root_path = File.join(Dir.pwd, "..")
|
@@ -17,7 +18,7 @@ if ENV["SIMPLECOV"]
|
|
17
18
|
add_filter "/vendor/"
|
18
19
|
|
19
20
|
add_filter do |src|
|
20
|
-
|
21
|
+
src.filename !~ /^#{root_path}/
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
@@ -1,19 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "i18n/tasks"
|
3
4
|
|
4
|
-
RSpec.
|
5
|
-
let(:
|
5
|
+
RSpec.shared_examples_for "I18n sanity" do
|
6
|
+
let(:locales) do
|
7
|
+
ENV["ENFORCED_LOCALES"].present? ? ENV["ENFORCED_LOCALES"].split(",") : [:en]
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:i18n) { I18n::Tasks::BaseTask.new(locales: locales) }
|
6
11
|
let(:missing_keys) { i18n.missing_keys }
|
7
12
|
let(:unused_keys) { i18n.unused_keys }
|
8
13
|
|
9
14
|
it "does not have missing keys" do
|
10
|
-
expect(missing_keys).to be_empty,
|
11
|
-
"Missing #{missing_keys.leaves.count} i18n keys, run `i18n-tasks missing` to show them"
|
15
|
+
expect(missing_keys).to be_empty, "#{missing_keys.inspect} are missing"
|
12
16
|
end
|
13
17
|
|
14
18
|
it "does not have unused keys" do
|
15
|
-
expect(unused_keys).to be_empty,
|
16
|
-
"#{unused_keys.leaves.count} unused i18n keys, run `i18n-tasks unused` to show them"
|
19
|
+
expect(unused_keys).to be_empty, "#{unused_keys.inspect} are unused"
|
17
20
|
end
|
18
21
|
|
19
22
|
it "is normalized" do
|
@@ -7,7 +7,7 @@ module Decidim
|
|
7
7
|
# Helpers meant to be used only during capybara test runs.
|
8
8
|
module CapybaraTestHelpers
|
9
9
|
def switch_to_host(host = "lvh.me")
|
10
|
-
unless /lvh\.me
|
10
|
+
unless /lvh\.me$/.match?(host)
|
11
11
|
raise "Can't switch to a custom host unless it really exists. Use `whatever.lvh.me` as a workaround."
|
12
12
|
end
|
13
13
|
|
@@ -31,7 +31,8 @@ capybara_options = {
|
|
31
31
|
)
|
32
32
|
],
|
33
33
|
js_errors: true,
|
34
|
-
url_whitelist: ["http://*.lvh.me", "localhost", "127.0.0.1"]
|
34
|
+
url_whitelist: ["http://*.lvh.me", "localhost", "127.0.0.1"],
|
35
|
+
timeout: 1.minute
|
35
36
|
}
|
36
37
|
|
37
38
|
Capybara.register_driver :poltergeist do |app|
|
@@ -48,7 +49,6 @@ Capybara::Screenshot::RSpec.add_link_to_screenshot_for_failed_examples = true
|
|
48
49
|
Capybara.configure do |config|
|
49
50
|
config.always_include_port = true
|
50
51
|
config.default_driver = :poltergeist
|
51
|
-
config.always_include_port = true
|
52
52
|
end
|
53
53
|
|
54
54
|
RSpec.configure do |config|
|
@@ -14,6 +14,14 @@ module Decidim
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
class DummyAdminEngine < Rails::Engine
|
18
|
+
engine_name "dummy_admin"
|
19
|
+
|
20
|
+
routes do
|
21
|
+
root to: proc { [200, {}, ["DUMMY ADMIN ENGINE"]] }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
17
25
|
class DummyResource < ActiveRecord::Base
|
18
26
|
include HasFeature
|
19
27
|
include Resourceable
|
@@ -45,8 +53,22 @@ module Decidim
|
|
45
53
|
end
|
46
54
|
end
|
47
55
|
|
56
|
+
class DummySerializer
|
57
|
+
def initialize(id)
|
58
|
+
@id = id
|
59
|
+
end
|
60
|
+
|
61
|
+
def serialize
|
62
|
+
{
|
63
|
+
id: @id
|
64
|
+
}
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
48
68
|
Decidim.register_feature(:dummy) do |feature|
|
49
69
|
feature.engine = Decidim::DummyEngine
|
70
|
+
feature.admin_engine = Decidim::DummyAdminEngine
|
71
|
+
feature.icon = "decidim/dummy.svg"
|
50
72
|
|
51
73
|
feature.actions = %w(foo bar)
|
52
74
|
|
@@ -67,6 +89,14 @@ Decidim.register_feature(:dummy) do |feature|
|
|
67
89
|
resource.model_class_name = "Decidim::DummyResource"
|
68
90
|
resource.template = "decidim/dummy_resource/linked_dummys"
|
69
91
|
end
|
92
|
+
|
93
|
+
feature.exports :dummies do |exports|
|
94
|
+
exports.collection do
|
95
|
+
[1, 2, 3]
|
96
|
+
end
|
97
|
+
|
98
|
+
exports.serializer DummySerializer
|
99
|
+
end
|
70
100
|
end
|
71
101
|
|
72
102
|
RSpec.configure do |config|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "rails/generators"
|
3
4
|
require "generators/decidim/app_generator"
|
4
5
|
|
@@ -39,17 +40,13 @@ module Decidim
|
|
39
40
|
"--skip-bundle",
|
40
41
|
"--skip-git",
|
41
42
|
"--skip-keeps",
|
43
|
+
"--skip-listen",
|
44
|
+
"--skip-spring",
|
42
45
|
"--skip-test",
|
43
46
|
"--recreate_db"
|
44
47
|
]
|
45
48
|
end
|
46
49
|
|
47
|
-
def set_locales
|
48
|
-
inject_into_file "#{dummy_app_path}/config/application.rb", after: "class Application < Rails::Application" do
|
49
|
-
"\n config.i18n.available_locales = %w(en ca es)\n config.i18n.default_locale = :en"
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
50
|
def decidim_dev
|
54
51
|
template "decidim_dev.rb", "#{dummy_app_path}/config/initializers/decidim_dev.rb"
|
55
52
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module AutoprefixerRails
|
3
4
|
class Sprockets
|
4
5
|
singleton_class.send(:alias_method, :call_original, :call)
|
@@ -9,7 +10,7 @@ module AutoprefixerRails
|
|
9
10
|
# Disable autoprefixer for the graphiql-rails gem's assets because it
|
10
11
|
# breaks some of the API tests when the '-webkit' prefixes are applied to
|
11
12
|
# its CSS.
|
12
|
-
return if filename
|
13
|
+
return if filename.match?(%r{^graphiql/.*})
|
13
14
|
|
14
15
|
call_original(input)
|
15
16
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :decidim do
|
4
|
+
desc "Allows a decidim installation to check whether its locales are complete"
|
5
|
+
task :check_locales do
|
6
|
+
env = {
|
7
|
+
"BUNDLE_GEMFILE" => File.expand_path("Gemfile"),
|
8
|
+
"ENFORCED_LOCALES" => Decidim.available_locales.join(",")
|
9
|
+
}
|
10
|
+
|
11
|
+
Bundler.definition.specs.each do |spec|
|
12
|
+
next unless spec.name.match?(/decidim-/)
|
13
|
+
|
14
|
+
Dir.chdir(spec.full_gem_path) do
|
15
|
+
Bundler.with_clean_env do
|
16
|
+
system(env, "bundle exec rspec spec/i18n_spec.rb")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/tasks/test_app.rake
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.
|
4
|
+
version: 0.2.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: 2017-
|
13
|
+
date: 2017-06-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: decidim
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.2.0
|
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: 0.
|
28
|
+
version: 0.2.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: factory_girl_rails
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -46,28 +46,28 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 1.
|
49
|
+
version: 1.6.0
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 1.
|
56
|
+
version: 1.6.0
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: capybara
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 2.
|
63
|
+
version: 2.14.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: 2.
|
70
|
+
version: 2.14.0
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: capybara-screenshot
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
@@ -172,14 +172,14 @@ dependencies:
|
|
172
172
|
requirements:
|
173
173
|
- - '='
|
174
174
|
- !ruby/object:Gem::Version
|
175
|
-
version: 0.9.
|
175
|
+
version: 0.9.15
|
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: 0.9.
|
182
|
+
version: 0.9.15
|
183
183
|
- !ruby/object:Gem::Dependency
|
184
184
|
name: faker
|
185
185
|
requirement: !ruby/object:Gem::Requirement
|
@@ -200,14 +200,14 @@ dependencies:
|
|
200
200
|
requirements:
|
201
201
|
- - "~>"
|
202
202
|
- !ruby/object:Gem::Version
|
203
|
-
version: 1.
|
203
|
+
version: 1.15.0
|
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: 1.
|
210
|
+
version: 1.15.0
|
211
211
|
- !ruby/object:Gem::Dependency
|
212
212
|
name: rails-controller-testing
|
213
213
|
requirement: !ruby/object:Gem::Requirement
|
@@ -256,28 +256,28 @@ dependencies:
|
|
256
256
|
requirements:
|
257
257
|
- - "~>"
|
258
258
|
- !ruby/object:Gem::Version
|
259
|
-
version: 0.
|
259
|
+
version: 0.49.0
|
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: 0.
|
266
|
+
version: 0.49.0
|
267
267
|
- !ruby/object:Gem::Dependency
|
268
268
|
name: db-query-matchers
|
269
269
|
requirement: !ruby/object:Gem::Requirement
|
270
270
|
requirements:
|
271
271
|
- - "~>"
|
272
272
|
- !ruby/object:Gem::Version
|
273
|
-
version: 0.
|
273
|
+
version: 0.9.0
|
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: 0.
|
280
|
+
version: 0.9.0
|
281
281
|
- !ruby/object:Gem::Dependency
|
282
282
|
name: letter_opener_web
|
283
283
|
requirement: !ruby/object:Gem::Requirement
|
@@ -331,6 +331,7 @@ extra_rdoc_files: []
|
|
331
331
|
files:
|
332
332
|
- README.md
|
333
333
|
- Rakefile
|
334
|
+
- app/assets/images/decidim/dummy.svg
|
334
335
|
- app/views/decidim/dummy_resource/_linked_dummys.html.erb
|
335
336
|
- config/i18n-tasks.yml
|
336
337
|
- config/locales/ca.yml
|
@@ -355,7 +356,7 @@ files:
|
|
355
356
|
- lib/decidim/dev/railtie.rb
|
356
357
|
- lib/decidim/dev/test/authorization_shared_examples.rb
|
357
358
|
- lib/decidim/dev/test/base_spec_helper.rb
|
358
|
-
- lib/decidim/dev/test/
|
359
|
+
- lib/decidim/dev/test/i18n_shared_examples.rb
|
359
360
|
- lib/decidim/dev/test/rspec_support/action_mailer.rb
|
360
361
|
- lib/decidim/dev/test/rspec_support/active_job.rb
|
361
362
|
- lib/decidim/dev/test/rspec_support/authenticated_controller_context.rb
|
@@ -381,6 +382,7 @@ files:
|
|
381
382
|
- lib/generators/decidim/templates/autoprefixer.yml
|
382
383
|
- lib/generators/decidim/templates/autoprefixer_initializer.rb
|
383
384
|
- lib/generators/decidim/templates/decidim_dev.rb
|
385
|
+
- lib/tasks/locale_checker.rake
|
384
386
|
- lib/tasks/test_app.rake
|
385
387
|
homepage: https://github.com/decidim/decidim
|
386
388
|
licenses:
|