card 1.17.1 → 1.17.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/config/initializers/recaptcha.rb +27 -19
  4. data/db/migrate/20160122153608_new_indeces.rb +10 -0
  5. data/db/migrate_core_cards/20130411191151_renaming_for_menu.rb +2 -2
  6. data/db/migrate_core_cards/20140317035504_account_requests_to_signups.rb +2 -2
  7. data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +2 -2
  8. data/db/migrate_core_cards/20150807205221_create_references_for_search_cards.rb +4 -2
  9. data/db/schema.rb +5 -1
  10. data/db/version.txt +1 -1
  11. data/lib/card.rb +3 -3
  12. data/lib/card/reference.rb +68 -52
  13. data/mod/01_core/chunk/query_reference.rb +1 -1
  14. data/mod/01_core/set/all/collection.rb +1 -1
  15. data/mod/01_core/set/all/name.rb +27 -65
  16. data/mod/01_core/set/all/pattern.rb +6 -3
  17. data/mod/01_core/set/all/references.rb +135 -62
  18. data/mod/01_core/set/all/tracked_attributes.rb +1 -1
  19. data/mod/01_core/set/all/utils.rb +2 -2
  20. data/mod/01_core/spec/set/all/references_spec.rb +4 -3
  21. data/mod/01_core/spec/set/all/tracked_attributes_spec.rb +16 -22
  22. data/mod/01_history/lib/card/act.rb +32 -30
  23. data/mod/01_history/lib/card/change.rb +26 -18
  24. data/mod/01_history/set/all/history.rb +1 -1
  25. data/mod/04_settings/set/right/structure.rb +1 -1
  26. data/mod/05_email/set/all/notify.rb +1 -1
  27. data/mod/05_email/spec/set/right/followers_spec.rb +1 -1
  28. data/mod/05_standard/set/all/rich_html/editing.rb +42 -45
  29. data/mod/05_standard/set/type/list.rb +2 -2
  30. data/mod/05_standard/spec/set/self/all_spec.rb +3 -3
  31. data/mod/05_standard/spec/set/type/list_spec.rb +3 -3
  32. data/mod/05_standard/spec/set/type/listed_by_spec.rb +2 -2
  33. data/mod/05_standard/spec/set/type/search_type_spec.rb +1 -1
  34. data/spec/lib/card/reference_spec.rb +30 -28
  35. data/spec/models/card/trash_spec.rb +63 -63
  36. data/spec/models/card/type_transition_spec.rb +34 -35
  37. metadata +3 -2
@@ -2,8 +2,8 @@
2
2
 
3
3
  require 'card/action'
4
4
 
5
- describe Card, "deleting card" do
6
- it "should require permission" do
5
+ describe Card, 'deleting card' do
6
+ it 'should require permission' do
7
7
  a = Card['a']
8
8
  Card::Auth.as :anonymous do
9
9
  expect(a.ok?(:delete)).to eq(false)
@@ -15,17 +15,17 @@ describe Card, "deleting card" do
15
15
  end
16
16
  end
17
17
 
18
- describe Card, "deleted card" do
18
+ describe Card, 'deleted card' do
19
19
  before do
20
20
  Card::Auth.as_bot do
21
21
  @c = Card['A']
22
22
  @c.delete!
23
23
  end
24
24
  end
25
- it "should be in the trash" do
25
+ it 'should be in the trash' do
26
26
  expect(@c.trash).to be_truthy
27
27
  end
28
- it "should come out of the trash when a plus card is created" do
28
+ it 'should come out of the trash when a plus card is created' do
29
29
  Card::Auth.as_bot do
30
30
  Card.create(name: 'A+*acct')
31
31
  c = Card[ 'A' ]
@@ -34,18 +34,18 @@ describe Card, "deleted card" do
34
34
  end
35
35
  end
36
36
 
