decidim-dev 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d907a768ba0d34e3c9f70697c6400e058dabb053
4
- data.tar.gz: 1e6def22abd3537676146e5d53135f12be0605b2
3
+ metadata.gz: e8ebbea7c935d9c967b51a080a0e21c86dfef127
4
+ data.tar.gz: ddba21fd8b94dcafa14affc8efb03c3d1d82865b
5
5
  SHA512:
6
- metadata.gz: ad67b96b3fb4774bcee3141bd4c9747ab7ca688fa2b5a54130d666b6a397dc014cd78aea5cebb23f73c204ec6622f2ff6213a88bdd628dfcd2ddea59b2843c1d
7
- data.tar.gz: 533f0d5005ff4f04ad69a021b50e17b54fcfd8d1fd70b730800e6f4d8e535c26185c343a7c7aff7f952a9b4145839782adc2216ddb00d9d7f0b3b9f3283698ef
6
+ metadata.gz: 6ad72dd60ff4aa43f48f239f06483d1eb2bfdcc231fcadb6f4cb97653834d9a04406d58a5b24019e912b87517db234fd6852c870a85fc2cc7f20aa9a5c90cc4f
7
+ data.tar.gz: 526f46f6500fc3588068c19725f3f172354835e1ab079aeac9831675a329e9e67f19bd75949e9e074972f74e821efdd388b8f84c5711b2db101bb9d728f14a64
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "letter_opener_web"
4
3
  require "decidim/dev/railtie"
5
4
 
6
5
  module Decidim
@@ -14,5 +13,28 @@ module Decidim
14
13
  def self.asset(name)
15
14
  File.expand_path(File.join(__dir__, "dev", "assets", name))
16
15
  end
16
+
17
+ # Public: add rake tasks
18
+ def self.install_tasks
19
+ Dir[File.join(__dir__, "../tasks/*.rake")].each do |file|
20
+ load file
21
+ end
22
+ end
23
+
24
+ # Public: Sets the dummy application path for testing.
25
+ #
26
+ # path - A string value defining the path.
27
+ def self.dummy_app_path=(path)
28
+ @dummy_app_path = path
29
+ end
30
+
31
+ # Public: Get the dummy application path and raises an error if it is not set.
32
+ def self.dummy_app_path
33
+ unless @dummy_app_path
34
+ raise StandardError, "Please, add Decidim::Dev::dummy_app_path = File.expand_path(File.join(\"..\", \"spec\", \"decidim_dummy_app\")) to\n
35
+ your spec helper with the path to the generated dummy app"
36
+ end
37
+ @dummy_app_path
38
+ end
17
39
  end
18
40
  end
@@ -2,6 +2,9 @@
2
2
 
3
3
  require "bundler/gem_tasks"
4
4
  require "rspec/core/rake_task"
5
+ require "decidim/dev"
5
6
 
6
7
  RSpec::Core::RakeTask.new(:spec)
7
8
  task default: [:spec]
9
+
10
+ Decidim::Dev.install_tasks
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "rails"
4
+
3
5
  module Decidim
4
6
  module Dev
5
7
  class Railtie < Rails::Railtie
6
8
  railtie_name :decidim_dev
7
9
 
8
10
  rake_tasks do
9
- Dir[File.join(__dir__, "../../tasks/*.rake")].each do |file|
10
- load file
11
- end
11
+ Decidim::Dev.install_tasks
12
12
  end
13
13
  end
14
14
  end
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "decidim/dev"
4
+
3
5
  ENV["RAILS_ENV"] ||= "test"
4
6
 
5
7
  root_path = File.expand_path("..", Dir.pwd)
6
8
  engine_spec_dir = File.join(Dir.pwd, "spec")
7
- dummy_app_path = File.expand_path(File.join(root_path, "spec", "decidim_dummy_app"))
8
9
 
9
10
  if ENV["SIMPLECOV"]
10
11
  require "simplecov"
@@ -35,10 +36,10 @@ require "decidim/core/test"
35
36
  require "#{__dir__}/rspec_support/feature.rb"
36
37
 
37
38
  begin
38
- require "#{dummy_app_path}/config/environment"
39
+ require "#{Decidim::Dev.dummy_app_path}/config/environment"
39
40
  rescue LoadError
40
41
  puts "Could not load dummy application. Please ensure you have run `bundle exec rake decidim:generate_test_app`"
41
- puts "Tried to load it from #{dummy_app_path}"
42
+ puts "Tried to load it from #{Decidim::Dev.dummy_app_path}"
42
43
  exit(-1)
43
44
  end
44
45
 
@@ -28,6 +28,9 @@ capybara_options = {
28
28
  ),
29
29
  File.expand_path(
30
30
  File.join(__dir__, "phantomjs_polyfills", "phantomjs-shim.js")
31
+ ),
32
+ File.expand_path(
33
+ File.join(__dir__, "phantomjs_polyfills", "phantomjs-getOwnPropertyNames.js")
31
34
  )
32
35
  ],
33
36
  js_errors: true,
@@ -35,6 +35,14 @@ module Decidim
35
35
  def reported_content_url
36
36
  ResourceLocatorPresenter.new(self).url
37
37
  end
38
+
39
+ def notifiable?(_context)
40
+ true
41
+ end
42
+
43
+ def users_to_notify
44
+ [author]
45
+ end
38
46
  end
39
47
 
40
48
  class DummyResourcesController < ActionController::Base
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RSpec.shared_context "feature" do
4
+ include Decidim::FeaturePathHelper
5
+
4
6
  let(:manifest) { Decidim.find_feature_manifest(manifest_name) }
