decidim-dev 0.11.0.pre1 → 0.11.1

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
  SHA256:
3
- metadata.gz: 9171c34e3282c88b4b8e0748a97343f388437a64629b80acf91432264d0709b1
4
- data.tar.gz: 1fc4489eb4a2cf79f143e7d43be039d567d1f38e3f2294634c218120bee1f376
3
+ metadata.gz: f1aecf93329cc872b1ec4be35eaf6b4c4bb43e08443aabd28b97f02e4b525719
4
+ data.tar.gz: 65d9e292404309eda93c0ac388a8d0256936f3ca75c010e0693cde78e51de9b8
5
5
  SHA512:
6
- metadata.gz: d777634bde596747205583c0ff2a388ae95025f62556fb65cadb748fe440df6505043725bbe7fcd391fd311c8066fd40aa357f0984bee99fc076072ab966198b
7
- data.tar.gz: a3760dc6059796ec870bcb3b2189d95f217d1b8820909aca0027f74eb41af51c6a85c4eddd9fba18830f18b754ae1a49fe207b5d29c1cf99205db224cbdb8df9
6
+ metadata.gz: 33a502b3255a9545127ec36f1dfa569525502f7b2bc61b22f748b5f6da19dda6903be9711e859950319fdbf6bd96a00887be64ef4ee4229f78370df235de556b
7
+ data.tar.gz: 48523bdb8c91471233b16bf4c28e1d4cd1388a50436d68790c42fee96cc23c4a1694e60fe676e30c596450185f2c8f6d76717303795d5e7251976426649e677f
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Capybara
4
+ module DataPicker
5
+ def select_data_picker(id, multiple: nil, global_value: "")
6
+ Struct.new(:data_picker, :global_value).new(find_data_picker(id, multiple: multiple), global_value)
7
+ end
8
+
9
+ private
10
+
11
+ def find_data_picker(id, multiple: nil)
12
+ if multiple.nil?
13
+ expect(page).to have_selector("div.data-picker##{id}")
14
+ else
15
+ expect(page).to have_selector("div.data-picker.picker-#{multiple ? "multiple" : "single"}##{id}")
16
+ end
17
+ find("div.data-picker##{id}")
18
+ end
19
+
20
+ def data_picker_pick_current
21
+ body = find(:xpath, "//body")
22
+ expect(body).to have_selector("#data_picker-modal .picker-footer a[data-picker-choose]")
23
+ body.find("#data_picker-modal .picker-footer a[data-picker-choose]").click
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "capybara_data_picker"
4
+
5
+ module Capybara
6
+ module ProposalsPicker
7
+ include DataPicker
8
+
9
+ RSpec::Matchers.define :have_data_picked do |expected, text|
10
+ match do |data_picker|
11
+ data_picker_elem = data_picker.data_picker
12
+ expect(data_picker_elem).to have_selector(".picker-values div input[value='#{expected&.id || data_picker.global_value}']", visible: false)
13
+ expect(data_picker_elem).to have_selector(:xpath, "//div[contains(@class,'picker-values')]/div/a[text()[contains(.,'#{text}')]]")
14
+ end
15
+ end
16
+
17
+ def proposal_pick(proposal_picker, proposal)
18
+ data_picker = proposal_picker.data_picker
19
+ # use scope_repick to change single scope picker selected scope
20
+ expect(data_picker).to have_selector(".picker-values:empty", visible: false) if data_picker.has_css?(".picker-single")
21
+
22
+ expect(data_picker).to have_selector(".picker-prompt")
23
+ data_picker.find(".picker-prompt").click
24
+
25
+ proposal_picker_search_perform(proposal.title)
26
+ proposal_picker_search_choose_result(proposal.id)
27
+ data_picker_pick_current
28
+
29
+ expect(proposal_picker).to have_data_picked(proposal, proposal.title)
30
+ end
31
+
32
+ private
33
+
34
+ def proposal_picker_search_perform(term)
35
+ body = find(:xpath, "//body")
36
+ input_selector = "#data_picker-modal .picker-content input#data_picker-autocomplete"
37
+ expect(body).to have_selector(input_selector)
38
+ body.find("#data_picker-modal .picker-content").fill_in("data_picker-autocomplete", with: term)
39
+ end
40
+
41
+ def proposal_picker_search_choose_result(proposal_id)
42
+ body = find(:xpath, "//body")
43
+ expect(body).to have_selector(".autocomplete-suggestions .autocomplete-suggestion")
44
+ body.find(".autocomplete-suggestions div.autocomplete-suggestion[data-model-id='#{proposal_id}']").click
45
+ end
46
+ end
47
+ end
48
+
49
+ RSpec.configure do |config|
50
+ config.include Capybara::ProposalsPicker, type: :system
51
+ end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "capybara_data_picker"
4
+
3
5
  module Capybara