37
- describe Card, "in trash" do
38
- it "should be retrieved by fetch with new" do
39
- Card.create(name: "Betty").delete
40
- c=Card.fetch "Betty", new: {}
37
+ describe Card, 'in trash' do
38
+ it 'should be retrieved by fetch with new' do
39
+ Card.create(name: 'Betty').delete
40
+ c=Card.fetch 'Betty', new: {}
41
41
  c.save
42
- expect(Card["Betty"]).to be_instance_of(Card)
42
+ expect(Card['Betty']).to be_instance_of(Card)
43
43
  end
44
44
  end
45
45
 
46
46
 
47
- describe Card, "plus cards" do
48
- it "should be deleted when root is" do
47
+ describe Card, 'plus cards' do
48
+ it 'should be deleted when root is' do
49
49
  Card::Auth.as 'joe_admin' do
50
50
  c = Card.create! name: 'zz+top'
51
51
  root = Card['zz']
@@ -59,20 +59,20 @@ end
59
59
 
60
60
  # FIXME: these user tests should probably be in a set of cardtype specific tests somewhere..
61
61
  describe Card do
62
- context "with revisions" do
63
- before do Card::Auth.as_bot { @c = Card["Wagn Bot"] } end
64
- it "should not be removable" do
62
+ context 'with revisions' do
63
+ before do Card::Auth.as_bot { @c = Card['Wagn Bot'] } end
64
+ it 'should not be removable' do
65
65
  expect(@c.delete).not_to be_truthy
66
66
  end
67
67
  end
68
68
 
69
- context "without revisions" do
69
+ context 'without revisions' do
70
70
  before do
71
71
  Card::Auth.as_bot do
72
72
  @c = Card.create! name: 'User Must Die', type: 'User'
73
73
  end
74
74
  end
75
- it "should be removable" do
75
+ it 'should be removable' do
76
76
  expect(@c.delete!).to be_truthy
77
77
  end
78
78
  end
@@ -94,39 +94,39 @@ end
94
94
  # end
95
95
  #end
96
96
 
97
- describe Card, "dependent removal" do
97
+ describe Card, 'dependent removal' do
98
98
  before do
99
99
  @a = Card['A']
100
100
  @a.delete!
101
- @c = Card.find_by_key "A+B+C".to_name.key
101
+ @c = Card.find_by_key 'A+B+C'.to_name.key
102
102
  end
103
103
 
104
- it "should be trash" do
104
+ it 'should be trash' do
105
105
  expect(@c.trash).to be_truthy
106
106
  end
107
107
 
108
- it "should not be findable by name" do
109
- expect(Card["A+B+C"]).to eq(nil)
108
+ it 'should not be findable by name' do
109
+ expect(Card['A+B+C']).to eq(nil)
110
110
  end
111
111
  end
112
112
 
113
- describe Card, "rename to trashed name" do
113
+ describe Card, 'rename to trashed name' do
114
114
  before do
115
115
  Card::Auth.as_bot do
116
- @a = Card["A"]
117
- @b = Card["B"]
116
+ @a = Card['A']
117
+ @b = Card['B']
118
118
  @a.delete! #trash
119
119
  Rails.logger.info "\n\n~~~~~~~deleted~~~~~~~~\n\n\n"
120
120
 
121
- @b.update_attributes! name: "A", update_referencers: true
121
+ @b.update_attributes! name: 'A', update_referers: true
122
122
  end
123
123
  end
124
124
 
125
- it "should rename b to a" do
125
+ it 'should rename b to a' do
126
126
  expect(@b.name).to eq('A')
127
127
  end
128
128
 
129
- it "should rename a to a*trash" do
129
+ it 'should rename a to a*trash' do
130
130
  expect((c = Card.find(@a.id)).cardname.to_s).to eq('A*trash')
131
131
  expect(c.name).to eq('A*trash')
132
132
  expect(c.key).to eq('a*trash')