5
7
 
6
8
  let(:user) { create :user, :confirmed, organization: organization }
@@ -26,7 +28,7 @@ RSpec.shared_context "feature" do
26
28
  end
27
29
 
28
30
  def visit_feature
29
- page.visit decidim.feature_path(participatory_process, feature)
31
+ page.visit feature_path(feature)
30
32
  end
31
33
  end
32
34
 
@@ -48,7 +50,7 @@ RSpec.shared_context "feature admin" do
48
50
  end
49
51
 
50
52
  def visit_feature_admin
51
- visit decidim_admin.manage_feature_path(participatory_process, feature)
53
+ visit manage_feature_path(feature)
52
54
  end
53
55
  end
54
56
 
@@ -1,13 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RSpec.configure do |config|
4
- config.before(:each) do
4
+ config.before(:suite) do
5
5
  # Set geocoder configuration in test mode
6
6
  Decidim.geocoder = {
7
- static_map_url: "http://www.example.org",
7
+ static_map_url: "https://www.example.org/my_static_map",
8
8
  here_app_id: "1234",
9
9
  here_app_code: "5678"
10
10
  }
11
11
  Geocoder.configure(lookup: :test)
12
12
  end
13
+
14
+ config.before(:each, :serves_map) do
15
+ stub_request(:get, %r{https://www\.example\.org/my_static_map})
16
+ .to_return(body: "map_data")
17
+ end
13
18
  end
@@ -0,0 +1,16 @@
1
+ var hasOwnProperty = Object.hasOwnProperty
2
+ var originalGetOwnPropertyNames = Object.getOwnPropertyNames
3
+ function getOwnPropertyNames (obj) {
4
+ var result = originalGetOwnPropertyNames.call(this, obj)
5
+ if (typeof obj !== 'function' || hasOwnProperty.call(obj, 'callee')) {
6
+ return result
7
+ }
8
+ return result.filter(function filterCallee (name) {
9
+ return name !== 'callee' && name !== 'arguments' && name !== 'caller';
10
+ })
11
+ };
12
+ Object.defineProperty(Object, 'getOwnPropertyNames', {
13
+ value: getOwnPropertyNames,
14
+ configurable: true,
15
+ writable: true
16
+ })
@@ -1,7 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ module Decidim
4
+ module WardenTestHelpers
5
+ include Warden::Test::Helpers
6
+
7
+ #
8
+ # Utility method to login in the middle of a test as a different user from
9
+ # the current one.
10
+ #
11
+ def relogin_as(user, scope: :user)
12
+ logout scope
13
+
14
+ login_as user, scope: scope
15
+ end
16
+ end
17
+ end
18
+
3
19
  RSpec.configure do |config|
4
- config.include Warden::Test::Helpers, type: :feature
20
+ config.include Decidim::WardenTestHelpers, type: :feature
5
21
  config.include Devise::Test::ControllerHelpers, type: :controller
6
22
 
7
23
  config.after :each, type: :feature do
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.3.2
4
+ version: 0.4.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-06-19 00:00:00.000000000 Z
13
+ date: 2017-07-12 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.3.2
21
+ version: 0.4.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.3.2
28
+ version: 0.4.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: factory_girl_rails
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -284,20 +284,6 @@ dependencies:
284
284
  - - "~>"
285
285
  - !ruby/object:Gem::Version
286
286
  version: 0.9.0
287
- - !ruby/object:Gem::Dependency
288
- name: letter_opener_web
289
- requirement: !ruby/object:Gem::Requirement
290
- requirements:
291
- - - "~>"
292
- - !ruby/object:Gem::Version
293
- version: 1.3.0
294
- type: :runtime
295
- prerelease: false
296
- version_requirements: !ruby/object:Gem::Requirement
297
- requirements:
298
- - - "~>"
299
- - !ruby/object:Gem::Version
300
- version: 1.3.0
301
287
  - !ruby/object:Gem::Dependency
302
288
  name: rspec-html-matchers
303
289
  requirement: !ruby/object:Gem::Requirement
@@ -332,14 +318,14 @@ dependencies:
332
318
  requirements:
333
319
  - - "~>"
334
320
  - !ruby/object:Gem::Version
335
- version: 3.8.2
321
+ version: 3.9.1
336
322
  type: :runtime
337
323
  prerelease: false
338
324
  version_requirements: !ruby/object:Gem::Requirement
339
325
  requirements:
340
326
  - - "~>"
341
327
  - !ruby/object:Gem::Version
342
- version: 3.8.2
328
+ version: 3.9.1
343
329
  description: Utilities and tools we need to develop Decidim
344
330
  email:
345
331
  - josepjaume@gmail.com
@@ -392,6 +378,7 @@ files:
392
378
  - lib/decidim/dev/test/rspec_support/helpers.rb
393
379
  - lib/decidim/dev/test/rspec_support/html_matchers.rb
394
380
  - lib/decidim/dev/test/rspec_support/i18n.rb
381
+ - lib/decidim/dev/test/rspec_support/phantomjs_polyfills/phantomjs-getOwnPropertyNames.js
395
382
  - lib/decidim/dev/test/rspec_support/phantomjs_polyfills/phantomjs-shim.js
396
383
  - lib/decidim/dev/test/rspec_support/phantomjs_polyfills/promise.js
397
384
  - lib/decidim/dev/test/rspec_support/translation_helpers.rb