capybara_active_admin 0.3.2 → 0.3.3

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: b4c255bc74004f32015b353e3e06e0915d8bbc40b3109ad02cbe831eebb8b31f
4
- data.tar.gz: c20f9d6fc40394244c59a00ee41db8836286eb96bf766c14a8ac4042d6db868b
3
+ metadata.gz: e5e0ee49e0960bc3a5c3e92594431390718eaed7b46ab634422d6c7c51be233c
4
+ data.tar.gz: 94ea844aa767f0319abae52517bd56fc2ca46e887e88c74c243b46e101e466c5
5
5
  SHA512:
6
- metadata.gz: 7bcf06a3023243b731c03b26643e6007ab679830af7cf27db6962b5513ac11125f9a6573f78fa296e2eeced96ea9ebd3f7af20a55de35090e6611e9e91a3a6e1
7
- data.tar.gz: e307113050bcee41a41c1d1d4742b3fb5c904ae351977b3964d7c05897837b4a354d12453acacdb5edb29c5895d00f69a9d163f1b2e72248cf1dd81dd2d8a072
6
+ metadata.gz: 63a541769b989dc70172f98d35833e94a9693227f382d8d2d19df2318be90b711678b0cede99ac509715bfbe95d0315fd66d261501daa47df9f21603f2e1e3ac
7
+ data.tar.gz: 58fb5eee24078cfbe920c9171a36bffdeae16f25b18f4d74855242623cef63c84577ce6a89b9bd41cb76a3042f75809477891e33366e98af8ba47bfcbdc112f5
data/.gitignore CHANGED
@@ -16,4 +16,5 @@ Gemfile.lock
16
16
 
17
17
  # docs
18
18
  /docs/.vuepress/dist/
19
+ /docs/.vuepress/public/api/
19
20
  /node_modules/
data/.rubocop.yml CHANGED
@@ -4,6 +4,7 @@ AllCops:
4
4
  Exclude:
5
5
  - vendor/**/*
6
6
  - tmp/**/*
7
+ - docs/**/*
7
8
 
8
9
  # Capybara/RSpec uses have_ had_ as name convention for matchers.
9
10
  Naming/PredicateName:
data/.travis.yml CHANGED
@@ -29,9 +29,10 @@ jobs:
29
29
  script: bundle exec rake default
30
30
  - name: "Deploy documentation"
31
31
  stage: deploy
32
- install: skip
33
32
  before_script: yarn install
34
- script: yarn docs:build
33
+ script:
34
+ - bundle exec rake yard
35
+ - yarn docs:build
35
36
  deploy:
36
37
  provider: pages
37
38
  edge: true
data/CHANGELOG.md CHANGED
@@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.3.3] - 2020-04-17
10
+ ### Changed
11
+ - `batch_action_selector`, `click_batch_action` finds element by link text
12
+
13
+ ### Added
14
+ - `select_table_row`, `open_batch_action_menu` actions
15
+ - `have_batch_action` matcher
16
+ - tests for batch actions
17
+
9
18
  ## [0.3.2] - 2020-04-16
10
19
  ### Changed
11
20
  - remove model_name from table related DSL arguments
data/Gemfile CHANGED
@@ -14,6 +14,7 @@ gem 'rake', '~> 12.0'
14
14
  gem 'rspec-rails', '~> 4.0'
15
15
  gem 'rubocop', '~> 0.81.0', require: false
16
16
  gem 'system_test_html_screenshots', require: false
17
+ gem 'yard', require: false
17
18
 
18
19
  gem 'activeadmin', ENV.fetch('ACTIVE_ADMIN_VERSION', '~> 2.0'), require: false
19
20
  gem 'rails', ENV.fetch('RAILS_VERSION', '6.0.0')
data/Rakefile CHANGED
@@ -3,8 +3,16 @@
3
3
  require 'bundler/gem_tasks'
4
4
  require 'rspec/core/rake_task'
5
5
  require 'rubocop/rake_task'
6
+ require 'yard'
7
+ require 'yard/rake/yardoc_task'
6
8
 
7
9
  RSpec::Core::RakeTask.new(:spec)
8
10
  RuboCop::RakeTask.new(:rubocop)
11
+ YARD::Rake::YardocTask.new(:yard) do |task|
12
+ task.options += [
13
+ %(--output-dir=./docs/.vuepress/public/api/),
14
+ %(--title=Capybara Active Admin API Reference)
15
+ ]
16
+ end
9
17
 
10
18
  task default: [:rubocop, :spec]
