simple_form-polymorphic_associations 0.0.1 → 0.0.2

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: e98a1dc07072ac897bf632c74242327a560fab12ded9bdc3d4652aa953af9599
4
- data.tar.gz: 59cfafaa342ddcbf322c28670c62eab39340f04cc6bac88d4a71484aba68d2bf
3
+ metadata.gz: 21eb301ad8e23b16a046addbe1317cd2186e56f3bfe84a55efc776aea4a80a53
4
+ data.tar.gz: 7dcd29e3e8f196de9b864e7078aa4c5b54c4cb33a84caa8ce25cd85936924bba
5
5
  SHA512:
6
- metadata.gz: 37f1f189f4532f767d1d8d756d2bf0a5a700fb65dc35f44f3a2cba1832fcfb649992cec72f6cb540c70c07cad8d5e1410052a323d5c3087b03d6246d7aed1c39
7
- data.tar.gz: 11eb85e005ed17ac0bc8c59d13882fc987146a3b5b0bb1af9c269edfcc8f56acf78d46b2ae9112129b137b819e799587a1452eba2bd289629389035cc0b1b008
6
+ metadata.gz: 4ba11da6f2849eb955a1a4c6d4bcc44c32f277af6f0c839462e4f4d5e2436c8089a728c02cc41123b3eeaf3ebddf288a61fd2bd40763ea2bdebcc3aa6e803837
7
+ data.tar.gz: ff11030145dd42a9708eac2ebe875873c1a50254d8adfd07c009cb0406c2ff30b0ceb28d931f297263ef7d24b30b779085986a2b1a18f9de7f5530096f42f843
@@ -4,7 +4,7 @@ module SimpleFormPolymorphicAssociations
4
4
  #
5
5
  # # app/controllers/people_controller.rb
6
6
  # class PeopleController < ApplicationController
7
- # include SimpleFormPolymorphicAssociations::AutocompleteConcern
7
+ # include SimpleFormPolymorphicAssociations::Controller::AutocompleteConcern
8
8
  # end
9
9
  #
10
10
  module AutocompleteConcern
@@ -4,7 +4,8 @@ module SimpleFormPolymorphicAssociations
4
4
  #
5
5
  # # app/models/person.rb
6
6
  # class Person < ActiveRecord::Base
7
- # include SimpleFormPolymorphicAssociations::AutocompleteConcern
7
+ # include SimpleFormPolymorphicAssociations::Model::AutocompleteConcern
8
+ #
8
9
  # autocomplete scope: ->(matcher) { where("people.firstname LIKE :term", term: "%#{matcher.downcase}%") }, id_method: :id, text_method: :human
9
10
  # end
10
11
  #
@@ -0,0 +1,39 @@
1
+ module SimpleFormPolymorphicAssociations
2
+ module SpecHelpers
3
+ # Usage:
4
+ #
5
+ # # spec/support/simple_form-polymorphic_associations.rb
6
+ # require "simple_form-polymorphic_associations/spec_helpers/system"
7
+ #
8
+ # RSpec.configure do |config|
9
+ # config.include SimpleFormPolymorphicAssociations::SpecHelpers::System, type: :system
10
+ # end
11
+ #
12
+ module System
13
+ # Usage:
14
+ #
15
+ # # spec/system/projects_spec.rb
16
+ # require "rails_helper"
17
+ #
18
+ # RSpec.describe "Projects", type: :system, js: true do
19
+ # let(:user) { create(:user) }
20
+ #
21
+ # before(:each) { user }
22
+ #
23
+ # it do
24
+ # visit "/projects/new"
25
+ # polymorphic_select(user, :name, from: "project[owner_id]")
26
+ # find("input[type='submit']").click
27
+ # end
28
+ # end
29
+ #
30
+ def polymorphic_select(record, label_method, options)
31
+ select record.class.model_name.human, from: options[:from].gsub(/_id]$/, "_type]")
32
+ first(".select2-container", minimum: 1).click
33
+ find(".select2-search--dropdown input.select2-search__field").send_keys(user.send(label_method))
34
+ sleep(1)
35
+ find(".select2-search--dropdown input.select2-search__field").send_keys(:enter)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimpleFormPolymorphicAssociations
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form-polymorphic_associations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-03 00:00:00.000000000 Z
11
+ date: 2023-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simple_form
@@ -42,6 +42,7 @@ files:
42
42
  - config/initializers/assets.rb
43
43
  - lib/simple_form-polymorphic_associations.rb
44
44
  - lib/simple_form-polymorphic_associations/engine.rb
45
+ - lib/simple_form-polymorphic_associations/spec_helpers/system.rb
45
46
  - lib/simple_form-polymorphic_associations/version.rb
46
47
  homepage:
47
48
  licenses:
@@ -62,8 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
63
  - !ruby/object:Gem::Version
63
64
  version: '0'
64
65
  requirements: []
65
- rubyforge_project:
66
- rubygems_version: 2.7.8
66
+ rubygems_version: 3.4.21
67
67
  signing_key:
68
68
  specification_version: 4
69
69
  summary: Simple Form polymorphic associations.