card 1.18.1 → 1.18.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -68,8 +68,8 @@ describe Card::Set::Type::Image do
68
68
 
69
69
  describe 'view: act_expanded' do
70
70
  it 'gets image url' do
71
- act_summary = subject.format
72
- .render(:act_expanded, act: subject.last_act)
71
+ render_args = { act: subject.last_act, action_view: :expanded }
72
+ act_summary = subject.format.render :act, render_args
73
73
  current_url = subject.image.versions[:medium].url
74
74
  expect(act_summary).to match(/#{Regexp.quote current_url}/)
75
75
  end
@@ -8,7 +8,7 @@ describe Card::Action do
8
8
  a.update_attributes!(content: 'New content')
9
9
  a.delete_old_actions
10
10
  expect(a.actions.count).to eq(1)
11
- expect(a.actions(true).last.new_values[:name]).to eq('New A')
11
+ expect(a.actions(true).last.value :name).to eq('New A')
12
12
  end
13
13
  end
14
14
  end
@@ -20,28 +20,29 @@ describe Card::Cache do
20
20
  describe 'with same cache_id' do
21
21
  before :each do
22
22
  @hard = ActiveSupport::Cache::MemoryStore.new
23
- @cache = Card::Cache.new store: @hard, prefix: 'prefix'
23
+ @cache = Card::Cache.new store: @hard
24
+ @prefix = @cache.hard.prefix
24
25
  end
25
26
 
26
27
  it '#read' do
27
- expect(@hard).to receive(:read).with('prefix/foo')
28
+ expect(@hard).to receive(:read).with("#{@prefix}/foo")
28
29
  @cache.read('foo')
29
30
  end
30
31
 
31
32
  it '#write' do
32
- expect(@hard).to receive(:write).with('prefix/foo', 'val')
33
+ expect(@hard).to receive(:write).with("#{@prefix}/foo", 'val')
33
34
  @cache.write('foo', 'val')
34
35
  expect(@cache.read('foo')).to eq('val')
35
36
  end
36
37
 
37
38
  it '#fetch' do
38
39
  block = proc { 'hi' }
39
- expect(@hard).to receive(:fetch).with('prefix/foo', &block)
40
+ expect(@hard).to receive(:fetch).with("#{@prefix}/foo", &block)
40
41
  @cache.fetch('foo', &block)
41
42
  end
42
43
 
43
44
  it '#delete' do
44
- expect(@hard).to receive(:delete).with('prefix/foo')
45
+ expect(@hard).to receive(:delete).with("#{@prefix}/foo")
45
46
  @cache.delete 'foo'
46
47
  end
47
48
 
@@ -55,18 +56,20 @@ describe Card::Cache do
55
56
 
56
57
  it '#reset' do
57
58
  @hard = ActiveSupport::Cache::MemoryStore.new
58
- @cache = Card::Cache.new store: @hard, prefix: 'prefix'
59
- expect(@cache.hard.prefix).to eq('prefix/')
59
+ @cache = Card::Cache.new store: @hard, database: 'mydb'
60
+
61
+ expect(@cache.hard.prefix).to match(/^mydb\//)
60
62
  @cache.write('foo', 'bar')
61
63
  expect(@cache.read('foo')).to eq('bar')
62
64
 
65
+
63
66
  # reset
64
67
  @cache.reset
65
- expect(@cache.hard.prefix).to eq('prefix/')
68
+ expect(@cache.hard.prefix).to match(/^mydb\//)
66
69
  expect(@cache.read('foo')).to be_nil
67
70
 
68
- cache2 = Card::Cache.new store: @hard, prefix: 'prefix'
69
- expect(cache2.hard.prefix).to eq('prefix/')
71
+ cache2 = Card::Cache.new store: @hard, database: 'mydb'
72
+ expect(cache2.hard.prefix).to match(/^mydb\//)
70
73
  end
71
74
 
72
75
  describe 'with file store' do
@@ -98,6 +98,10 @@ describe Card::StageDirector do
98
98
  '12' => { subcards: { '121' => 'A' } }
99
99
  }
100
100
  end
101
+ let(:create_card_with_junction) do
102
+ Card.create name: '1+2',
103
+ subcards: { '11' => 'A'}
104
+ end
101
105
  let(:preorder) { %w(1 11 111 12 121) }
102
106
  let(:postorder) { %w(111 11 121 12 1) }
103
107
  describe 'validate' do
@@ -207,12 +211,66 @@ describe Card::StageDirector do
207
211
  i:112v ptv:112v v:112v
208
212
  v:12 v:121
209
213
  pts:1 pts:11 pts:111 pts:112v pts:12 pts:121
210
- s:1 s:11 s:111 f:111 s:112v f:112v f:11 s:12 s:121 f:121 f:12 f:1
214
+ s:1
215
+ s:11
216
+ s:111 f:111
217
+ s:112v f:112v
218
+ f:11
219
+ s:12
220
+ s:121 f:121
221
+ f:12
222
+ f:1
211
223
  ig:1 ig:11 ig:111 ig:112v ig:12 ig:121
212
224
  igwd:1 igwd:11 igwd:111 igwd:112v igwd:12 igwd:121
213
225
  )
214
226
  )
215
227
  end
228
+
229
+ it 'with junction' do
230
+ order = []
231
+ with_test_events do
232
+ test_event :initialize, on: :create do
233
+ order << "i:#{name}"
234
+ end
235
+ test_event :prepare_to_validate, on: :create do
236
+ order << "ptv:#{name}"
237
+ end
238
+ test_event :validate, on: :create do
239
+ order << "v:#{name}"
240
+ end
241
+ test_event :prepare_to_store, on: :create do
242
+ order << "pts:#{name}"
243
+ end
244
+ test_event :store, on: :create do
245
+ order << "s:#{name}"
246
+ end
247
+ test_event :finalize, on: :create do
248
+ order << "f:#{name}"
249
+ end
250
+ test_event :integrate, on: :create do
251
+ order << "ig:#{name}"
252
+ end
253
+ test_event :integrate_with_delay, on: :create do
254
+ order << "igwd:#{name}"
255
+ end
256
+ create_card_with_junction
257
+ end
258
+ expect(order).to eq(
259
+ %w(
260
+ i:1+2 i:11
261
+ ptv:1+2 ptv:11
262
+ v:1+2 v:11
263
+ pts:1+2 pts:11
264
+ s:1+2
265
+ i:1 ptv:1 v:1 pts:1 s:1 f:1
266
+ i:2 ptv:2 v:2 pts:2 s:2 f:2
267
+ s:11 f:11
268
+ f:1+2
269
+ ig:1+2 ig:11 ig:1 ig:2
270
+ igwd:1+2 igwd:11 igwd:1 igwd:2
271
+ )
272
+ )
273
+ end
216
274
  end
217
275
  end
218
276
 
@@ -168,7 +168,7 @@ describe Card, 'revived from trash' do
168
168
  end
169
169
 
170
170
  it 'should still have old content' do
171
- expect(@c.nth_action(1).change_for(2).first.value).to eq('basiccontent')
171
+ expect(@c.nth_action(1).value :db_content).to eq('basiccontent')
172
172
  end
173
173
 
174
174
  it 'should have the same content' do
@@ -209,7 +209,7 @@ describe Card, 'junction revival' do
209
209
  end
210
210
 
211
211
  it 'should still have old action' do
212
- expect(@c.nth_action(1).change_for(2).first.value).to eq('basiccontent')
212
+ expect(@c.nth_action(1).value :db_content).to eq('basiccontent')
213
213
  end
214
214
 
215
215
  it 'should have old content' do
@@ -44,7 +44,7 @@ describe Card do
44
44
  end
45
45
 
46
46
  it 'should have original action' do
47
- expect(@c.nth_action(1).change_for(2).first.value).to eq('basiccontent')
47
+ expect(@c.nth_action(1).value :db_content).to eq('basiccontent')
48
48
  end
49
49
  end
50
50
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.1
4
+ version: 1.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-02-26 00:00:00.000000000 Z
14
+ date: 2016-03-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: smartname