card 1.20.1 → 1.20.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/card.gemspec +2 -2
- data/db/migrate_core_cards/20160811115836_rename_stats_to_admin.rb +2 -2
- data/db/migrate_core_cards/20170209132834_email_test_context.rb +47 -0
- data/db/migrate_core_cards/data/mailer/follower_notification_email.html +1 -1
- data/db/migrate_core_cards/data/mailer/follower_notification_email.txt +1 -1
- data/db/migrate_core_cards/data/mailer/mail_config.json +1 -1
- data/db/seed/new/card_actions.yml +699 -771
- data/db/seed/new/card_acts.yml +64 -616
- data/db/seed/new/card_changes.yml +9222 -25055
- data/db/seed/new/card_references.yml +767 -606
- data/db/seed/new/cards.yml +2125 -1829
- data/db/seed/test/fixtures/card_actions.yml +1713 -1825
- data/db/seed/test/fixtures/card_acts.yml +341 -893
- data/db/seed/test/fixtures/card_changes.yml +20868 -36801
- data/db/seed/test/fixtures/card_references.yml +1516 -1250
- data/db/seed/test/fixtures/cards.yml +3194 -2898
- data/db/version_core_cards.txt +1 -1
- data/lib/card/env/location.rb +1 -1
- data/lib/card/format/content.rb +1 -1
- data/lib/card/format/nest/subformat.rb +2 -1
- data/lib/card/format/render.rb +19 -1
- data/lib/card/mailer.rb +5 -2
- data/lib/card/model/save_helper.rb +15 -4
- data/lib/card/name.rb +1 -45
- data/lib/card/name/fields_and_traits.rb +10 -9
- data/lib/card/name/{variants.rb → name_variants.rb} +1 -1
- data/lib/card/query.rb +28 -2
- data/lib/card/query/helpers.rb +1 -0
- data/lib/card/query/interpretation.rb +1 -0
- data/lib/card/query/relational_attributes.rb +27 -5
- data/lib/card/query/sql_statement.rb +1 -1
- data/lib/card/tasks/card/create.rake +177 -0
- data/mod/carrierwave/set/type/file.rb +1 -1
- data/mod/carrierwave/set/type/image.rb +9 -2
- data/mod/core/chunk/reference.rb +1 -1
- data/mod/core/set/all/assign_attributes.rb +14 -14
- data/mod/core/set/all/collection.rb +1 -1
- data/mod/core/set/all/fetch.rb +4 -0
- data/mod/core/set/all/haml.rb +82 -3
- data/mod/core/set/all/name.rb +7 -6
- data/mod/core/set/all/references.rb +1 -1
- data/mod/core/set/all/subcards.rb +4 -0
- data/mod/core/set_pattern/07_type_plus_right.rb +1 -1
- data/mod/core/spec/set/all/{tracked_attributes_spec.rb → assign_attributes_spec.rb} +1 -1
- data/mod/email/set/abstract/test_context.rb +26 -0
- data/mod/email/set/all/notify.rb +10 -5
- data/mod/email/set/right/html_message.rb +2 -0
- data/mod/email/set/right/subject.rb +1 -0
- data/mod/email/set/right/text_message.rb +1 -0
- data/mod/history/set/all/content_history.rb +2 -1
- data/mod/machines/set/type/coffee_script.rb +1 -1
- data/mod/pointer/set/abstract/01_pointer/edit.rb +10 -7
- data/mod/pointer/spec/set/type/pointer_spec.rb +2 -2
- data/mod/standard/set/abstract/wql_search.rb +1 -1
- data/mod/standard/set/all/rich_html/form.rb +128 -169
- data/mod/standard/set/all/rich_html/form_elements.rb +52 -0
- data/mod/standard/set/all/rich_html/formgroup.rb +34 -0
- data/mod/standard/set/type/session.rb +2 -8
- data/mod/standard/set/type/toggle.rb +23 -3
- data/mod/standard/spec/set/type/email_template/email_config_spec.rb +24 -13
- data/mod/standard/spec/set/type/toggle_spec.rb +13 -2
- data/spec/lib/card/name_spec.rb +1 -224
- data/spec/lib/card/query_spec.rb +56 -1
- data/spec/lib/card/stage_director_spec.rb +19 -0
- data/spec/support/helper/render_helper.rb +2 -0
- data/tmpsets/set/mod001-core/all/actify.rb +6 -5
- data/tmpsets/set/mod001-core/all/fetch.rb +12 -14
- data/tmpsets/set/mod001-core/all/name.rb +1 -1
- data/tmpsets/set/mod001-core/all/permissions.rb +22 -12
- data/tmpsets/set/mod001-core/all/tracked_attributes.rb +0 -76
- data/tmpsets/set/mod001-core/all/utils.rb +3 -40
- data/tmpsets/set/mod002-history/all/history.rb +2 -1
- data/tmpsets/set/mod008-solid_cache/abstract/solid_cache.rb +1 -1
- metadata +15 -17
- data/tmpsets/set/mod013-carrierwave/abstract/attachment.rb +0 -282
- data/tmpsets/set/mod013-carrierwave/type/file.rb +0 -155
- data/tmpsets/set/mod013-carrierwave/type/image.rb +0 -96
- data/tmpsets/set/mod014-admin/self/admin.rb +0 -113
- data/tmpsets/set/mod014-admin/self/admin_info.rb +0 -110
- data/tmpsets/set/mod014-admin/self/version.rb +0 -15
- data/tmpsets/set/mod015-developer/all/event_viz.rb +0 -59
- data/tmpsets/set/mod015-developer/all/view_viz.rb +0 -30
- data/tmpsets/set/mod015-developer/right/debug.rb +0 -96
@@ -1,12 +1,32 @@
|
|
1
|
+
def checked?
|
2
|
+
content == "1"
|
3
|
+
end
|
1
4
|
|
2
5
|
view :core do |_args|
|
3
6
|
case card.raw_content.to_i
|
4
7
|
when 1 then "yes"
|
5
8
|
when 0 then "no"
|
6
|
-
else
|
9
|
+
else
|
10
|
+
"?"
|
7
11
|
end
|
8
12
|
end
|
9
13
|
|
10
|
-
|
11
|
-
|
14
|
+
format :html do
|
15
|
+
view :editor do
|
16
|
+
toggle
|
17
|
+
end
|
18
|
+
|
19
|
+
view :labeled_editor do
|
20
|
+
toggle + toggle_label
|
21
|
+
end
|
22
|
+
|
23
|
+
def toggle
|
24
|
+
check_box :content
|
25
|
+
end
|
26
|
+
|
27
|
+
def toggle_label
|
28
|
+
label :content, card.cardname.tag
|
29
|
+
end
|
12
30
|
end
|
31
|
+
|
32
|
+
|
@@ -190,24 +190,35 @@ describe Card::Set::Type::EmailTemplate::EmailConfig do
|
|
190
190
|
expect(expected).to include "Nobody expects the Spanish Inquisition"
|
191
191
|
end
|
192
192
|
|
193
|
-
it "handles image nests in html message" do
|
193
|
+
it "handles inline image nests in html message in core view" do
|
194
|
+
Card::Env[:host] = "http://testhost"
|
194
195
|
update_field "*html message", content: "Triggered by {{:logo|core}}"
|
195
196
|
mail = email.format.render_mail context: context_card
|
196
|
-
expect(mail.parts
|
197
|
-
|
198
|
-
expect(mail.parts[
|
199
|
-
expect(mail.parts[
|
200
|
-
|
201
|
-
end
|
197
|
+
expect(mail.parts.size).to eq 2
|
198
|
+
expect(mail.parts[0].mime_type).to eq "text/plain"
|
199
|
+
expect(mail.parts[1].mime_type).to eq "text/html"
|
200
|
+
expect(mail.parts[1].body.raw_source)
|
201
|
+
.to include('<img src="http://testhost/files/:logo/standard-medium.png"')
|
202
|
+
end
|
203
|
+
|
204
|
+
it "handles inline image nests in html message" do
|
205
|
+
update_field "*html message", content: "Triggered by {{:logo|inline}}"
|
206
|
+
mail = email.format.render_mail context: context_card
|
207
|
+
expect(mail.parts[0].mime_type).to eq "image/png"
|
208
|
+
url = mail.parts[0].url
|
209
|
+
expect(mail.parts[2].mime_type).to eq "text/html"
|
210
|
+
expect(mail.parts[2].body.raw_source).to include('<img src="cid:')
|
211
|
+
expect(mail.parts[2].body.raw_source).to include("<img src=\"#{url}\"")
|
212
|
+
end
|
202
213
|
|
203
214
|
it "handles image nests in html message in default view" do
|
204
|
-
update_field "*html message", content: "Triggered by {{:logo}}"
|
215
|
+
update_field "*html message", content: "Triggered by {{:logo|core}}"
|
205
216
|
mail = email.format.render_mail context: context_card
|
206
|
-
expect(mail.parts
|
207
|
-
|
208
|
-
expect(mail.parts[
|
209
|
-
expect(mail.parts[
|
210
|
-
|
217
|
+
expect(mail.parts.size).to eq 2
|
218
|
+
expect(mail.parts[0].mime_type).to eq "text/plain"
|
219
|
+
expect(mail.parts[1].mime_type).to eq "text/html"
|
220
|
+
expect(mail.parts[1].body.raw_source)
|
221
|
+
.to include('<img src="/files/:logo/standard-medium.png"')
|
211
222
|
end
|
212
223
|
|
213
224
|
it "handles contextual name for attachments" do
|
@@ -6,8 +6,19 @@ describe Card::Set::Type::Toggle do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it "has yes/no as processed content" do
|
9
|
-
expect(
|
10
|
-
expect(
|
9
|
+
expect(render_view(:core, type: "Toggle", content: "0")).to eq("no")
|
10
|
+
expect(render_view(:closed_content, type: "Toggle", content: "1"))
|
11
11
|
.to eq("yes")
|
12
12
|
end
|
13
|
+
|
14
|
+
describe "view :labeled_editor" do
|
15
|
+
subject { render_view :labeled_editor, type: :toggle, name: "A+toggle" }
|
16
|
+
it "has checkbox label" do
|
17
|
+
is_expected.to have_tag("label", with: { for: "card_content" }) do
|
18
|
+
with_text "toggle"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
13
22
|
end
|
23
|
+
|
24
|
+
|
data/spec/lib/card/name_spec.rb
CHANGED
@@ -1,105 +1,7 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
|
-
describe Card::Name do
|
4
|
-
describe "#key" do
|
5
|
-
it "lowercases and underscores" do
|
6
|
-
expect("This Name".to_name.key).to eq("this_name")
|
7
|
-
end
|
8
|
-
|
9
|
-
it "removes spaces" do
|
10
|
-
expect("this Name".to_name.key).to eq("this_name")
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "underscores" do
|
14
|
-
it "is treated like spaces" do
|
15
|
-
expect("weird_ combo".to_name.key).to eq("weird combo".to_name.key)
|
16
|
-
end
|
17
|
-
|
18
|
-
it "does not impede pluralization checks" do
|
19
|
-
expect("Mamas_and_Papas".to_name.key).to(
|
20
|
-
eq("Mamas and Papas".to_name.key)
|
21
|
-
)
|
22
|
-
end
|
23
|
-
|
24
|
-
it "is removed when before first word character" do
|
25
|
-
expect("_This Name".to_name.key).to eq("this_name")
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
it "singularizes" do
|
30
|
-
expect("ethans".to_name.key).to eq("ethan")
|
31
|
-
end
|
32
|
-
|
33
|
-
it "changes CamelCase to snake case" do
|
34
|
-
expect("ThisThing".to_name.key).to eq("this_thing")
|
35
|
-
end
|
36
|
-
|
37
|
-
it "handles plus cards" do
|
38
|
-
expect("ThisThing+Ethans".to_name.key).to eq("this_thing+ethan")
|
39
|
-
end
|
40
|
-
|
41
|
-
it "retains * for star cards" do
|
42
|
-
expect("*right".to_name.key).to eq("*right")
|
43
|
-
end
|
44
|
-
|
45
|
-
it "does not singularize double s's" do
|
46
|
-
expect("grass".to_name.key).to eq("grass")
|
47
|
-
end
|
48
|
-
|
49
|
-
it "does not singularize letter 'S'" do
|
50
|
-
expect("S".to_name.key).to eq("s")
|
51
|
-
end
|
52
|
-
|
53
|
-
it "handles unicode characters" do
|
54
|
-
expect("Mañana".to_name.key).to eq("mañana")
|
55
|
-
end
|
56
|
-
|
57
|
-
it "handles weird initial characters" do
|
58
|
-
expect("__you motha @\#$".to_name.key).to eq("you_motha")
|
59
|
-
expect("?!_you motha @\#$".to_name.key).to eq("you_motha")
|
60
|
-
end
|
61
|
-
|
62
|
-
it "allows numbers" do
|
63
|
-
expect("3way".to_name.key).to eq("3way")
|
64
|
-
end
|
65
|
-
|
66
|
-
it "internal plurals" do
|
67
|
-
expect("cards hooks label foos".to_name.key).to eq("card_hook_label_foo")
|
68
|
-
end
|
69
|
-
|
70
|
-
it "handles html entities" do
|
71
|
-
# This no longer takes off the s, is singularize broken now?
|
72
|
-
expect("Jean-françois Noubel".to_name.key).to(
|
73
|
-
eq("jean_françoi_noubel")
|
74
|
-
)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe "#url_key" do
|
79
|
-
cardnames = ["GrassCommons.org", "Oh you @##", "Alice's Restaurant!",
|
80
|
-
"PB & J", "Mañana"].map(&:to_name)
|
81
|
-
|
82
|
-
cardnames.each do |cardname|
|
83
|
-
it "has the same key as the name" do
|
84
|
-
k = cardname.key
|
85
|
-
k2 = cardname.url_key
|
86
|
-
# warn "cn tok #{cardname.inspect}, #{k.inspect}, #{k2.inspect}"
|
87
|
-
expect(k).to eq(k2.to_name.key)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
3
|
+
RSpec.describe Card::Name do
|
92
4
|
describe "#valid" do
|
93
|
-
it "accepts valid names" do
|
94
|
-
expect("this+THAT".to_name).to be_valid
|
95
|
-
expect("THE*ONE*AND$!ONLY".to_name).to be_valid
|
96
|
-
end
|
97
|
-
|
98
|
-
it "rejects invalid names" do
|
99
|
-
# 'Tes~sd'.to_name.should_not be_valid
|
100
|
-
expect("TEST/DDER".to_name).not_to be_valid
|
101
|
-
end
|
102
|
-
|
103
5
|
it "rejects long names" do
|
104
6
|
card = Card.new
|
105
7
|
card.name = "1" * 256
|
@@ -107,48 +9,6 @@ describe Card::Name do
|
|
107
9
|
end
|
108
10
|
end
|
109
11
|
|
110
|
-
describe "#left_name" do
|
111
|
-
it "returns nil for non junction" do
|
112
|
-
expect("a".to_name.left_name).to eq(nil)
|
113
|
-
end
|
114
|
-
|
115
|
-
it "returns parent for parent" do
|
116
|
-
expect("a+b+c+d".to_name.left_name).to eq("a+b+c")
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
describe "#tag_name" do
|
121
|
-
it "returns last part of plus card" do
|
122
|
-
expect("a+b+c".to_name.tag).to eq("c")
|
123
|
-
end
|
124
|
-
|
125
|
-
it "returns name of simple card" do
|
126
|
-
expect("a".to_name.tag).to eq("a")
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
describe "#safe_key" do
|
131
|
-
it "subs pluses & stars" do
|
132
|
-
expect("Alpha?+*be-ta".to_name.safe_key).to eq("alpha-Xbe_tum")
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
describe "#replace_part" do
|
137
|
-
it "replaces first name part" do
|
138
|
-
expect("a+b".to_name.replace_part("a", "x").to_s).to eq("x+b")
|
139
|
-
end
|
140
|
-
it "replaces second name part" do
|
141
|
-
expect("a+b".to_name.replace_part("b", "x").to_s).to eq("a+x")
|
142
|
-
end
|
143
|
-
it "replaces two name parts" do
|
144
|
-
expect("a+b+c".to_name.replace_part("a+b", "x").to_s).to eq("x+c")
|
145
|
-
expect("a+b+c+d".to_name.replace_part("a+b", "e+f").to_s).to eq("e+f+c+d")
|
146
|
-
end
|
147
|
-
it "doesn't replace two part tag" do
|
148
|
-
expect("a+b+c".to_name.replace_part("b+c", "x").to_s).to eq("a+b+c")
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
12
|
describe "Cardnames star handling" do
|
153
13
|
it "recognizes star cards" do
|
154
14
|
expect("*a".to_name.star?).to be_truthy
|
@@ -191,76 +51,6 @@ describe Card::Name do
|
|
191
51
|
end
|
192
52
|
|
193
53
|
describe "#to_absolute" do
|
194
|
-
it "handles _self, _whole, _" do
|
195
|
-
expect("_self".to_name.to_absolute("foo")).to eq("foo")
|
196
|
-
expect("_whole".to_name.to_absolute("foo")).to eq("foo")
|
197
|
-
expect("_".to_name.to_absolute("foo")).to eq("foo")
|
198
|
-
end
|
199
|
-
|
200
|
-
it "handles _left" do
|
201
|
-
expect("_left+Z".to_name.to_absolute("A+B+C")).to eq("A+B+Z")
|
202
|
-
end
|
203
|
-
|
204
|
-
it "handles white space" do
|
205
|
-
expect("_left + Z".to_name.to_absolute("A+B+C")).to eq("A+B+Z")
|
206
|
-
end
|
207
|
-
|
208
|
-
it "handles _right" do
|
209
|
-
expect("_right+bang".to_name.to_absolute("nutter+butter")).to(
|
210
|
-
eq("butter+bang")
|
211
|
-
)
|
212
|
-
expect("C+_right".to_name.to_absolute("B+A")).to eq("C+A")
|
213
|
-
end
|
214
|
-
|
215
|
-
it "handles leading +" do
|
216
|
-
expect("+bug".to_name.to_absolute("hum")).to eq("hum+bug")
|
217
|
-
end
|
218
|
-
|
219
|
-
it "handles trailing +" do
|
220
|
-
expect("bug+".to_name.to_absolute("tracks")).to eq("bug+tracks")
|
221
|
-
end
|
222
|
-
|
223
|
-
it "handles _(numbers)" do
|
224
|
-
expect("_1".to_name.to_absolute("A+B+C")).to eq("A")
|
225
|
-
expect("_1+_2".to_name.to_absolute("A+B+C")).to eq("A+B")
|
226
|
-
expect("_2+_3".to_name.to_absolute("A+B+C")).to eq("B+C")
|
227
|
-
end
|
228
|
-
|
229
|
-
it "handles _LLR etc" do
|
230
|
-
expect("_R".to_name.to_absolute("A+B+C+D+E")).to eq("E")
|
231
|
-
expect("_L".to_name.to_absolute("A+B+C+D+E")).to eq("A+B+C+D")
|
232
|
-
expect("_LR".to_name.to_absolute("A+B+C+D+E")).to eq("D")
|
233
|
-
expect("_LL".to_name.to_absolute("A+B+C+D+E")).to eq("A+B+C")
|
234
|
-
expect("_LLR".to_name.to_absolute("A+B+C+D+E")).to eq("C")
|
235
|
-
expect("_LLL".to_name.to_absolute("A+B+C+D+E")).to eq("A+B")
|
236
|
-
expect("_LLLR".to_name.to_absolute("A+B+C+D+E")).to eq("B")
|
237
|
-
expect("_LLLL".to_name.to_absolute("A+B+C+D+E")).to eq("A")
|
238
|
-
end
|
239
|
-
|
240
|
-
context "mismatched requests" do
|
241
|
-
it "returns _self for _left or _right on simple cards" do
|
242
|
-
expect("_left+Z".to_name.to_absolute("A")).to eq("A+Z")
|
243
|
-
expect("_right+Z".to_name.to_absolute("A")).to eq("A+Z")
|
244
|
-
end
|
245
|
-
|
246
|
-
it "handles bogus numbers" do
|
247
|
-
expect("_1".to_name.to_absolute("A")).to eq("A")
|
248
|
-
expect("_1+_2".to_name.to_absolute("A")).to eq("A+A")
|
249
|
-
expect("_2+_3".to_name.to_absolute("A")).to eq("A+A")
|
250
|
-
end
|
251
|
-
|
252
|
-
it "handles bogus _llr requests" do
|
253
|
-
expect("_R".to_name.to_absolute("A")).to eq("A")
|
254
|
-
expect("_L".to_name.to_absolute("A")).to eq("A")
|
255
|
-
expect("_LR".to_name.to_absolute("A")).to eq("A")
|
256
|
-
expect("_LL".to_name.to_absolute("A")).to eq("A")
|
257
|
-
expect("_LLR".to_name.to_absolute("A")).to eq("A")
|
258
|
-
expect("_LLL".to_name.to_absolute("A")).to eq("A")
|
259
|
-
expect("_LLLR".to_name.to_absolute("A")).to eq("A")
|
260
|
-
expect("_LLLL".to_name.to_absolute("A")).to eq("A")
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
54
|
it "does session user substitution" do
|
265
55
|
expect("_user".to_name.to_absolute("A")).to eq(Card::Auth.current.name)
|
266
56
|
Card::Auth.as_bot do
|
@@ -269,19 +59,6 @@ describe Card::Name do
|
|
269
59
|
end
|
270
60
|
end
|
271
61
|
|
272
|
-
describe "#to_show" do
|
273
|
-
it "ignores ignorables" do
|
274
|
-
expect("you+awe".to_name.to_show("you")).to eq("+awe")
|
275
|
-
# HMMM..... what should this do?
|
276
|
-
expect("me+you+awe".to_name.to_show("you")).to eq("me+awe")
|
277
|
-
expect("me+you+awe".to_name.to_show("me")).to eq("+you+awe")
|
278
|
-
expect("me+you+awe".to_name.to_show("me", "you")).to eq("+awe")
|
279
|
-
expect("me+you".to_name.to_show("me", "you")).to eq("me+you")
|
280
|
-
expect("?a?+awe".to_name.to_show("A")).to eq("+awe")
|
281
|
-
expect("+awe".to_name.to_show).to eq("+awe")
|
282
|
-
end
|
283
|
-
end
|
284
|
-
|
285
62
|
describe "part creation" do
|
286
63
|
it "creates parts" do
|
287
64
|
Card::Auth.as_bot do
|
data/spec/lib/card/query_spec.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
|
-
|
3
|
+
|
4
|
+
RSpec.describe Card::Query do
|
4
5
|
A_JOINEES = %w(B C D E F).freeze
|
5
6
|
CARDS_MATCHING_TWO = ["Joe User", "One+Two", "One+Two+Three",
|
6
7
|
"script: slot+*all+*script+*machine cache",
|
@@ -168,6 +169,40 @@ describe Card::Query do
|
|
168
169
|
end
|
169
170
|
end
|
170
171
|
|
172
|
+
describe "updated_by/updater_of" do
|
173
|
+
it "finds card updated by Narcissist" do
|
174
|
+
@query = { updated_by: "Narcissist" }
|
175
|
+
is_expected.to eq(%w(Magnifier+lens))
|
176
|
+
end
|
177
|
+
|
178
|
+
it "finds Narcississt as the card's updater" do
|
179
|
+
@query = { updater_of: "Magnifier+lens" }
|
180
|
+
is_expected.to eq(%w(Narcissist))
|
181
|
+
end
|
182
|
+
|
183
|
+
it "does not give duplicate results for multiple updates" do
|
184
|
+
@query = { updater_of: "First" }
|
185
|
+
is_expected.to eq(["Wagn Bot"])
|
186
|
+
end
|
187
|
+
|
188
|
+
it "does not give results if not updated" do
|
189
|
+
@query = { updater_of: "Sunglasses+price" }
|
190
|
+
is_expected.to be_empty
|
191
|
+
end
|
192
|
+
|
193
|
+
it "'or' doesn't mess up updated_by SQL" do
|
194
|
+
@query = { or: { updated_by: "Narcissist" } }
|
195
|
+
puts Card::Query.new(@query).sql
|
196
|
+
is_expected.to eq(%w(Magnifier+lens))
|
197
|
+
end
|
198
|
+
|
199
|
+
it "'or' doesn't mess up updater_of SQL" do
|
200
|
+
@query = { or: { updater_of: "First" } }
|
201
|
+
puts Card::Query.new(@query).sql
|
202
|
+
is_expected.to eq(["Wagn Bot"])
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
171
206
|
describe "created_by/creator_of" do
|
172
207
|
before do
|
173
208
|
Card.create name: "Create Test", content: "sufficiently distinctive"
|
@@ -580,4 +615,24 @@ describe Card::Query do
|
|
580
615
|
expect(perm_count).to eq(2)
|
581
616
|
end
|
582
617
|
end
|
618
|
+
|
619
|
+
describe "return part of name" do
|
620
|
+
subject do
|
621
|
+
Card::Query.run right: "C", return: @return, sort: :name
|
622
|
+
end
|
623
|
+
it "handles _left" do
|
624
|
+
@return = "_left"
|
625
|
+
is_expected.to eq %w(A+B A)
|
626
|
+
end
|
627
|
+
|
628
|
+
it "handles _right" do
|
629
|
+
@return = "_right"
|
630
|
+
is_expected.to eq %w(C C)
|
631
|
+
end
|
632
|
+
|
633
|
+
it "handles _LL" do
|
634
|
+
@return = "_LL"
|
635
|
+
is_expected.to eq ["A", ""]
|
636
|
+
end
|
637
|
+
end
|
583
638
|
end
|
@@ -354,6 +354,10 @@ describe Card::ActManager::StageDirector do
|
|
354
354
|
}
|
355
355
|
end
|
356
356
|
|
357
|
+
def create_single_card
|
358
|
+
Card.create! name: "single card"
|
359
|
+
end
|
360
|
+
|
357
361
|
it "has correct name if supercard's name get changed" do
|
358
362
|
Card::Auth.as_bot do
|
359
363
|
changed = false
|
@@ -385,6 +389,21 @@ describe Card::ActManager::StageDirector do
|
|
385
389
|
end
|
386
390
|
end
|
387
391
|
|
392
|
+
it "load type_plus_right set module" do
|
393
|
+
Card::Auth.as_bot do
|
394
|
+
in_stage :prepare_to_validate,
|
395
|
+
on: :create,
|
396
|
+
for: "single card",
|
397
|
+
trigger: :create_single_card do
|
398
|
+
|
399
|
+
u_card = attach_subfield "a user", type_id: Card::UserID
|
400
|
+
f_card = u_card.attach_subfield "*follow"
|
401
|
+
expect(f_card.set_modules)
|
402
|
+
.to include(Card::Set::TypePlusRight::User::Follow)
|
403
|
+
end
|
404
|
+
end
|
405
|
+
end
|
406
|
+
|
388
407
|
it "adds subsubcard to correct subdirector" do
|
389
408
|
Card::Auth.as_bot do
|
390
409
|
in_stage :prepare_to_store,
|