magicka 0.5.2 → 0.5.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: ee215dd9512aa8f283dfeedd12e3eaf13ecd7b738cdc5614e7b9fb82532b52a3
4
- data.tar.gz: aeb3107ff20cdcc5062176127b5409fd2b574fb41d14b0ba9edb2576b8fccb04
3
+ metadata.gz: 790574b274384507133ba81bff57316fdee267695e6a86bbb36da2065d98f918
4
+ data.tar.gz: ded516626da7b9825e1711aa4d299cd0388de7293776cc20c9facc607b4ba8ef
5
5
  SHA512:
6
- metadata.gz: fc950ba9d4cbc6b085ae6c0730ccb5cbdcaa96f86014fcaa93a923189711664037f9454d1715dae6f885ed19a93bfc356f5cc3a613c1be1412210e62979b4c78
7
- data.tar.gz: 07edd54ef28d7a5638b126ec140926928ea580febe9f9ce0384c179a13ee250a4432c0dc1f31798a6050c26cbadf617a41b012fb7ca35a318f40b92d662ceb10
6
+ metadata.gz: a2fb23dfa2dca070216bede19831ca54bc0c9ee1340418848e647512d4ec7668ee97b0015aa8d7d3b85e6014883e263107ce8360efed4286342e714f502d93ce
7
+ data.tar.gz: 6e165bd37c83eb5d3c0c760164f2f93e9d51d05f284621960012e24b81d5b7779140cca6f1d47128bd24a4545201e77becd489fa20d9e0ac6ba816cd01dc8fdf
data/README.md CHANGED
@@ -11,7 +11,7 @@ Magicka
11
11
 
12
12
  Yard Documentation
13
13
  -------------------
14
- [https://www.rubydoc.info/gems/magicka/0.5.2](https://www.rubydoc.info/gems/magicka/0.5.2)
14
+ [https://www.rubydoc.info/gems/magicka/0.5.3](https://www.rubydoc.info/gems/magicka/0.5.3)
15
15
 
16
16
  Installation
17
17
  ---------------
@@ -23,8 +23,8 @@ module Magicka
23
23
  @model = model
24
24
  end
25
25
 
26
- def with_model(model)
27
- new_model = [self.model, model].join('.')
26
+ def with_model(model, base: self.model)
27
+ new_model = [base, model].compact.join('.')
28
28
 
29
29
  yield self.class.new(renderer, new_model)
30
30
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Magicka
4
- VERSION = '0.5.2'
4
+ VERSION = '0.5.3'
5
5
  end
@@ -139,4 +139,31 @@ describe Magicka::Display do
139
139
  end
140
140
  end
141
141
  end
142
+
143
+ describe '#with_form' do
144
+ it do
145
+ form.with_model('sub') do |new_form|
146
+ expect(new_form)
147
+ .to eq(described_class.new(renderer, 'my_model.sub'))
148
+ end
149
+ end
150
+
151
+ context 'when passing a new base' do
152
+ it do
153
+ form.with_model('sub', base: :other_model) do |new_form|
154
+ expect(new_form)
155
+ .to eq(described_class.new(renderer, 'other_model.sub'))
156
+ end
157
+ end
158
+ end
159
+
160
+ context 'when passing an empty base' do
161
+ it do
162
+ form.with_model('sub', base: nil) do |new_form|
163
+ expect(new_form)
164
+ .to eq(described_class.new(renderer, 'sub'))
165
+ end
166
+ end
167
+ end
168
+ end
142
169
  end
@@ -153,4 +153,31 @@ describe Magicka::Form do
153
153
  end
154
154
  end
155
155
  end
156
+
157
+ describe '#with_form' do
158
+ it do
159
+ form.with_model('sub') do |new_form|
160
+ expect(new_form)
161
+ .to eq(described_class.new(renderer, 'my_model.sub'))
162
+ end
163
+ end
164
+
165
+ context 'when passing a new base' do
166
+ it do
167
+ form.with_model('sub', base: :other_model) do |new_form|
168
+ expect(new_form)
169
+ .to eq(described_class.new(renderer, 'other_model.sub'))
170
+ end
171
+ end
172
+ end
173
+
174
+ context 'when passing an empty base' do
175
+ it do
176
+ form.with_model('sub', base: nil) do |new_form|
177
+ expect(new_form)
178
+ .to eq(described_class.new(renderer, 'sub'))
179
+ end
180
+ end
181
+ end
182
+ end
156
183
  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.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - DarthJee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-04 00:00:00.000000000 Z
11
+ date: 2020-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport