magicka 0.5.6 → 0.6.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
  SHA256:
3
- metadata.gz: 2b014302f0498ecea2e69670c168bdf2ee5eaaa8162b210faf007351d4417976
4
- data.tar.gz: 1ee57425d99ce223334f9567156ff1ab791f78e6f043c9ae5adca87291e28f1b
3
+ metadata.gz: 89c43463111b2c2105250a275a53b80861b06ad90881585c2928174728931567
4
+ data.tar.gz: 4c9f0a23503fc925cd60657706797e37596ae6e11b8e6d78c2e082124a0cbc78
5
5
  SHA512:
6
- metadata.gz: 37e81304adc719f63fd65d3a643d2392cca27fdce94489072f675571b440815f074e9bf5613bf365dae1b8f26edc24cdf4a564d8821e69a49d4419488bf7cd0c
7
- data.tar.gz: 20b572511516fd8af749499059b2d14d01bf0047fbe3b509304b4c117032b617427aa84d7389ed400aa5b9acfb0d6c6dff539cd67e448b55e0c25dd5582f17ab
6
+ metadata.gz: ce20ae0d689c937f5c414288eeb493c3438c1f592f557286747fd9879c742288391a7cf619def37cfbb9d02a059572b77a1c13841ee34a8ae7d92536d7c58786
7
+ data.tar.gz: c665834d06f7ab392b350045279d062a3fdb6f66e008907c22cf0a221eed8b4c5af353a93501fabf156d19837984351f12b16c55c4def4b79dbb69f7b40f10a2
data/README.md CHANGED
@@ -14,7 +14,7 @@ such as AngulaJS
14
14
 
15
15
  Yard Documentation
16
16
  -------------------