4
6
  module ScopesPicker
5
- def scopes_picker_find(id, multiple: nil, global_value: "")
6
- Struct.new(:data_picker, :global_value).new(data_picker_find(id, multiple: multiple), global_value)
7
- end
7
+ include DataPicker
8
8
 
9
9
  RSpec::Matchers.define :have_scope_picked do |expected|
10
10
  match do |scope_picker|
@@ -33,7 +33,7 @@ module Capybara
33
33
  data_picker.find(".picker-prompt").click
34
34
 
35
35
  scope_picker_browse_scopes(scope.part_of_scopes) if scope
36
- scope_picker_pick_current
36
+ data_picker_pick_current
37
37
 
38
38
  expect(scope_picker).to have_scope_picked(scope)
39
39
  end
@@ -49,7 +49,7 @@ module Capybara
49
49
 
50
50
  scope_picker_browse_scope(parent_scope, back: true)
51
51
  scope_picker_browse_scopes(new_scope.part_of_scopes - old_scope.part_of_scopes)
52
- scope_picker_pick_current
52
+ data_picker_pick_current
53
53
 
54
54
  expect(scope_picker).to have_scope_picked(new_scope)
55
55
  end
@@ -65,15 +65,6 @@ module Capybara
65
65
 
66
66
  private
67
67
 
68
- def data_picker_find(id, multiple: nil)
69
- if multiple.nil?
70
- expect(page).to have_selector("div.data-picker##{id}")
71
- else
72
- expect(page).to have_selector("div.data-picker.picker-#{multiple ? "multiple" : "single"}##{id}")
73
- end
74
- find("div.data-picker##{id}")
75
- end
76
-
77
68
  def scope_picker_browse_scopes(scopes)
78
69
  scopes.each do |scope|
79
70
  scope_picker_browse_scope(scope)
@@ -87,12 +78,6 @@ module Capybara
87
78
  expect(body).to have_selector("#data_picker-modal .picker-#{where} a", text: scope_name)
88
79
  body.find("#data_picker-modal .picker-#{where} a", text: scope_name).click
89
80
  end
90
-
91
- def scope_picker_pick_current
92
- body = find(:xpath, "//body")
93
- expect(body).to have_selector("#data_picker-modal .picker-footer a[data-picker-choose]")
94
- body.find("#data_picker-modal .picker-footer a[data-picker-choose]").click
95
- end
96
81
  end
97
82
  end
98
83
 
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-dev version.
5
5
  module Dev
6
6
  def self.version
7
- "0.11.0.pre1"
7
+ "0.11.1"
8
8
  end
9
9
  end
10
10
  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.11.0.pre1
4
+ version: 0.11.1
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: 2018-04-26 00:00:00.000000000 Z
13
+ date: 2018-05-14 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.11.0.pre1
35
+ version: 0.11.1
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.11.0.pre1
42
+ version: 0.11.1
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: factory_bot_rails
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -337,6 +337,8 @@ files:
337
337
  - lib/decidim/dev/test/rspec_support/attachments.rb
338
338
  - lib/decidim/dev/test/rspec_support/authorization.rb
339
339
  - lib/decidim/dev/test/rspec_support/capybara.rb
340
+ - lib/decidim/dev/test/rspec_support/capybara_data_picker.rb
341
+ - lib/decidim/dev/test/rspec_support/capybara_proposals_picker.rb
340
342
  - lib/decidim/dev/test/rspec_support/capybara_scopes_picker.rb
341
343
  - lib/decidim/dev/test/rspec_support/comments.rb
342
344
  - lib/decidim/dev/test/rspec_support/component.rb
@@ -371,9 +373,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
371
373
  version: '2.3'
372
374
  required_rubygems_version: !ruby/object:Gem::Requirement
373
375
  requirements:
374
- - - ">"
376
+ - - ">="
375
377
  - !ruby/object:Gem::Version
376
- version: 1.3.1
378
+ version: '0'
377
379
  requirements: []
378
380
  rubyforge_project:
379
381
  rubygems_version: 2.7.3