@@ -5,6 +5,7 @@ module.exports = {
5
5
  themeConfig: {
6
6
  nav: [
7
7
  { text: 'Guide', link: '/guide/' },
8
+ { text: 'API Reference', link: '/api/', target: '_blank' },
8
9
  { text: 'GitHub', link: 'https://github.com/activeadmin-plugins/capybara_active_admin' }
9
10
  ]
10
11
  }
File without changes
@@ -8,8 +8,8 @@ require 'capybara/active_admin/actions/form'
8
8
  module Capybara
9
9
  module ActiveAdmin
10
10
  module Actions
11
- # Actions are interactions with page that change something.
12
- # Click, scroll, fill, clear, switch - all these are interactions.
11
+ # Actions are interactions with page that change something (click button, fill field, etc).
12
+ # Good method names starts with *click_*, *scroll_*, *fill_*, *clear_*, *switch_*, *open_*.
13
13
 
14
14
  include Actions::Layout
15
15
  include Actions::Table
@@ -16,14 +16,21 @@ module Capybara
16
16
  find(tab_header_link_selector, opts).click
17
17
  end
18
18
 
19
- def click_batch_action(title)
20
- find(batch_actions_button_selector).click
19
+ def click_batch_action(title, exact: true)
20
+ open_batch_action_menu
21
21
  within(dropdown_list_selector) do
22
- selector = batch_action_selector(title)
23
- find(selector).click
22
+ selector = batch_action_selector
23
+ opts = Util.options_with_text(title, exact: exact)
24
+ find(selector, opts).click
24
25
  end
25
26
  end
26
27
 
28
+ def open_batch_action_menu
29
+ return if find_all(dropdown_list_selector).present?
30
+
31
+ find(batch_actions_button_selector).click
32
+ end
33
+
27
34
  def confirm_modal_dialog
28
35
  within_modal_dialog { click_button 'OK' }
29
36
  end
@@ -4,6 +4,18 @@ module Capybara
4
4
  module ActiveAdmin
5
5
  module Actions
6
6
  module Table
7
+ def select_table_row(id: nil, index: nil)
8
+ raise ArgumentError, "can't use both :id and :index" if id && index
9
+ raise ArgumentError, 'must provide :id or :index' if id.nil? && index.nil?
10
+
11
+ if id
12
+ find("input#batch_action_item_#{id}").click
13
+ return
14
+ end
15
+
16
+ selector = %(input[id^="batch_action_item_"])
17
+ find_all(selector, minimum: index + 1)[index].click
18
+ end
7
19
  end
8
20
  end
9
21
  end
@@ -38,6 +38,12 @@ module Capybara
38
38
  opts = Util.options_with_text(title, options)
39
39
  have_selector(title_selector, opts)
40
40
  end
41
+
42
+ def have_batch_action(title, exact: true)
43
+ selector = "#{dropdown_list_selector} #{batch_action_selector}"
44
+ opts = Util.options_with_text(title, exact: exact)
45
+ have_selector(selector, opts)
46
+ end
41
47
  end
42
48
  end
43
49
  end
@@ -73,8 +73,8 @@ module Capybara
73
73
  end
74
74
 
75
75
  # @return [String] selector.
76
- def batch_action_selector(title)
77
- "li a[data-action='#{title}']"
76
+ def batch_action_selector
77
+ 'li a[data-action]'
78
78
  end
79
79
 
80
80
  # @return [String] selector.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Capybara
4
4
  module ActiveAdmin
5
- VERSION = '0.3.2'
5
+ VERSION = '0.3.3'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara_active_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Talakevich
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-16 00:00:00.000000000 Z
11
+ date: 2020-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeadmin
@@ -58,8 +58,8 @@ files:
58
58
  - bin/console
59
59
  - bin/setup
60
60
  - capybara_active_admin.gemspec
61
- - deploy.sh
62
61
  - docs/.vuepress/config.js
62
+ - docs/.vuepress/public/.keep
63
63
  - docs/.vuepress/styles/index.styl
64
64
  - docs/README.md
65
65
  - docs/guide/README.md
data/deploy.sh DELETED
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env sh
2
-
3
- # abort on errors
4
- set -e
5
-
6
- # build
7
- npm run docs:build
8
-
9
- # navigate into the build output directory
10
- cd docs/.vuepress/dist
11
-
12
- git init
13
- git add -A
14
- git commit -m 'deploy'
15
-
16
- # deploying to https://activeadmin-plugins.github.io/capybara_active_admin
17
- git push -f git@github.com:activeadmin-plugins/capybara_active_admin.git master:gh-pages
18
-
19
- cd -