17
- [https://www.rubydoc.info/gems/magicka/0.5.6](https://www.rubydoc.info/gems/magicka/0.5.6)
17
+ [https://www.rubydoc.info/gems/magicka/0.6.0](https://www.rubydoc.info/gems/magicka/0.6.0)
18
18
 
19
19
  Installation
20
20
  ---------------
@@ -66,7 +66,11 @@ different ways
66
66
  <%= form.input(:last_name) %>
67
67
  <%= form.input(:age) %>
68
68
  <%= form.select(:gender, options: %w[MALE FEMALE] %>
69
- <%= form.button(ng_click: 'controller.save', text: 'Save') %>
69
+
70
+ <%= form.only(:form) do %>
71
+ <!-- this block only appears in a form -->
72
+ <%= form.button(ng_click: 'controller.save', text: 'Save') %>
73
+ <% end %>
70
74
  ```
71
75
 
72
76
  ## Configuring
@@ -1,5 +1,7 @@
1
1
  ignore:
2
2
  - lib/magicka/version.rb
3
3
  - lib/magicka.rb
4
+ - lib/magicka/aggregator/class_methods.rb
4
5
  - lib/magicka/aggregator/method_builder.rb
5
- - lib/magicka/helper.rb
6
+ - lib/magicka/helper/class_methods.rb
7
+ - lib/magicka/helper/method_builder.rb
data/config/yardstick.yml CHANGED
@@ -1,4 +1,4 @@
1
- threshold: 84.1
1
+ threshold: 90.0
2
2
  require_exact_threshold: false
3
3
  rules:
4
4
  ApiTag::Presence:
@@ -23,6 +23,8 @@ rules:
23
23
  enabled: true
24
24
  exclude:
25
25
  - Magicka::Element#initialize
26
+ - Magicka::Aggregator#initialize
27
+ - Magicka::Aggregator::MethodBuilder#initialize
26
28
  Summary::Length:
27
29
  enabled: true
28
30
  exclude: []
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Magicka
4
+ class Aggregator
5
+ # Class methods for {Magicka::Aggregator}
6
+ module ClassMethods
7
+ # (see Aggregator.with_element)
8
+ def with_element(element_class, method_name = nil, template: nil)
9
+ MethodBuilder
10
+ .new(self, element_class, method_name, template: template)
11
+ .prepare
12
+ .build
13
+ end
14
+
15
+ # Set and return the type of the aggregator
16
+ #
17
+ # When new_type is ommited, returns the last value
18
+ #
19
+ # @param new_type [Symbol,String] The value to be set
20
+ #
21
+ # @return [Symbol] the type of the aggregator
22
+ def type(new_type = nil)
23
+ return @type ||= default_type unless new_type
24
+
25
+ @type = new_type.to_sym
26
+ end
27
+
28
+ private
29
+
30
+ # @private
31
+ # @api private
32
+ #
33
+ # Default type when type is not defined
34
+ #
35
+ # Default type is extracted from class name
36
+ #
37
+ # @return [Symbol]
38
+ def default_type
39
+ name&.demodulize&.underscore&.to_sym
40
+ end
41
+ end
42
+ end
43
+ end
@@ -6,6 +6,13 @@ module Magicka
6
6
  #
7
7
  # Class responsible for building an {Aggregator} method
8
8
  class MethodBuilder < Sinclair
9
+ # @param klass [Class.new<Aggregator>]
10
+ # Aggragator class to receive the method
11
+ # @param element_class [Class<Magicka::ELement>]
12
+ # Class of the element to be rendered
13
+ # @param method_name [String,Symbol]
14
+ # Name of the method that will render the element
15
+ # @param template [String] custom template file to be used
9
16
  def initialize(klass, element_class, method_name = nil, template: nil)
10
17
  super(klass)
11
18
 
@@ -14,6 +21,9 @@ module Magicka
14
21
  @template = template
15
22
  end
16
23
 
24
+ # Prepare methods to be built
25
+ #
26
+ # @return [Aggregator::MethodBuilder] return self
17
27
  def prepare
18
28
  element_klass = element_class
19
29
  template_file = template
@@ -32,7 +42,28 @@ module Magicka
32
42
  private
33
43
 
34
44
  attr_reader :element_class, :template
45
+ # @method element_class
46
+ # @api private
47
+ # @private
48
+ #
49
+ # Class of the element to be rendered by the method
50
+ #
51
+ # @return [Class<Magicka::Element>]
35
52
 
53
+ # @method template
54
+ # @api private
55
+ # @private
56
+ #
57
+ # template file
58
+ #
59
+ # @return [String]
60
+
61
+ # name of the method to be generated
62
+ #
63
+ # When the method name was not supplied in the constructor,
64
+ # it is infered from {#element_class}
65
+ #
66
+ # @return [String,Symbol]
36
67
  def method_name
37
68
  @method_name ||= element_class
38
69
  .name
@@ -6,29 +6,86 @@ module Magicka
6
6
  # Class representing an element agregator, representing a model
7
7
  class Aggregator
8
8
  autoload :MethodBuilder, 'magicka/aggregator/method_builder'
9
+ autoload :ClassMethods, 'magicka/aggregator/class_methods'
9
10
 
10
11
  class << self
11
- def with_element(element_class, method_name = nil, template: nil)
12
- MethodBuilder
13
- .new(self, element_class, method_name, template: template)
14
- .prepare
15
- .build
16
- end
12
+ include Aggregator::ClassMethods
17
13
  end
18
14
 
19
15
  attr_reader :model
16
+ # @method model
17
+ # @api public
18
+ #
19
+ # Model where the form elements will focus
20
+ #
21
+ # @return [String]
20
22
 
23
+ # @method self.with_element(element_class, method_name = nil, template: nil)
24
+ #
25
+ # Configure an {Aggregator} adding a method to render an element
26
+ #
27
+ # @param element_class [Class<Magicka::ELement>]
28
+ # Class of the element to be rendered
29
+ # @param method_name [String,Symbol]
30
+ # Name of the method that will render the element
31
+ # @param template [String] custom template file to be used
32
+ #
33
+ # @see Aggregator::ClassMethods#with_element
34
+ # @see Aggregator::MethodBuilder
35
+ #
36
+ # @return [Array<NilClass>]
37
+
38
+ # @param renderer [ActionView::Base] Object responsible for rendering
39
+ # @param model [String] Model where the form elements will focus
21
40
  def initialize(renderer, model)
22
41
  @renderer = renderer
23
42
  @model = model
24
43
  end
25
44
 
45
+ # Returns a new aggregator focusing on a new model
46
+ #
47
+ # The new model is an attribute of +model+ unless base is given
48
+ #
49
+ # @param model [String] Model where the form elements will focus
50
+ # @param base [String] Model base
51
+ #
52
+ # @yield [Aggregator] new aggregator focused in the new model
53
+ #
54
+ # @return [Aggregator]
26
55
  def with_model(model, base: self.model)
27
56
  new_model = [base, model].compact.join('.')
28
57
 
29
58
  yield self.class.new(renderer, new_model)
30
59
  end
31
60
 
61
+ # Executes a block only when aggregator is one of given types
62
+ #
63
+ # @param types [Array<Symbol>] posssible types
64
+ #
65
+ # @return [Object] Result of the block
66
+ def only(*types)
67
+ return unless types.include?(self.class.type)
68
+
69
+ yield
70
+ end
71
+
72
+ # Executes a block only when aggregator is not one of given types
73
+ #
74
+ # @param types [Array<Symbol>] posssible types
75
+ #
76
+ # @return [Object] Result of the block
77
+ def except(*types)
78
+ return if types.include?(self.class.type)
79
+
80
+ yield
81
+ end
82
+
83
+ # @api private
84
+ # Checks if other aggragate is equal to this one
85
+ #
86
+ # @param [Object] other object to be compared
87
+ #
88
+ # @return [TrueClass,FalseClass]
32
89
  def equal?(other)
33
90
  return unless other.class == self.class
34
91
 
@@ -41,6 +98,13 @@ module Magicka
41
98
  protected
42
99
 
43
100
  attr_reader :renderer
101
+ # @method renderer
102
+ # @private
103
+ # @api private
104
+ #
105
+ # Returns the element needed to render the view
106
+ #
107
+ # @return [ActionView::Base]
44
108
 
45
109
  delegate :render, to: :renderer
46
110
  end
@@ -1,11 +1,43 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Magicka
4
+ # @api public
5
+ #
4
6
  # Class responsible for controlling one object display
5
7
  class Display < Aggregator
6
8
  with_element(Text, :input)
7
9
  with_element(Text, :select)
8
10
 
11
+ # Noop
12
+ #
13
+ # Used to not render a button when using
14
+ # display and not form
15
+ #
16
+ # #return [NilClass]
9
17
  def button(**_args); end
18
+
19
+ # @method input(field, model: self.model, **options)
20
+ # @api public
21
+ #
22
+ # @param field [String,Symbol] field to be shown
23
+ # @param model [String] model being rendered
24
+ # (when omited, use the aggregator model)
25
+ # @param options [Hash]
26
+ #
27
+ # @see Magicka::Text
28
+ #
29
+ # @return (see Magicka::Element#render)
30
+
31
+ # @method select(field, model: self.model, **options)
32
+ # @api public
33
+ #
34
+ # @param field [String,Symbol] field to be shown
35
+ # @param model [String] model being rendered
36
+ # (when omited, use the aggregator model)
37
+ # @param options [Hash]
38
+ #
39
+ # @see Magicka::Text
40
+ #
41
+ # @return (see Magicka::Element#render)
10
42
  end
11
43
  end
@@ -25,7 +25,7 @@ module Magicka
25
25
  #
26
26
  # The method will always return the template folder given in the params
27
27
  #
28
- # @param template_folder [String] path to template folder
28
+ # @param folder [String] path to template folder
29
29
  #
30
30
  # @return [Array<Sinclair::MethodDefinition>]
31
31
  def add_template_folder(folder)
@@ -33,6 +33,9 @@ module Magicka
33
33
  # @return [Array]
34
34
 
35
35
  # Render element HTML
36
+ # @api private
37
+ #
38
+ # @return [ActionView::OutputBuffer]
36
39
  def render
37
40
  renderer.render partial: template, locals: locals
38
41
  end
data/lib/magicka/form.rb CHANGED
@@ -6,8 +6,35 @@ module Magicka
6
6
  with_element(Input)
7
7
  with_element(Select)
8
8
 
9
+ # Renders a button
10
+ #
11
+ # @return (see Magicka::Element#render)
9
12
  def button(**args)
10
13
  Button.render(renderer: renderer, **args)
11
14
  end
15
+
16
+ # @method input(field, model: self.model, **options)
17
+ # @api public
18
+ #
19
+ # @param field [String,Symbol] field to be shown
20
+ # @param model [String] model being rendered
21
+ # (when omited, use the aggregator model)
22
+ # @param options [Hash]
23
+ #
24
+ # @see Magicka::Input
25
+ #
26
+ # @return (see Magicka::Element#render)
27
+
28
+ # @method select(field, model: self.model, **options)
29
+ # @api public
30
+ #
31
+ # @param field [String,Symbol] field to be shown
32
+ # @param model [String] model being rendered
33
+ # (when omited, use the aggregator model)
34
+ # @param options [Hash]
35
+ #
36
+ # @see Magicka::Select
37
+ #
38
+ # @return (see Magicka::Element#render)
12
39
  end
13
40
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Magicka
4
+ module Helper
5
+ # Class methods for {Magicka::Helper}
6
+ module ClassMethods
7
+ # (see Magicka::Helper.with)
8
+ def with(aggregator_class, type = aggregator_class.type)
9
+ MethodBuilder.new(self).build_aggregator(aggregator_class, type)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Magicka
4
+ module Helper
5
+ # Builds methods for {Magicka::Helper}
6
+ class MethodBuilder < Sinclair
7
+ # (see Magicka::Helper.with)
8
+ def build_aggregator(aggregator_class, type = aggregator_class.type)
9
+ add_method("magicka_#{type}") do |model, &block|
10
+ block.call(aggregator_class.new(self, model))
11
+ end
12
+
13
+ build
14
+ end
15
+ end
16
+ end
17
+ end
@@ -3,12 +3,55 @@
3
3
  module Magicka
4
4
  # Helper module to be used on rails
5
5
  module Helper
6
- def magicka_form(model)
7
- yield Form.new(self, model)
8
- end
6
+ autoload :ClassMethods, 'magicka/helper/class_methods'
7
+ autoload :MethodBuilder, 'magicka/helper/method_builder'
9
8
 
10
- def magicka_display(model)
11
- yield Display.new(self, model)
9
+ class << self
10
+ include Helper::ClassMethods
12
11
  end
12
+
13
+ with Form
14
+ with Display
15
+
16
+ # @method self.with(aggregator_class, type = aggregator_class.type)
17
+ #
18
+ # Adds a helper method magicka_+type+
19
+ #
20
+ # The created method executes a block with a an aggragator
21
+ #
22
+ # @param aggregator_class [Class<Magicka::Aggregator>]
23
+ # Agragator to be initialized
24
+ # @param type [String,Symbol] type of aggregator,
25
+ # this will define the method name
26
+ #
27
+ # @return [Array<NilClass>]
28
+
29
+ # @method magicka_form(model)
30
+ #
31
+ # Execute a block with an aggregator focused on a model
32
+ #
33
+ # The aggregator renders elements as form elements
34
+ #
35
+ # @param model [String] Model to be processed
36
+ #
37
+ # @yield [Magicka::Form] Agregator to edit a model
38
+ #
39
+ # @see Magicka::Form
40
+ #
41
+ # @return [String]
42
+
43
+ # @method magicka_display(model)
44
+ #
45
+ # Execute a block with an aggregator focused on a model
46
+ #
47
+ # The aggregator renders elements as display elements
48
+ #
49
+ # @param model [String] Model to be processed
50
+ #
51
+ # @yield [Magicka::Display] Agregator to show a model
52
+ #
53
+ # @see Magicka::Display
54
+ #
55
+ # @return [String]
13
56
  end
14
57
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Magicka
4
- VERSION = '0.5.6'
4
+ VERSION = '0.6.0'
5
5
  end
data/magicka.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |gem|
26
26
  gem.add_development_dependency 'activerecord', '~> 5.2.x'
27
27
  gem.add_development_dependency 'bundler', '1.16.1'
28
28
  gem.add_development_dependency 'factory_bot', '5.2.0'
29
- gem.add_development_dependency 'nokogiri', '1.11.4'
29
+ gem.add_development_dependency 'nokogiri', '1.12.5'
30
30
  gem.add_development_dependency 'pry', '0.12.2'
31
31
  gem.add_development_dependency 'pry-nav', '0.3.0'
32
32
  gem.add_development_dependency 'rails', '~> 5.2.x'
@@ -11,6 +11,31 @@ describe Magicka::Aggregator do
11
11
  let(:template) { 'templates/forms/input' }
12
12
  let(:locals) { {} }
13
13
 
14
+ describe '.type' do
15
+ let(:type) { %w[form display other].sample }
16
+
17
+ it 'sets aggregator type' do
18
+ expect { aggregator_class.type(type) }
19
+ .to change(aggregator_class, :type)
20
+ .from(nil).to(type.to_sym)
21
+ end
22
+
23
+ context 'when type has not been set' do
24
+ let(:aggregator_class) do
25
+ Class.new(described_class) do
26
+ def self.name
27
+ 'Magicka::MyClass'
28
+ end
29
+ end
30
+ end
31
+
32
+ it 'Uses class name as type' do
33
+ expect(aggregator_class.type)
34
+ .to eq(:my_class)
35
+ end
36
+ end
37
+ end
38
+
14
39
  describe '.with_element' do
15
40
  context 'when seeting element class only' do
16
41
  it do
@@ -206,4 +231,68 @@ describe Magicka::Aggregator do
206
231
  end
207
232
  end
208
233
  end
234
+
235
+ describe '#with_model' do
236
+ let(:expected_aggregator) do
237
+ aggregator_class.new(renderer, 'my_model.inner')
238
+ end
239
+
240
+ it do
241
+ aggregator.with_model(:inner) do |new_aggregator|
242
+ expect(new_aggregator).to eq(expected_aggregator)
243
+ end
244
+ end
245
+ end
246
+
247
+ describe '#only' do
248
+ let(:aggregator_class) do
249
+ Class.new(described_class) do
250
+ type :included
251
+ end
252
+ end
253
+
254
+ context 'when the type is included in the list' do
255
+ it 'executes the block' do
256
+ value = 0
257
+
258
+ aggregator.only(:not_included, :included, :other) { value += 1 }
259
+ expect(value).to eq(1)
260
+ end
261
+ end
262
+
263
+ context 'when the type is not included in the list' do
264
+ it 'does not execute the block' do
265
+ value = 0
266
+
267
+ aggregator.only(:not_included, :other) { value += 1 }
268
+ expect(value).to be_zero
269
+ end
270
+ end
271
+ end
272
+
273
+ describe '#except' do
274
+ let(:aggregator_class) do
275
+ Class.new(described_class) do
276
+ type :included
277
+ end
278
+ end
279
+
280
+ context 'when the type is included in the list' do
281
+ it 'does not execute the block' do
282
+ value = 0
283
+
284
+ aggregator.except(:not_included, :included, :other) { value += 1 }
285
+ expect(value).to be_zero
286
+ end
287
+ end
288
+
289
+ context 'when the type is not included in the list' do
290
+ it 'executes the block' do
291
+ value = 0
292
+
293
+ aggregator.except(:not_included, :other) { value += 1 }
294
+ expect(value).to eq(1)
295
+ end
296
+ end
297
+ end
209
298
  end
@@ -16,6 +16,12 @@ describe Magicka::Display do
16
16
  .with(partial: template, locals: locals)
17
17
  end
18
18
 
19
+ describe '.type' do
20
+ it do
21
+ expect(described_class.type).to eq(:display)
22
+ end
23
+ end
24
+
19
25
  describe '#input' do
20
26
  let(:template) { 'templates/display/text' }
21
27
  let(:field) { :field }
@@ -166,4 +172,44 @@ describe Magicka::Display do
166
172
  end
167
173
  end
168
174
  end
175
+
176
+ describe '#only' do
177
+ context 'when the type is included in the list' do
178
+ it 'executes the block' do
179
+ value = 0
180
+
181
+ form.only(:not_included, :display, :other) { value += 1 }
182
+ expect(value).to eq(1)
183
+ end
184
+ end
185
+
186
+ context 'when the type is not included in the list' do
187
+ it 'does not execute the block' do
188
+ value = 0
189
+
190
+ form.only(:not_included, :other) { value += 1 }
191
+ expect(value).to be_zero
192
+ end
193
+ end
194
+ end
195
+
196
+ describe '#except' do
197
+ context 'when the type is included in the list' do
198
+ it 'does not execute the block' do
199
+ value = 0
200
+
201
+ form.except(:not_included, :display, :other) { value += 1 }
202
+ expect(value).to be_zero
203
+ end
204
+ end
205
+
206
+ context 'when the type is not included in the list' do
207
+ it 'executes the block' do
208
+ value = 0
209
+
210
+ form.except(:not_included, :other) { value += 1 }
211
+ expect(value).to eq(1)
212
+ end
213
+ end
214
+ end
169
215
  end
@@ -16,6 +16,12 @@ describe Magicka::Form do
16
16
  .with(partial: template, locals: locals)
17
17
  end
18
18
 
19
+ describe '.type' do
20
+ it do
21
+ expect(described_class.type).to eq(:form)
22
+ end
23
+ end
24
+
19
25
  describe '#input' do
20
26
  let(:template) { 'templates/forms/input' }
21
27
  let(:field) { :field }
@@ -180,4 +186,44 @@ describe Magicka::Form do
180
186
  end
181
187
  end
182
188
  end
189
+
190
+ describe '#only' do
191
+ context 'when the type is included in the list' do
192
+ it 'executes the block' do
193
+ value = 0
194
+
195
+ form.only(:not_included, :form, :other) { value += 1 }
196
+ expect(value).to eq(1)
197
+ end
198
+ end
199
+
200
+ context 'when the type is not included in the list' do
201
+ it 'does not execute the block' do
202
+ value = 0
203
+
204
+ form.only(:not_included, :other) { value += 1 }
205
+ expect(value).to be_zero
206
+ end
207
+ end
208
+ end
209
+
210
+ describe '#except' do
211
+ context 'when the type is included in the list' do
212
+ it 'does not execute the block' do
213
+ value = 0
214
+
215
+ form.except(:not_included, :form, :other) { value += 1 }
216
+ expect(value).to be_zero
217
+ end
218
+ end
219
+
220
+ context 'when the type is not included in the list' do
221
+ it 'executes the block' do
222
+ value = 0
223
+
224
+ form.except(:not_included, :other) { value += 1 }
225
+ expect(value).to eq(1)
226
+ end
227
+ end
228
+ end
183
229
  end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Magicka::Helper do
6
+ subject(:object) { klass.new }
7
+
8
+ let(:klass) do
9
+ Class.new do
10
+ include Magicka::Helper
11
+ end
12
+ end
13
+
14
+ let(:model) { 'model' }
15
+
16
+ describe '.with' do
17
+ let(:aggregator_class) do
18
+ Class.new(Magicka::Aggregator) do
19
+ def self.name
20
+ 'Magicka::MyClass'
21
+ end
22
+ end
23
+ end
24
+
25
+ it do
26
+ expect { described_class.with(aggregator_class) }
27
+ .to add_method('magicka_my_class')
28
+ .to(object)
29
+ end
30
+ end
31
+
32
+ describe '#magicka_display' do
33
+ it do
34
+ object.magicka_display(model) do |display|
35
+ expect(display).to be_a(Magicka::Display)
36
+ end
37
+ end
38
+
39
+ it 'populates the model' do
40
+ object.magicka_display(model) do |display|
41
+ expect(display.model).to eq(model)
42
+ end
43
+ end
44
+
45
+ it 'populates the renderer' do
46
+ object.magicka_display(model) do |display|
47
+ expect(display.send(:renderer)).to eq(object)
48
+ end
49
+ end
50
+ end
51
+
52
+ describe '#magicka_form' do
53
+ it do
54
+ object.magicka_form(model) do |form|
55
+ expect(form).to be_a(Magicka::Form)
56
+ end
57
+ end
58
+
59
+ it 'populates the model' do
60
+ object.magicka_form(model) do |form|
61
+ expect(form.model).to eq(model)
62
+ end
63
+ end
64
+
65
+ it 'populates the renderer' do
66
+ object.magicka_form(model) do |form|
67
+ expect(form.send(:renderer)).to eq(object)
68
+ end
69
+ end
70
+ end
71
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magicka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DarthJee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-21 00:00:00.000000000 Z
11
+ date: 2021-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 1.11.4
103
+ version: 1.12.5
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 1.11.4
110
+ version: 1.12.5
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: pry
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -398,6 +398,7 @@ files:
398
398
  - docker-compose.yml
399
399
  - lib/magicka.rb
400
400
  - lib/magicka/aggregator.rb
401
+ - lib/magicka/aggregator/class_methods.rb
401
402
  - lib/magicka/aggregator/method_builder.rb
402
403
  - lib/magicka/button.rb
403
404
  - lib/magicka/display.rb
@@ -407,6 +408,8 @@ files:
407
408
  - lib/magicka/form.rb
408
409
  - lib/magicka/form_element.rb
409
410
  - lib/magicka/helper.rb
411
+ - lib/magicka/helper/class_methods.rb
412
+ - lib/magicka/helper/method_builder.rb
410
413
  - lib/magicka/input.rb
411
414
  - lib/magicka/select.rb
412
415
  - lib/magicka/text.rb
@@ -482,6 +485,7 @@ files:
482
485
  - spec/lib/magicka/element_spec.rb
483
486
  - spec/lib/magicka/form_element_spec.rb
484
487
  - spec/lib/magicka/form_spec.rb
488
+ - spec/lib/magicka/helper_spec.rb
485
489
  - spec/lib/magicka/input_spec.rb
486
490
  - spec/lib/magicka/select_spec.rb
487
491
  - spec/lib/magicka/text_spec.rb