card 1.101.3 → 1.101.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/config/initializers/02_patches/active_record.rb +1 -1
  4. data/config/locales/en.yml +155 -378
  5. data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +1 -1
  6. data/lib/card.rb +15 -2
  7. data/lib/card/auth.rb +5 -2
  8. data/lib/card/auth/current.rb +39 -100
  9. data/lib/card/auth/proxy.rb +36 -16
  10. data/lib/card/auth/token.rb +6 -0
  11. data/lib/card/cache/all.rb +83 -0
  12. data/lib/card/cache/card_class.rb +41 -0
  13. data/lib/card/cache/persistent.rb +3 -34
  14. data/lib/card/cache/persistent_class.rb +28 -0
  15. data/lib/card/codename.rb +1 -1
  16. data/lib/card/content.rb +16 -2
  17. data/lib/card/content/all.rb +59 -0
  18. data/lib/card/director/act_direction.rb +4 -0
  19. data/lib/card/director/all.rb +61 -0
  20. data/lib/card/director/card_class.rb +18 -0
  21. data/lib/card/director/phases.rb +0 -1
  22. data/lib/card/dirty.rb +13 -3
  23. data/lib/card/env/success.rb +14 -14
  24. data/lib/card/env/success/target.rb +9 -11
  25. data/lib/card/error.rb +1 -1
  26. data/lib/card/fetch/all.rb +32 -0
  27. data/lib/card/fetch/card_class.rb +147 -0
  28. data/lib/card/format.rb +1 -1
  29. data/lib/card/format/error.rb +3 -3
  30. data/lib/card/format/nest.rb +1 -1
  31. data/lib/card/format/nest/fetch.rb +1 -1
  32. data/lib/card/lexicon.rb +2 -2
  33. data/lib/card/name/all.rb +8 -0
  34. data/lib/card/name/all/descendants.rb +6 -3
  35. data/lib/card/name/card_class.rb +26 -0
  36. data/lib/card/reference/all.rb +131 -0
  37. data/lib/card/rule/all.rb +75 -0
  38. data/lib/card/set/event/all.rb +95 -0
  39. data/lib/card/set/event/skip_and_trigger.rb +89 -0
  40. data/lib/card/set/pattern/all.rb +63 -0
  41. data/lib/card/subcards/all.rb +103 -0
  42. data/lib/cardio/migration/import.rb +1 -1
  43. data/lib/cardio/utils.rb +5 -3
  44. data/mod/admin/set/self/admin_info.rb +3 -5
  45. data/mod/admin/set/self/trash.rb +2 -2
  46. data/mod/core/set/all/autoname.rb +17 -0
  47. data/mod/core/set/all/codename.rb +2 -2
  48. data/mod/core/set/all/content.rb +52 -97
  49. data/mod/core/set/all/name_events.rb +69 -58
  50. data/mod/core/set/all/reference_events.rb +67 -0
  51. data/mod/core/set/all/states.rb +2 -2
  52. data/mod/core/set/all/subcards.rb +0 -100
  53. data/mod/core/set/all/trash.rb +11 -13
  54. data/mod/core/set/all/type.rb +7 -9
  55. data/mod/core/set/all/utils.rb +3 -0
  56. data/mod/core/set/type/cardtype.rb +3 -3
  57. data/mod/core/set_pattern/06_rule.rb +1 -1
  58. data/mod/core/spec/set/all/{rules2_spec.rb → clean_me_spec.rb} +0 -0
  59. data/mod/core/spec/set/all/name_events_spec.rb +204 -0
  60. metadata +30 -37
  61. data/lib/card/mod_inflector.rb +0 -16
  62. data/lib/card/name/all/class_methods.rb +0 -28
  63. data/mod/core/set/all/actify.rb +0 -68
  64. data/mod/core/set/all/cache.rb +0 -109
  65. data/mod/core/set/all/event_conditions.rb +0 -172
  66. data/mod/core/set/all/fetch.rb +0 -122
  67. data/mod/core/set/all/fetch_helper.rb +0 -35
  68. data/mod/core/set/all/i18n.rb +0 -9
  69. data/mod/core/set/all/pattern.rb +0 -54
  70. data/mod/core/set/all/references.rb +0 -191
  71. data/mod/core/set/all/rename.rb +0 -33
  72. data/mod/core/set/all/rules.rb +0 -81
  73. data/mod/core/spec/set/all/actify_spec.rb +0 -58
  74. data/mod/core/spec/set/all/content_spec.rb +0 -15
  75. data/mod/core/spec/set/all/event_conditions_spec.rb +0 -217
  76. data/mod/core/spec/set/all/fetch_helper_spec.rb +0 -65
  77. data/mod/core/spec/set/all/fetch_spec.rb +0 -338
  78. data/mod/core/spec/set/all/i18n_spec.rb +0 -17
  79. data/mod/core/spec/set/all/pattern_spec.rb +0 -101
  80. data/mod/core/spec/set/all/permissions/reader_rules_spec.rb +0 -166
  81. data/mod/core/spec/set/all/references_spec.rb +0 -62
  82. data/mod/core/spec/set/all/rename_spec.rb +0 -189
  83. data/mod/core/spec/set/all/rules_spec.rb +0 -100
  84. data/mod/core/spec/set/all/subcards_spec.rb +0 -102