@@ -134,56 +134,56 @@ describe Card, "rename to trashed name" do
134
134
  end
135
135
 
136
136
 
137
- describe Card, "sent to trash" do
137
+ describe Card, 'sent to trash' do
138
138
  before do
139
139
  Card::Auth.as_bot do
140
- @c = Card["basicname"]
140
+ @c = Card['basicname']
141
141
  @c.delete!
142
142
  end
143
143
  end
144
144
 
145
- it "should be trash" do
145
+ it 'should be trash' do
146
146
  expect(@c.trash).to eq(true)
147
147
  end
148
148
 
149
- it "should not be findable by name" do
150
- expect(Card["basicname"]).to eq(nil)
149
+ it 'should not be findable by name' do
150
+ expect(Card['basicname']).to eq(nil)
151
151
  end
152
152
 
153
- it "should still have actions" do
153
+ it 'should still have actions' do
154
154
  expect(@c.actions.count).to eq(2)
155
155
  expect(@c.last_change_on(:db_content).value).to eq('basiccontent')
156
156
  end
157
157
  end
158
158
 
159
- describe Card, "revived from trash" do
159
+ describe Card, 'revived from trash' do
160
160
  before do
161
161
  Card::Auth.as_bot do
162
- Card["basicname"].delete!
162
+ Card['basicname'].delete!
163
163
 
164
164
  @c = Card.create! name: 'basicname', content: 'revived content'
165
165
  end
166
166
  end
167
167
 
168
- it "should not be trash" do
168
+ it 'should not be trash' do
169
169
  expect(@c.trash).to eq(false)
170
170
  end
171
171
 
172
- it "should have 3 actions" do
172
+ it 'should have 3 actions' do
173
173
  expect(@c.actions.count).to eq(3)
174
174
  end
175
175
 
176
- it "should still have old content" do
176
+ it 'should still have old content' do
177
177
  expect(@c.nth_action(1).change_for(2).first.value).to eq('basiccontent')
178
178
  end
179
179
 
180
- it "should have the same content" do
180
+ it 'should have the same content' do
181
181
  expect(@c.content).to eq('revived content')
182
182
  # Card.fetch(@c.name).content.should == 'revived content'
183
183
  end
184
184
  end
185
185
 
186
- describe Card, "recreate trashed card via new" do
186
+ describe Card, 'recreate trashed card via new' do
187
187
  # before do
188
188
  # Card::Auth.as(Card::WagnBotID)
189
189
  # @c = Card.create! type: 'Basic', name: "BasicMe"
@@ -198,60 +198,60 @@ describe Card, "recreate trashed card via new" do
198
198
 
199
199
  end
200
200
 
201
- describe Card, "junction revival" do
201
+ describe Card, 'junction revival' do
202
202
  before do
203
203
  Card::Auth.as_bot do
204
- @c = Card.create! name: "basicname+woot", content: "basiccontent"
204
+ @c = Card.create! name: 'basicname+woot', content: 'basiccontent'
205
205
  @c.delete!
206
- @c = Card.create! name: "basicname+woot", content: "revived content"
206
+ @c = Card.create! name: 'basicname+woot', content: 'revived content'
207
207
  end
208
208
  end
209
209
 
210
- it "should not be trash" do
210
+ it 'should not be trash' do
211
211
  expect(@c.trash).to eq(false)
212
212
  end
213
213
 
214
- it "should have 3 actions" do
214
+ it 'should have 3 actions' do
215
215
  expect(@c.actions.count).to eq(3)
216
216
  end
217
217
 
218
- it "should still have old action" do
218
+ it 'should still have old action' do
219
219
  expect(@c.nth_action(1).change_for(2).first.value).to eq('basiccontent')
220
220
  end
221
221
 
222
- it "should have old content" do
222
+ it 'should have old content' do
223
223
  expect(@c.db_content).to eq('revived content')
224
224
  end
225
225
  end
226
226
 