@@ -1,17 +0,0 @@
1
- #require '#benchmark/ips'
2
- #
3
- #RSpec.describe Card::Set::All::I18n do
4
- # it "can access scope" do
5
- # expect(Card["A"].format.t(:key))
6
- # .to eq "translation missing: en.mod.spec.set.all.i18n_spec.key"
7
- # end
8
- #
9
- # it "gets correct text" do
10
- # x.report('with auto_scope') do
11
- # Card[:admin_info].format(:html).warning_list_with_auto_scope([])
12
- # end
13
- # x.report('with explicit scope') do
14
- # Card[:admin_info].format(:html).warning_list([])
15
- # end
16
- # end
17
- #end
@@ -1,101 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- RSpec.describe Card::Set::All::Pattern do
4
- describe :set_names do
5
- it "returns self, type, all for simple cards" do
6
- Card::Auth.as_bot do
7
- card = Card.new(name: "AnewCard")
8
- expect(card.set_names).to eq(["RichText+*type", "*all"])
9
- card.save!
10
- card = Card.fetch("AnewCard")
11
- expect(card.set_names).to eq(["AnewCard+*self", "RichText+*type", "*all"])
12
- end
13
- end
14
-
15
- it "returns set names for simple star cards" do
16
- Card::Auth.as_bot do
17
- expect(Card.fetch("*update").set_names).to eq(
18
- [
19
- "*update+*self", "*star", "Setting+*type", "*all"
20
- ]
21
- )
22
- end
23
- end
24
-
25
- it "returns set names for junction cards" do
26
- Card::Auth.as_bot do
27
- expect(Card.new(name: "Iliad+author").set_names).to eq(
28
- [
29
- "Book+author+*type plus right", "author+*right", "RichText+*type",
30
- "*all plus", "*all"
31
- ]
32
- )
33
- end
34
- end
35
-
36
- it "returns set names for compound star cards", as_bot: true do
37
- expect(Card.new(name: "Iliad+*to").set_names).to eq(
38
- [
39
- "Book+*to+*type plus right", "*to+*right", "*rstar",
40
- "List+*type", "*all plus", "*all"
41
- ]
42
- )
43
- end
44
-
45
- it "returns set names for rule cards", as_bot: true do
46
- expect(Card.new(name: "*all+*create").set_names).to eq(
47
- [
48
- "Set+*create+*type plus right", "*create+*right", "*rule", "*rstar",
49
- "List+*type", "*all plus", "*all"
50
- ]
51
- )
52
- end
53
-
54
- # right place for this? really need more prototype tests...
55
- it "handles type plus right prototypes properly" do
56
- Card::Auth.as_bot do
57
- sets = Card.fetch("Fruit+flavor+*type plus right").prototype.set_names
58
- expect(sets).to include("Fruit+flavor+*type plus right")
59
- end
60
- end
61
- end
62
-
63
- describe :rule_set_keys do
64
- it "returns correct set names for new cards" do
65
- card = Card.new name: "AnewCard"
66
- expect(card.rule_set_keys).to eq(["#{Card::BasicID}+type", "all"])
67
- end
68
- end
69
-
70
- describe :safe_set_keys do
71
- it "returns css names for simple star cards" do
72
- Card::Auth.as_bot do
73
- card = Card.new(name: "*AnewCard")
74
- expect(card.safe_set_keys).to eq("ALL TYPE-rich_text STAR")
75
- card.save!
76
- card = Card.fetch("*AnewCard")
77
- expect(card.safe_set_keys).to eq("ALL TYPE-rich_text STAR SELF-Xanew_card")
78
- end
79
- end
80
-
81
- it "returns set names for junction cards" do
82
- card = Card.new(name: "Iliad+author")
83
- expect(card.safe_set_keys).to eq(
84
- "ALL ALL_PLUS TYPE-rich_text RIGHT-author TYPE_PLUS_RIGHT-book-author"
85
- )
86
- card.save!
87
- card = Card.fetch("Iliad+author")
88
- expect(card.safe_set_keys).to eq(
89
- "ALL ALL_PLUS TYPE-rich_text RIGHT-author TYPE_PLUS_RIGHT-book-author "\
90
- "SELF-iliad-author"
91
- )
92
- end
93
- end
94
-
95
- describe :label do
96
- it "returns label for name" do
97
- expect(Card.new(name: "address+*right").label)
98
- .to eq(%(All "+address" cards))
99
- end
100
- end
101
- end
@@ -1,166 +0,0 @@
1
- describe Card::Set::All::Permissions do
2
- describe "reader rules" do
3
- before do
4
- @perm_card = Card.new name: "Home+*self+*read", type: "Pointer",
5
- content: "[[Anyone Signed In]]"
6
- end
7
-
8
- it "is *all+*read by default" do
9
- card = Card.fetch("Home")
10
- expect(card.read_rule_id).to eq(Card.fetch("*all+*read").id)
11
- expect(card.who_can(:read)).to eq([Card::AnyoneID])
12
- Card::Auth.as(:anonymous) { expect(card.ok?(:read)).to be_truthy }
13
- end
14
-
15
- it "updates to role ('Anyone Signed In')" do
16
- name = @perm_card.name
17
- Card::Auth.as_bot { @perm_card.save! }
18
- pc = Card[name]
19
- card = Card["Home"]
20
- # warn "card #{name}, #{card.inspect}, #{pc.inspect}"
21
- expect(pc).to be
22
- expect(card.read_rule_id).to eq(pc.id)
23
- expect(card.who_can(:read)).to eq([Card::AnyoneSignedInID])
24
- Card::Auth.as(:anonymous) { expect(card.ok?(:read)).to be_falsey }
25
- end
26
-
27
- it "updates to user ('Joe Admin')" do
28
- @perm_card.db_content = "[[Joe Admin]]"
29
- Card::Auth.as_bot { @perm_card.save! }
30
-
31
- card = Card.fetch("Home")
32
- expect(card.read_rule_id).to eq(@perm_card.id)
33
- expect(card.who_can(:read)).to eq([Card["joe_admin"].id])
34
- Card::Auth.as(:anonymous) { expect(card.ok?(:read)).to be_falsey }
35
- Card::Auth.as("joe_user") { expect(card.ok?(:read)).to be_falsey }
36
- Card::Auth.as("joe_admin") { expect(card.ok?(:read)).to be_truthy }
37
- Card::Auth.as_bot { expect(card.ok?(:read)).to be_truthy }
38
- end
39
-
40
- context "when more specific (self) rule is deleted" do
41
- it "reverts to more general rule" do
42
- Card::Auth.as_bot do
43
- @perm_card.save!
44
- @perm_card.delete!
45
- end
46
- card = Card.fetch("Home")
47
- expect(card.read_rule_id).to eq(Card.fetch("*all+*read").id)
48
- end
49
- end
50
-
51
- context "when more specific (right) rule is deleted" do
52
- it "reverts to more general rule" do
53
- pc = nil
54
- Card::Auth.as_bot do
55
- pc = Card.create name: "B+*right+*read", type: "Pointer",
56
- content: "[[Anyone Signed In]]"
57
- end
58
- expect(pc).to be
59
- card = Card.fetch("A+B")
60
- expect(card.read_rule_id).to eq(pc.id)
61
- # important to re-fetch to catch issues
62
- # with detecting change in trash status.
63
- pc = Card.fetch(pc.name)
64
- Card::Auth.as_bot { pc.delete }
65
- card = Card.fetch("A+B")
66
- expect(card.read_rule_id).to eq(Card.fetch("*all+*read").id)
67
- end
68
- end
69
-
70
- context "when more specific rule is renamed" do
71
- it "reverts to more general rule" do
72
- Card::Auth.as_bot do
73
- @perm_card.save!
74
- @perm_card = Card[@perm_card.name]
75
- @perm_card.name = "Something else+*self+*read"
76
- @perm_card.save!
77
- end
78
-
79
- card = Card.fetch("Home")
80
- expect(card.read_rule_id).to eq(Card.fetch("*all+*read").id)
81
- end
82
- end
83
-
84
- it "gets not overruled by a more general rule added later" do
85
- Card::Auth.as_bot do
86
- @perm_card.save!
87
- c = Card.fetch("Home")
88
- c.type_id = Card::PhraseID
89
- c.save!
90
- Card.create name: "Phrase+*type+*read", type: "Pointer",
91
- content: "[[Joe User]]"
92
- end
93
-
94
- card = Card.fetch("Home")
95
- expect(card.read_rule_id).to eq(@perm_card.id)
96
- end
97
-
98
- it "gets updated when trunk type change makes " \
99
- "type-plus-right apply / unapply" do
100
- @perm_card.name = "Phrase+B+*type plus right+*read"
101
- Card::Auth.as_bot { @perm_card.save! }
102
- expect(Card.fetch("A+B").read_rule_id).to eq(Card.fetch("*all+*read").id)
103
- c = Card.fetch("A")
104
- c.type_id = Card::PhraseID
105
- c.save!
106
- expect(Card.fetch("A+B").read_rule_id).to eq(@perm_card.id)
107
- end
108
-
109
- it "works with relative settings" do
110
- Card::Auth.as_bot do
111
- @perm_card.save!
112
- all_plus = Card.fetch "*all plus+*read", new: { content: "_left" }
113
- all_plus.save
114
- end
115
- c = Card.new(name: "Home+Heart")
116
- expect(c.who_can(:read)).to eq([Card::AnyoneSignedInID])
117
- expect(c.permission_rule_id(:read)).to eq(@perm_card.id)
118
- c.save
119
- expect(c.read_rule_id).to eq(@perm_card.id)
120
- end
121
-
122
- it "gets updated when relative settings change" do
123
- Card::Auth.as_bot do
124
- all_plus = Card.fetch "*all plus+*read", new: { content: "_left" }
125
- all_plus.save
126
- end
127
- c = Card.new(name: "Home+Heart")
128
- expect(c.who_can(:read)).to eq([Card::AnyoneID])
129
- expect(c.permission_rule_id(:read)).to(
130
- eq(Card.fetch("*all+*read").id)
131
- )
132
- c.save
133
- expect(c.read_rule_id).to eq(Card.fetch("*all+*read").id)
134
- Card::Auth.as_bot { @perm_card.save! }
135
- c2 = Card.fetch("Home+Heart")
136
- expect(c2.who_can(:read)).to eq([Card::AnyoneSignedInID])
137
- expect(c2.read_rule_id).to eq(@perm_card.id)
138
- expect(Card.fetch("Home+Heart").read_rule_id).to(
139
- eq(@perm_card.id)
140
- )
141
- Card::Auth.as_bot { @perm_card.delete }
142
- expect(Card.fetch("Home").read_rule_id).to eq(Card.fetch("*all+*read").id)
143
- expect(Card.fetch("Home+Heart").read_rule_id).to(
144
- eq(Card.fetch("*all+*read").id)
145
- )
146
- end
147
-
148
- it "insures that class overrides work with relative settings" do
149
- Card::Auth.as_bot do
150
- all_plus = Card.fetch "*all plus+*read", new: { content: "_left" }
151
- all_plus.save
152
- Card::Auth.as_bot { @perm_card.save! }
153
- c = Card.create(name: "Home+Heart")
154
- expect(c.read_rule_id).to eq(@perm_card.id)
155
- r = Card.create name: "Heart+*right+*read", type: "Pointer",
156
- content: "[[Administrator]]"
157
- expect(Card.fetch("Home+Heart").read_rule_id).to eq(r.id)
158
- end
159
- end
160
-
161
- it "works on virtual+virtual cards" do
162
- c = Card.fetch("Number+*type+by name")
163
- expect(c.ok?(:read)).to be_truthy
164
- end
165
- end
166
- end
@@ -1,62 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- RSpec.describe Card::Set::All::References do
4
- it "replaces references should work on nests inside links" do
5
- card = Card.create! name: "ref test", content: "[[test_card|test{{test}}]]"
6
- assert_equal "[[test_card|test{{best}}]]",
7
- card.replace_reference_syntax("test", "best")
8
- end
9
-
10
- describe "#referers" do
11
- it "returns all cards that refer to card" do
12
- expect(Card["Blue"].referers.map(&:name))
13
- .to contain_exactly(
14
- "blue includer 1", "blue includer 2", "blue linker 1", "blue linker 2"
15
- )
16
- end
17
- end
18
-
19
- describe "#nesters" do
20
- it "returns all cards that nest card" do
21
- expect(Card["Blue"].nesters.map(&:name))
22
- .to contain_exactly("blue includer 1", "blue includer 2")
23
- end
24
- end
25
-
26
- describe "#referee" do
27
- it "returns all cards that card nests" do
28
- expect(Card["Y"].referees.map(&:name)).to contain_exactly("A", "A+B", "B", "T")
29
- end
30
-
31
- it "returns all cards that card links to and their ancestors" do
32
- # NOTE: B is not directly referred to; the reference is implied by the link to A+B
33
- expect(Card["X"].referees.map(&:name)).to contain_exactly("A", "A+B", "B", "T")
34
- end
35
- end
36
-
37
- describe "#nestee" do
38
- it "returns all cards that card nests" do
39
- expect(Card["Y"].nestees.map(&:name)).to contain_exactly("A", "A+B", "B", "T")
40
- end
41
-
42
- it "returns all cards that card links to" do
43
- expect(Card["X"].nestees.map(&:name)).to eq([])
44
- end
45
- end
46
-
47
- describe "event :update_referer_content" do
48
- it "handles self references" do
49
- Card["A"].update! name: "AAA", update_referers: true
50
- expect(Card["X"].content).to eq("[[AAA]] [[AAA+B]] [[T]]")
51
- end
52
-
53
- # FIXME: following should pass!
54
- xit "handles reference loops" do
55
- Card["A"].update! content: "[[A+B]] refers to me"
56
- Card["A+B"].update! content: "[[A]] refers to me, too"
57
- Card["A"].update! name: "AAA", update_referers: true
58
- expect(Card["AAA+B"].content).to eq("[[AAA]] refers to me, too")
59
- expect(Card["AAA"].content).to eq("[[AAA+B]] refers to me")
60
- end
61
- end
62
- end
@@ -1,189 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- module RenameMethods
4
- def name_invariant_attributes card
5
- descendant_ids = []
6
- card.each_descendant { |d| descendant_ids << d.id }
7
- {
8
- content: card.db_content,
9
- # updater_id: card.updater_id,
10
- # revisions: card.actions.count,
11
- referers: card.referers.map(&:name).sort,
12
- referees: card.referees.map(&:name).sort,
13
- descendants: descendant_ids.sort
14
- }
15
- end
16
-
17
- def assert_rename card, new_name
18
- if card.is_a? String
19
- card = Card[card].refresh || raise("Couldn't find card named #{card}")
20
- end
21
- attrs_before = name_invariant_attributes(card)
22
- actions_count_before = card.actions.count
23
- update! card.name, name: new_name, update_referers: true
24
- expect(card.actions.count).to eq(actions_count_before + 1)
25
- assert_equal attrs_before, name_invariant_attributes(card)
26
- assert_equal new_name, card.name
27
- assert Card[new_name]
28
- end
29
- end
30
-
31
- RSpec.describe Card::Set::All::Rename do
32
- include RenameMethods
33
- include CardExpectations
34
-
35
- it "renames simple card to its own child" do
36
- assert_rename "F", "F+M"
37
- end
38
-
39
- it "disallows renaming simple to compound when simple is used as tag" do
40
- expect { Card["A"].update! name: "A+M" }.to raise_error(/illegal name change/)
41
- end
42
-
43
- it "renames plus card to its own child" do
44
- assert_rename "A+B", "A+B+T"
45
- end
46
-
47
- it "clears cache for old name" do
48
- assert_rename "Menu", "manure"
49
- expect(Card["Menu"]).to be_nil
50
- end
51
-
52
- it "wipes old references by default" do
53
- update "Menu", name: "manure"
54
- expect(Card["manure"].references_in.size).to eq(0)
55
- end
56
-
57
- it "picks up new references" do
58
- expect(Card["Z"].references_in.size).to eq(2)
59
- assert_rename "Z", "Mister X"
60
- expect(Card["Mister X"].references_in.size).to eq(3)
61
- end
62
-
63
- it "handles name variants" do
64
- assert_rename "B", "b"
65
- end
66
-
67
- it "handles plus cards renamed to simple" do
68
- assert_rename "A+B", "K"
69
- end
70
-
71
- it "handles flipped parts" do
72
- assert_rename "A+B", "B+A"
73
- end
74
-
75
- it "fails if card exists" do
76
- expect { update "T", name: "A+B" }.to raise_error(/Name must be unique/)
77
- end
78
-
79
- it "fails if used as tag" do
80
- expect { update "B", name: "A+D" }.to raise_error(/Name must be unique/)
81
- end
82
-
83
- it "updates descendants" do
84
- old_names = %w[One+Two One+Two+Three Four+One Four+One+Five]
85
- new_names = %w[Uno+Two Uno+Two+Three Four+Uno Four+Uno+Five]
86
- card_list = old_names.map {|name| Card[name]}
87
-
88
- expect(card_list.map(&:name)).to eq old_names
89
- update "One", name: "Uno"
90
- expect(card_list.map(&:id).map(&:cardname)).to eq new_names
91
- end
92
-
93
- it "fails if name is invalid" do
94
- expect { update "T", name: "" }
95
- .to raise_error(/Name can't be blank/)
96
- end
97
-
98
- example "simple to simple" do
99
- assert_rename "A", "Alephant"
100
- end
101
-
102
- example "simple to junction with create" do
103
- assert_rename "T", "C+J"
104
- end
105
-
106
- example "reset key" do
107
- c = Card["basicname"]
108
- update "basicname", name: "banana card"
109
- expect(c.key).to eq("banana_card")
110
- expect(Card["Banana Card"]).not_to be_nil
111
- end
112
-
113
- it "does not fail when updating inaccessible referer" do
114
- Card.create! name: "Joe Card", content: "Whattup"
115
- Card::Auth.as "joe_admin" do
116
- Card.create! name: "Admin Card", content: "[[Joe Card]]"
117
- end
118
-
119
- c = Card["Joe Card"]
120
- c.update! name: "Card of Joe", update_referers: true
121
- assert_equal "[[Card of Joe]]", Card["Admin Card"].content
122
- end
123
-
124
- it "test_rename_should_update_structured_referer" do
125
- Card::Auth.as_bot do
126
- c = Card.create! name: "Pit"
127
- Card.create! name: "Orange", type: "Fruit", content: "[[Pit]]"
128
- Card.create! name: "Fruit+*type+*structure", content: "this [[Pit]]"
129
-
130
- assert_equal "this [[Pit]]", Card["Orange"].content
131
- c.update! name: "Seed", update_referers: true
132
- assert_equal "this [[Seed]]", Card["Orange"].content
133
- end
134
- end
135
-
136
- it "handles plus cards that have children" do
137
- assert_rename Card["a+b"], "e+f"
138
- end
139
-
140
- context "self references" do
141
- example "renaming card with self link should nothang" do
142
- pre_content = Card["self_aware"].content
143
- update "self aware", name: "buttah", update_referers: true
144
- expect_card("Buttah").to have_content(pre_content)
145
- end
146
-
147
- it "renames card without updating references" do
148
- pre_content = Card["self_aware"].content
149
- update "self aware", name: "Newt", update_referers: false
150
- expect_card("Newt").to have_content(pre_content)
151
- end
152
- end
153
-
154
- context "references" do
155
- it "updates nests" do
156
- update "Blue", name: "Red", update_referers: true
157
- expect_card("blue includer 1").to have_content("{{Red}}")
158
- expect_card("blue includer 2").to have_content("{{Red|closed;other:stuff}}")
159
- end
160
-
161
- it "updates nests when renaming to plus" do
162
- update "Blue", name: "blue includer 1+color", update_referers: true
163
- expect_card("blue includer 1").to have_content("{{blue includer 1+color}}")
164
- end
165
-
166
- it "reference updates on case variants" do
167
- update "Blue", name: "Red", update_referers: true
168
- expect_card("blue linker 1").to have_content("[[Red]]")
169
- expect_card("blue linker 2").to have_content("[[Red]]")
170
- end
171
-
172
- it "handles link to and nest of same card" do
173
- update "blue linker 1", content: "[[Blue]] is {{Blue|name}}"
174
- update "Blue", name: "Red", update_referers: true
175
- expect_card("blue linker 1").to have_content("[[Red]] is {{Red|name}}")
176
- end
177
-
178
- example "reference updates plus to simple" do
179
- assert_rename Card["A+B"], "schmuck"
180
- expect_card("X").to have_content("[[A]] [[schmuck]] [[T]]")
181
- end
182
-
183
- it "substitutes name part" do
184
- c1 = Card["A+B"]
185
- assert_rename Card["B"], "buck"
186
- expect(Card.find(c1.id).name).to eq "A+buck"
187
- end
188
- end
189
- end