227
- describe "remove tests" do
227
+ describe 'remove tests' do
228
228
 
229
229
  before do
230
- @a = Card["A"]
230
+ @a = Card['A']
231
231
  end
232
232
 
233
233
  # I believe this is here to test a bug where cards with certain kinds of references
234
234
  # would fail to delete. probably less of an issue now that delete is done through
235
235
  # trash.
236
- it "test_remove" do
237
- assert @a.delete!, "card should be deleteable"
238
- assert_nil Card["A"]
236
+ it 'test_remove' do
237
+ assert @a.delete!, 'card should be deleteable'
238
+ assert_nil Card['A']
239
239
  end
240
240
 
241
- it "test_recreate_plus_card_name_variant" do
242
- Card.create( name: "rta+rtb" ).delete
243
- Card["rta"].update_attributes name: "rta!"
244
- c = Card.create! name: "rta!+rtb"
245
- assert Card["rta!+rtb"]
246
- assert !Card["rta!+rtb"].trash
241
+ it 'test_recreate_plus_card_name_variant' do
242
+ Card.create( name: 'rta+rtb' ).delete
243
+ Card['rta'].update_attributes name: 'rta!'
244
+ c = Card.create! name: 'rta!+rtb'
245
+ assert Card['rta!+rtb']
246
+ assert !Card['rta!+rtb'].trash
247
247
  assert Card.find_by_key('rtb*trash').nil?
248
248
  end
249
249
 
250
- it "test_multiple_trash_collision" do
251
- Card.create( name: "alpha" ).delete
250
+ it 'test_multiple_trash_collision' do
251
+ Card.create( name: 'alpha' ).delete
252
252
  3.times do
253
- b = Card.create( name: "beta" )
254
- b.name = "alpha"
253
+ b = Card.create( name: 'beta' )
254
+ b.name = 'alpha'
255
255
  assert b.save!
256
256
  b.delete
257
257
  end
@@ -4,22 +4,21 @@ class Card
4
4
  cattr_accessor :count
5
5
 
6
6
  module Set::Type
7
-
8
7
  module CardtypeA
9
8
  extend Card::Set
10
9
 
11
10
  def ok_to_delete
12
- deny_because("not allowed to delete card a")
11
+ deny_because 'not allowed to delete card a'
13
12
  end
14
13
  end
15
14
 
16
- # module CardtypeC
17
- # extend Card::Set
18
- # end
15
+ # module CardtypeC
16
+ # extend Card::Set
17
+ # end
19
18
 
20
19
  module CardtypeD
21
20
  def valid?
22
- errors.add :create_error, "card d always has errors"
21
+ errors.add :create_error, 'card d always has errors'
23
22
  errors.empty?
24
23
  end
25
24
  end
@@ -39,78 +38,78 @@ class Card
39
38
  end
40
39
  end
41
40
 
42
- describe Card, "with role" do
41
+ describe Card, 'with role' do
43
42
  before do
44
43
  Card::Auth.as_bot do
45
44
  @role = Card.search(type: 'Role')[0]
46
45
  end
47
46
  end
48
47
 
49
- it "should have a role type" do
48
+ it 'should have a role type' do
50
49
  expect(@role.type_id).to eq(Card::RoleID)
51
50
  end
52
51
  end
53
52
 
54
53
 
55
54
 
56
- describe Card, "with account" do
55
+ describe Card, 'with account' do
57
56
  before do
58
57
  Card::Auth.as_bot do
59
58
  @joe = change_card_to_type('Joe User', :basic)
60
59
  end
61
60
  end
62
61
 
63
- it "should not have errors" do
62
+ it 'should not have errors' do
64
63
  expect(@joe.errors.empty?).to eq(true)
65
64
  end
66
65
 
67
- it "should allow type changes" do
66
+ it 'should allow type changes' do
68
67
  expect(@joe.type_code).to eq(:basic)
69
68
  end
70
69
 
71
70
  end
72
71
 
73
- describe Card, "type transition approve create" do
72
+ describe Card, 'type transition approve create' do
74
73
  it 'should have cardtype b create role r1' do
75
74
  expect((c=Card.fetch('Cardtype B+*type+*create')).content).to eq('[[r1]]')
76
75
  expect(c.type_code).to eq(:pointer)
77
76
  end
78
77
 
79
- it "should have errors" do
80
- c = change_card_to_type("basicname", "cardtype_b")
78
+ it 'should have errors' do
79
+ c = change_card_to_type 'basicname', 'cardtype_b'
81
80
  expect(c.errors[:permission_denied]).not_to be_empty
82
81
  end
83
82
 
84
- it "should be the original type" do
85
- lambda { change_card_to_type("basicname", "cardtype_b") }
86
- expect(Card["basicname"].type_code).to eq(:basic)
83
+ it 'should be the original type' do
84
+ lambda { change_card_to_type 'basicname', 'cardtype_b' }
85
+ expect(Card['basicname'].type_code).to eq(:basic)
87
86
  end
88
87
  end
89
88
 
90
-
91
- #describe Card, "type transition validate_delete" do
92
- # before do @c = change_card_to_type("type-c-card", :basic) end
89
+ # describe Card, "type transition validate_delete" do
90
+ # before do @c = change_card_to_type("type-c-card", :basic) end
93
91
  #
94
- # it "should have errors" do
95
- # @c.errors[:delete_error].first.should == "card c is indestructible"
96
- # end
92
+ # it "should have errors" do
93
+ # @c.errors[:delete_error].first.should == "card c is indestructible"
94
+ # end
97
95
  #
98
- # it "should retain original type" do
99
- # Card["type_c_card"].type_code.should == :cardtype_c
100
- # end
101
- #end
96
+ # it "should retain original type" do
97
+ # Card["type_c_card"].type_code.should == :cardtype_c
98
+ # end
99
+ # end
102
100
 
103
- describe Card, "type transition validate_create" do
104
- before do @c = change_card_to_type("basicname", "cardtype_d") end
101
+ describe Card, 'type transition validate_create' do
102
+ before { @c = change_card_to_type 'basicname', 'cardtype_d' }
105
103
 
106
- it "should have errors" do
107
- pending "CardtypeD does not have a codename, so this is an invalid test"
108
- expect(@c.errors[:type].first.match(/card d always has errors/)).to be_truthy
104
+ it 'should have errors' do
105
+ pending 'CardtypeD does not have a codename, so this is an invalid test'
106
+ msg = /card d always has errors/
107
+ expect(@c.errors[:type].first.match msg).to be_truthy
109
108
  end
110
109
 
111
- it "should retain original type" do
112
- pending "CardtypeD does not have a codename, so this is an invalid test"
113
- expect(Card["basicname"].type_code).to eq(:basic)
110
+ it 'should retain original type' do
111
+ pending 'CardtypeD does not have a codename, so this is an invalid test'
112
+ expect(Card['basicname'].type_code).to eq(:basic)
114
113
  end
115
114
  end
116
115
 
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.17.1
4
+ version: 1.17.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-01-28 00:00:00.000000000 Z
14
+ date: 2016-02-08 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: smartname
@@ -263,6 +263,7 @@ files:
263
263
  - db/migrate/20141216053032_better_index_names.rb
264
264
  - db/migrate/20150724210803_add_comment_to_actions.rb
265
265
  - db/migrate/20151105225559_more_space_for_db_content.rb
266
+ - db/migrate/20160122153608_new_indeces.rb
266
267
  - db/migrate_core_cards/20120611203506_rails_inflection_updates.rb
267
268
  - db/migrate_core_cards/20130411191151_renaming_for_menu.rb
268
269
  - db/migrate_core_cards/20130411211600_delete_old_related_tab_cards.rb