card 1.93.3 → 1.93.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/db/migrate/20170908114452_increase_text_size_for_delayed_jobs.rb +9 -0
  4. data/db/migrate_core_cards/data/cards/*header +2 -2
  5. data/lib/card/format/nest.rb +12 -5
  6. data/lib/card/format/nest/fetch.rb +1 -2
  7. data/lib/card/format/render.rb +2 -2
  8. data/lib/card/model/save_helper.rb +1 -1
  9. data/lib/card/set/format/haml_views.rb +7 -3
  10. data/lib/card/subcards.rb +27 -228
  11. data/lib/card/subcards/add.rb +121 -0
  12. data/lib/card/subcards/relate.rb +27 -0
  13. data/lib/card/subcards/remove.rb +42 -0
  14. data/lib/card/tasks/card/create.rake +35 -132
  15. data/lib/card/tasks/card/file_card_creator.rb +25 -0
  16. data/lib/card/tasks/card/file_card_creator/abstract_file_card.rb +44 -0
  17. data/lib/card/tasks/card/file_card_creator/abstract_file_card/migration_file.rb +49 -0
  18. data/lib/card/tasks/card/file_card_creator/abstract_file_card/ruby_file.rb +30 -0
  19. data/lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb +36 -0
  20. data/lib/card/tasks/card/file_card_creator/haml_card.rb +42 -0
  21. data/lib/card/tasks/card/file_card_creator/output_helper.rb +50 -0
  22. data/lib/card/tasks/card/file_card_creator/script_card.rb +33 -0
  23. data/lib/card/tasks/card/file_card_creator/style_card.rb +25 -0
  24. data/lib/generators/card/template/template_generator.rb +1 -1
  25. data/mod/account/set/self/account_links.rb +1 -1
  26. data/mod/basic_formats/set/all/all_csv.rb +63 -0
  27. data/mod/basic_formats/set/all/json.rb +4 -1
  28. data/mod/bootstrap/db/migrate_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb +5 -2
  29. data/mod/carrierwave/set/abstract/attachment.rb +1 -2
  30. data/mod/core/set/abstract/haml_file.rb +20 -0
  31. data/mod/core/set/all/chunk.rb +125 -0
  32. data/mod/core/set/all/collection.rb +2 -351
  33. data/mod/core/set/all/content.rb +26 -7
  34. data/mod/core/set/all/extended.rb +45 -0
  35. data/mod/core/set/all/haml.rb +3 -7
  36. data/mod/core/set/all/item.rb +92 -0
  37. data/mod/core/set/all/name.rb +36 -0
  38. data/mod/core/set/all/subcards.rb +21 -12
  39. data/mod/core/set/all/tabs.rb +50 -0
  40. data/mod/core/set/all/trash.rb +4 -0
  41. data/mod/core/spec/set/all/chunk_spec.rb +45 -0
  42. data/mod/core/spec/set/all/collection_spec.rb +6 -6
  43. data/mod/history/set/all/action_view.rb +1 -1
  44. data/mod/machines/lib/javascript/decko.js.coffee +3 -0
  45. data/mod/pointer/set/abstract/02_pointer/edit.rb +0 -2
  46. data/mod/search/set/abstract/search.rb +1 -1
  47. data/mod/search/set/all/filter.rb +0 -2
  48. data/mod/search/template/all/filter/_filter_input.haml +1 -1
  49. data/mod/search/template/all/filter/filter_form.haml +1 -1
  50. data/mod/standard/set/all/rich_html/editing.rb +1 -1
  51. data/mod/standard/set/all/rich_html/form.rb +6 -7
  52. data/mod/standard/set/all/rich_html/menu.rb +2 -3
  53. data/mod/standard/set/all/rich_html/toolbar.rb +3 -4
  54. data/mod/standard/set/type/cardtype.rb +1 -1
  55. data/mod/standard/spec/set/all/rich_html/editing_spec.rb +15 -4
  56. data/mod/tinymce_editor/db/migrate_cards/{20171113233150_update_tinymce_config.rb → 20171113233151_update_tinymce_config.rb} +1 -0
  57. metadata +25 -161
  58. data/.rspec +0 -4
  59. data/card.gemspec +0 -87
  60. data/db/seed/test/fixtures/.gitkeep +0 -0
  61. data/mod/bootstrap/vendor/bootstrap/.babelrc.js +0 -16
  62. data/mod/bootstrap/vendor/bootstrap/.editorconfig +0 -17
  63. data/mod/bootstrap/vendor/bootstrap/.eslintignore +0 -3
  64. data/mod/bootstrap/vendor/bootstrap/.gitattributes +0 -16
  65. data/mod/bootstrap/vendor/bootstrap/.github/CONTRIBUTING.md +0 -252
  66. data/mod/bootstrap/vendor/bootstrap/.github/ISSUE_TEMPLATE.md +0 -22
  67. data/mod/bootstrap/vendor/bootstrap/.gitignore +0 -46
  68. data/mod/bootstrap/vendor/bootstrap/.hound.yml +0 -19
  69. data/mod/bootstrap/vendor/bootstrap/.houndignore +0 -4
  70. data/mod/bootstrap/vendor/bootstrap/.travis.yml +0 -32
  71. data/mod/bootstrap/vendor/bootstrap/build/.htmllintrc +0 -19
  72. data/mod/bootstrap/vendor/bootstrap/build/.stylelintrc +0 -248
  73. data/mod/bootstrap/vendor/bootstrap/docs/4.0/examples/.stylelintrc +0 -12
  74. data/mod/bootstrap/vendor/bootstrap/js/.eslintrc.json +0 -240
  75. data/mod/bootstrap/vendor/bootstrap/js/tests/.eslintrc.json +0 -46
  76. data/mod/bootstrap/vendor/bootswatch/.gitignore +0 -7
  77. data/mod/bootstrap/vendor/bootswatch/.npmignore +0 -12
  78. data/mod/bootstrap/vendor/bootswatch/.travis.yml +0 -21
  79. data/mod/bootstrap/vendor/bootswatch/docs/.nojekyll +0 -0
  80. data/mod/bootstrap/vendor/bootswatch/docs/2/.travis.yml +0 -15
  81. data/mod/bootstrap/vendor/bootswatch/docs/2/bower_components/bootstrap/.bower.json +0 -20
  82. data/mod/bootstrap/vendor/bootswatch/docs/2/bower_components/bootstrap/.gitignore +0 -37
  83. data/mod/bootstrap/vendor/bootswatch/docs/2/bower_components/bootstrap/.travis.yml +0 -3
  84. data/mod/bootstrap/vendor/bootswatch/docs/2/bower_components/bootstrap/js/.jshintrc +0 -12
  85. data/mod/bootstrap/vendor/bootswatch/docs/2/bower_components/jquery/.bower.json +0 -20
  86. data/mod/bootstrap/vendor/bootswatch/docs/2/bower_components/jquery/.gitignore +0 -1
  87. data/mod/bootstrap/vendor/bootswatch/docs/2/swatchmaker/.gitignore +0 -1
  88. data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/bootstrap-sass-official/.bower.json +0 -45
  89. data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/bootstrap/.bower.json +0 -44
  90. data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/bootstrap/grunt/.jshintrc +0 -7
  91. data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/bootstrap/js/.jscsrc +0 -42
  92. data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/bootstrap/js/.jshintrc +0 -15
  93. data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/bootstrap/less/.csscomb.json +0 -304
  94. data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/bootstrap/less/.csslintrc +0 -19
  95. data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/font-awesome/.bower.json +0 -14
  96. data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/font-awesome/.gitignore +0 -32
  97. data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/html5shiv/.bower.json +0 -25
  98. data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/jquery/.bower.json +0 -38
  99. data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/respond/.bower.json +0 -20
  100. data/mod/bootstrap/vendor/select2/.editorconfig +0 -6
  101. data/mod/bootstrap/vendor/select2/.github/CONTRIBUTING.md +0 -204
  102. data/mod/bootstrap/vendor/select2/.github/ISSUE_TEMPLATE.md +0 -46
  103. data/mod/bootstrap/vendor/select2/.github/PULL_REQUEST_TEMPLATE.md +0 -13
  104. data/mod/bootstrap/vendor/select2/.gitignore +0 -3
  105. data/mod/bootstrap/vendor/select2/.jshintignore +0 -4
  106. data/mod/bootstrap/vendor/select2/.jshintrc +0 -25
  107. data/mod/bootstrap/vendor/select2/.travis.yml +0 -22
  108. data/script/fetch_bootswatch_themes.rb +0 -38
  109. data/spec/config/initializers/core_extensions_spec.rb +0 -47
  110. data/spec/config/initializers/patches/active_job_spec.rb +0 -7
  111. data/spec/lib/card/action_spec.rb +0 -15
  112. data/spec/lib/card/auth_spec.rb +0 -58
  113. data/spec/lib/card/cache_spec.rb +0 -116
  114. data/spec/lib/card/chunk_spec.rb +0 -18
  115. data/spec/lib/card/codename_spec.rb +0 -66
  116. data/spec/lib/card/content_spec.rb +0 -428
  117. data/spec/lib/card/diff_spec.rb +0 -208
  118. data/spec/lib/card/format/nest_spec.rb +0 -13
  119. data/spec/lib/card/format/render_spec.rb +0 -26
  120. data/spec/lib/card/format_spec.rb +0 -117
  121. data/spec/lib/card/i18n_spec.rb +0 -24
  122. data/spec/lib/card/loader/Modfile +0 -2
  123. data/spec/lib/card/loader_spec.rb +0 -98
  124. data/spec/lib/card/migration/import_spec.rb +0 -80
  125. data/spec/lib/card/mod/loader/mod_dirs.rb +0 -8
  126. data/spec/lib/card/mod/loader/set_loader_spec.rb +0 -19
  127. data/spec/lib/card/mod/loader/set_pattern_loader_spec.rb +0 -19
  128. data/spec/lib/card/name/fields_and_traits_spec.rb +0 -18
  129. data/spec/lib/card/name_spec.rb +0 -70
  130. data/spec/lib/card/query/sorting_spec.rb +0 -68
  131. data/spec/lib/card/query_spec.rb +0 -574
  132. data/spec/lib/card/reference_spec.rb +0 -212
  133. data/spec/lib/card/set/event_spec.rb +0 -22
  134. data/spec/lib/card/set/trait_spec.rb +0 -80
  135. data/spec/lib/card/set_pattern_spec.rb +0 -59
  136. data/spec/lib/card/set_spec.rb +0 -89
  137. data/spec/lib/card/stage_director_spec.rb +0 -482
  138. data/spec/lib/card/subcards_spec.rb +0 -177
  139. data/spec/lib/card/success_spec.rb +0 -148
  140. data/spec/lib/card/view_cache_spec.rb +0 -27
  141. data/spec/mailers/mailer_spec.rb +0 -62
  142. data/spec/models/card/create_spec.rb +0 -119
  143. data/spec/models/card/trash_spec.rb +0 -189
  144. data/spec/models/card_spec.rb +0 -136
  145. data/spec/spec_helper.rb +0 -45
  146. data/spec/support/card_spec_helper.rb +0 -74
  147. data/spec/support/card_spec_loader.rb +0 -112
  148. data/spec/support/helper/card_helper.rb +0 -58
  149. data/spec/support/helper/event_helper.rb +0 -94
  150. data/spec/support/helper/render_helper.rb +0 -44
  151. data/spec/support/helper/save_helper.rb +0 -30
  152. data/spec/support/helper/set_helper.rb +0 -80
  153. data/spec/support/matchers/card_matchers.rb +0 -160
  154. data/spec/support/matchers/expectations.rb +0 -5
  155. data/spec/support/matchers/file_matchers.rb +0 -71
  156. data/spec/support/matchers/html_matchers.rb +0 -29
  157. data/spec/support/matchers/negated_matchers.rb +0 -2
  158. data/spec/support/simplecov_helper.rb +0 -70
  159. data/spec/support/test_mods/mod1/set/all/test_set.rb +0 -3
  160. data/spec/support/test_mods/mod2/set_pattern/test_pattern.rb +0 -0
@@ -1,212 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- describe Card::Reference do
4
- before do
5
- Card::Auth.current_id = Card::WagnBotID
6
- end
7
-
8
- describe "references on hard templated cards should get updated" do
9
- it "on structuree creation" do
10
- Card.create! name: "JoeForm", type: "UserForm"
11
- Card["JoeForm"].format.render!(:core)
12
- assert_equal ["joe_form+age", "joe_form+description", "joe_form+name"],
13
- Card["JoeForm"].includees.map(&:key).sort
14
- end
15
-
16
- it "on template creation" do
17
- Card.create! name: "SpecialForm", type: "Cardtype"
18
- Card.create! name: "Form1", type: "SpecialForm", content: "foo"
19
- Card.create! name: "SpecialForm+*type+*structure", content: "{{+bar}}"
20
- Card["Form1"].format.render!(:core)
21
- expect(Card["Form1"].includees.map(&:key)).to eq(["form1+bar"])
22
- end
23
-
24
- it "on template update" do
25
- Card.create! name: "JoeForm", type: "UserForm"
26
- tmpl = Card["UserForm+*type+*structure"]
27
- tmpl.content = "{{+monkey}} {{+banana}} {{+fruit}}"
28
- tmpl.save!
29
- Card["JoeForm"].format.render!(:core)
30
- expect(Card["JoeForm"].includees.map(&:key)).to contain_exactly("joe_form+banana", "joe_form+fruit", "joe_form+monkey")
31
- end
32
- end
33
-
34
- it "in references should survive cardtype change" do
35
- create! "Banana", "[[Yellow]]"
36
- create! "Submarine", "[[Yellow]]"
37
- create! "Sun", "[[Yellow]]"
38
- create! "Yellow"
39
- yellow_refs = Card["Yellow"].referers.map(&:name).sort
40
- expect(yellow_refs).to eq(%w(Banana Submarine Sun))
41
-
42
- y = Card["Yellow"]
43
- y.type_id = Card.fetch_id "UserForm"
44
- y.save!
45
-
46
- yellow_refs = Card["Yellow"].referers.map(&:name).sort
47
- expect(yellow_refs).to eq(%w(Banana Submarine Sun))
48
- end
49
-
50
- it "container nest" do
51
- Card.create name: "bob+city"
52
- Card.create name: "address+*right+*default", content: "{{_L+city}}"
53
- Card.create name: "bob+address"
54
- expect(Card.fetch("bob+address").includees.map(&:name)).to eq(["bob+city"])
55
- expect(Card.fetch("bob+city").includers.map(&:name)).to eq(["bob+address"])
56
- end
57
-
58
- it "pickup new links on rename" do
59
- @l = create!("L", "[[Ethan]]") # no Ethan card yet...
60
- @e = create!("Earthman")
61
- @e.update_attributes! name: "Ethan" # NOW there is an Ethan card
62
- # do we need the links to be caught before reloading the card?
63
- expect(Card["Ethan"].referers.map(&:name).include?("L")).not_to eq(nil)
64
- end
65
-
66
- it "updates references on rename when requested" do
67
- create! "watermelon", "mmmm"
68
- create! "watermelon+seeds", "black"
69
- lew = create!("Lew", "likes [[watermelon]] and [[watermelon+seeds|seeds]]")
70
-
71
- watermelon = Card["watermelon"]
72
- watermelon.update_referers = true
73
- watermelon.name = "grapefruit"
74
- watermelon.save!
75
- result = "likes [[grapefruit]] and [[grapefruit+seeds|seeds]]"
76
- expect(lew.reload.content).to eq(result)
77
- end
78
-
79
- it "updates referers on rename when requested (case 2)" do
80
- card = Card["Administrator Menu+*self+*read"]
81
- old_refs = Card::Reference.where(referee_id: Card::AdministratorID)
82
-
83
- card.update_referers = true
84
- card.name = "Administrator Menu+*type+*read"
85
- card.save
86
-
87
- new_refs = Card::Reference.where(referee_id: Card::AdministratorID)
88
- expect(old_refs).to eq(new_refs)
89
- end
90
-
91
- it "does not update references when not requested" do
92
- watermelon = create "watermelon", "mmmm"
93
- watermelon_seeds = create "watermelon+seeds", "black"
94
- lew = create("Lew", "likes [[watermelon]] and [[watermelon+seeds|seeds]]")
95
-
96
- assert_equal [watermelon.id, watermelon_seeds.id],
97
- lew.references_out.order(:id).map(&:referee_id),
98
- "stores referee ids"
99
-
100
- watermelon = Card["watermelon"]
101
- watermelon.update_referers = false
102
- watermelon.name = "grapefruit"
103
- watermelon.save!
104
-
105
- correct_content = "likes [[watermelon]] and [[watermelon+seeds|seeds]]"
106
- expect(lew.reload.content).to eq(correct_content)
107
-
108
- ref_types = lew.references_out.order(:id).map(&:ref_type)
109
- expect(ref_types).to eq(%w(L L P)), "need partial references!"
110
- actual_referee_ids = lew.references_out.order(:id).map(&:referee_id)
111
- assert_equal actual_referee_ids, [nil, nil, Card.fetch_id("seed")],
112
- 'only partial reference to "seeds" should have referee_id'
113
- end
114
-
115
- it "update referencing content on rename junction card" do
116
- @ab = Card["A+B"] # linked to from X, included by Y
117
- @ab.update_attributes! name: "Peanut+Butter", update_referers: true
118
- @x = Card["X"]
119
- expect(@x.content).to eq("[[A]] [[Peanut+Butter]] [[T]]")
120
- end
121
-
122
- it "update referencing content on rename junction card" do
123
- @ab = Card["A+B"] # linked to from X, included by Y
124
- @ab.update_attributes! name: "Peanut+Butter", update_referers: false
125
- @x = Card["X"]
126
- expect(@x.content).to eq("[[A]] [[A+B]] [[T]]")
127
- end
128
-
129
- it "template nest" do
130
- Card.create! name: "ColorType", type: "Cardtype", content: ""
131
- Card.create! name: "ColorType+*type+*structure", content: "{{+rgb}}"
132
- green = Card.create! name: "green", type: "ColorType"
133
- create! "rgb"
134
- green_rgb = Card.create! name: "green+rgb", content: "#00ff00"
135
-
136
- expect(green.reload.includees.map(&:name)).to eq(["green+rgb"])
137
- expect(green_rgb.reload.includers.map(&:name)).to eq(["green"])
138
- end
139
-
140
- it "simple link" do
141
- Card.create name: "alpha"
142
- Card.create name: "beta", content: "I link to [[alpha]]"
143
- expect(Card["alpha"].referers.map(&:name)).to eq(["beta"])
144
- expect(Card["beta"].referees.map(&:name)).to eq(["alpha"])
145
- end
146
-
147
- it "link with spaces" do
148
- Card.create! name: "alpha card"
149
- Card.create! name: "beta card", content: "I link to [[alpha_card]]"
150
- expect(Card["beta card"].referees.map(&:name)).to eq(["alpha card"])
151
- expect(Card["alpha card"].referers.map(&:name)).to eq(["beta card"])
152
- end
153
-
154
- it "simple nest" do
155
- Card.create name: "alpha"
156
- Card.create name: "beta", content: "I nest {{alpha}}"
157
- expect(Card["beta"].includees.map(&:name)).to eq(["alpha"])
158
- expect(Card["alpha"].includers.map(&:name)).to eq(["beta"])
159
- end
160
-
161
- it "non simple link" do
162
- Card.create name: "alpha"
163
- Card.create name: "beta", content: "I link to [[alpha|ALPHA]]"
164
- expect(Card["beta"].referees.map(&:name)).to eq(["alpha"])
165
- expect(Card["alpha"].referers.map(&:name)).to eq(["beta"])
166
- end
167
-
168
- it "query" do
169
- Card.create(
170
- type: "Search",
171
- name: "search with references",
172
- content: '{"name":"X", "right_plus":["Y",{"content":["in","A","B"]}]}'
173
- )
174
- y_referers = Card["Y"].referers.map(&:name)
175
- expect(y_referers).to include("search with references")
176
-
177
- search_referees = Card["search with references"].referees.map(&:name).sort
178
- expect(search_referees).to eq(%w(A B X Y))
179
- end
180
-
181
- it "handles contextual names in Basic cards" do
182
- Card.create type: "Basic", name: "basic w refs", content: "{{_+A}}"
183
- Card["A"].update_attributes! name: "AAA", update_referers: true
184
- expect(Card["basic w refs"].content).to eq "{{_+AAA}}"
185
- end
186
-
187
- it "handles contextual names in Search cards" do
188
- Card.create type: "Search", name: "search w refs", content: '{"name":"_+A"}'
189
- Card["A"].update_attributes! name: "AAA", update_referers: true
190
- expect(Card["search w refs"].content).to eq '{"name":"_+AAA"}'
191
- end
192
-
193
- it "handles commented nest" do
194
- c = Card.create name: "nest comment test", content: "{{## hi mom }}"
195
- expect(c.errors.any?).to be_falsey
196
- end
197
-
198
- it "pickup new links on create" do
199
- @l = create!("woof", "[[Lewdog]]") # no Lewdog card yet...
200
- @e = create!("Lewdog") # now there is
201
- # NOTE @e.referers does not work, you have to reload
202
- expect(@e.reload.referers.map(&:name).include?("woof")).not_to eq(nil)
203
- end
204
-
205
- it "pickup new nests on create" do
206
- @l = Card.create! name: "woof", content: "{{Lewdog}}"
207
- # no Lewdog card yet...
208
- @e = Card.new name: "Lewdog", content: "grrr"
209
- # now it's inititated
210
- expect(@e.name_referers.map(&:name).include?("woof")).not_to eq(nil)
211
- end
212
- end
@@ -1,22 +0,0 @@
1
- describe Card::Set::Event do
2
- it "params are deserialized in intergrate_with_delay events" do
3
- @called = false
4
- def event_called
5
- @called = true
6
- end
7
-
8
-
9
- with_test_events do
10
- test_event :integrate_with_delay, on: :update, for: "A" do
11
- event_called
12
- expect(Card::Env.params)
13
- .to include(level1: ActionController::Parameters.new(level2: :a_symbol))
14
- end
15
-
16
- Card::Env.params[:level1] = ActionController::Parameters.new level2: :a_symbol
17
- Card["A"].update_attributes! content: "new content"
18
-
19
- expect(@called).to eq true
20
- end
21
- end
22
- end
@@ -1,80 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
-
4
- describe Card::Set::Trait do
5
- class Card
6
- module Set
7
- class Type
8
- module Phrase
9
- extend Card::Set
10
- card_accessor :write, type: :phrase
11
- card_accessor :read, type_id: Card::PhraseID
12
- end
13
- end
14
-
15
- class TypePlusRight
16
- module Phrase
17
- module Write
18
- extend Card::Set
19
- def type_plus_right_module_loaded
20
- true
21
- end
22
- end
23
- end
24
- end
25
-
26
- class TypePlusRight
27
- module Phrase
28
- module Read
29
- extend Card::Set
30
- def type_plus_right_module_loaded
31
- true
32
- end
33
- end
34
- end
35
- end
36
- end
37
- end
38
-
39
- subject do
40
- Card::Auth.as_bot do
41
- Card.create! name: "joke",
42
- type_id: Card::PhraseID,
43
- "+*write" => "some content",
44
- "+*read" => "some content"
45
- end
46
- end
47
-
48
- # FIXME: The expectations that are commented out fail which is worrying.
49
- # But the tests are new not the behaviour. I removed them so that we can use
50
- # CI again
51
- context "if accessor type is defined by a symbol" do
52
- it "trait card is created correctly" do
53
- in_stage :prepare_to_validate, on: :create,
54
- trigger: -> { subject } do
55
- # test API doesn't support sets for event
56
- # so we check the name
57
- return unless name == "joke"
58
- aggregate_failures do
59
- expect(write_card.type_id).to eq(Card::PhraseID)
60
- # expect(write_card.left).to be_instance_of(Card)
61
- # expect(write_card).to respond_to(:type_plus_right_module_loaded)
62
- end
63
- end
64
- end
65
- end
66
-
67
- context "if accessor type is defined by an id" do
68
- it "trait card is created correctly" do
69
- in_stage :prepare_to_validate, on: :create,
70
- trigger: -> { subject } do
71
- return unless name == "joke"
72
- aggregate_failures do
73
- # expect(read_card.type_id).to eq(Card::PhraseID)
74
- expect(read_card.left).to be_instance_of(Card)
75
- expect(read_card).to respond_to(:type_plus_right_module_loaded)
76
- end
77
- end
78
- end
79
- end
80
- end
@@ -1,59 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- def it_generates opts
4
- name = opts[:name]
5
- card = opts[:from]
6
- it "generates name '#{name}' for card '#{card.name}'" do
7
- expect(described_class.new(card).to_s).to eq(name)
8
- end
9
- end
10
-
11
- describe Card::Set::Pattern do
12
- specify ".in_load_order" do
13
- expect(Card::Set::Pattern.in_load_order)
14
- .to eq(%i[abstract all all_plus type star rstar right type_plus_right self])
15
- end
16
- end
17
-
18
- # FIXME: - these should probably be in pattern-specific specs,
19
- # though that may not leave much to test in the base class :)
20
-
21
- describe Card::Set::Right do
22
- it_generates name: "author+*right", from: Card.new(name: "Iliad+author")
23
- it_generates name: "author+*right", from: Card.new(name: "+author")
24
- end
25
-
26
- describe Card::Set::Type do
27
- it_generates name: "Book+*type", from: Card.new(type: "Book")
28
-
29
- before :each do
30
- Card::Auth.as_bot do
31
- @mylist = Card.create! name: "MyList", type_id: Card::CardtypeID
32
- Card.create name: "MyList+*type+*default", type_id: Card::PointerID
33
- end
34
- @mylist_card = Card.create name: "ip", type_id: @mylist.id
35
- end
36
- # similar tests for an inherited type of Pointer
37
- it "has inherited set module" do
38
- expect(@mylist_card.set_format_modules(Card::Format::HtmlFormat))
39
- .to include(Card::Set::Type::Pointer::HtmlFormat)
40
- expect(@mylist_card.set_format_modules(Card::Format::CssFormat))
41
- .to include(Card::Set::Type::Pointer::CssFormat)
42
- expect(@mylist_card.set_format_modules(Card::Format::JsFormat))
43
- .to include(Card::Set::Type::Pointer::JsFormat)
44
- expect(@mylist_card.set_modules).to include(Card::Set::Type::Pointer)
45
- end
46
- end
47
-
48
- describe Card::Set::AllPlus do
49
- it_generates name: "*all plus", from: Card.new(name: "Book+author")
50
- end
51
-
52
- describe Card::Set::All do
53
- it_generates name: "*all", from: Card.new(type: "Book")
54
- end
55
-
56
- describe Card::Set::TypePlusRight do
57
- author_card = Card.new(name: "Iliad+author")
58
- it_generates name: "Book+author+*type plus right", from: author_card
59
- end
@@ -1,89 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- # module Card::Set::Right::Account
4
- # won't this conflict with a real set (and fail to provide controlled test?)
5
- # extend Card::Set
6
- #
7
- # card_accessor :role, default: "request", type: :phrase
8
- # card_writer :write, default: "request", type: :phrase
9
- # card_reader :read, default: "request", type: :phrase
10
- # end
11
- #
12
- # describe Card do
13
- # before do
14
- # @account_card = Card['sara'].fetch trait: :account
15
- # end
16
- #
17
- # describe "Read and write card attribute" do
18
- # it "gets email attribute" do
19
- # expect(@account_card.role).to eq('request')
20
- # end
21
- #
22
- # it "does not have a reader method for card_writer" do
23
- # expect(@account_card.respond_to?( :write)).to be_falsey
24
- # expect(@account_card.method( :write= )).to be
25
- # end
26
- #
27
- # it "does not have a reader method for card_reader" do
28
- # expect(@account_card.method( :read)).to be
29
- # expect(@account_card.respond_to?( :read= )).to be_falsey
30
- # end
31
- #
32
- # it "sets and saves attribute" do
33
- # @account_card.write= 'test_value'
34
- # @account_card.status= 'pending'
35
- # # @account_card.status.should == 'pending'
36
- # Card::Auth.as_bot { @account_card.save }
37
- # # Card.cache.reset
38
- # expect(tcard = Card['sara'].fetch(trait: :account)).to be
39
- # expect(tcard.status).to eq('pending')
40
- # expect(tcard.fetch(trait: :write).content).to eq('test_value')
41
- # end
42
- #
43
- # end
44
- #
45
- # let(:card) { Card.new(name: 'simple') }
46
- # let(:card_self) { Card.new(name: '*navbox') }
47
- # let(:card_right) { Card.new(name: 'card+*right') }
48
- # let(:card_type_search) { Card.new(name: 'search_me', type: Card::SearchID) }
49
- # let(:card_double) { Card }
50
- # let(:format_double) { object_double(Card.new(name: 'card+*right').format) }
51
- #
52
- # #let(:html_format_double) { Card::Format::HtmlFormat }
53
- # let(:html_format_double) { double("Card::Format::HtmlFormat") }
54
- #
55
- # it "defines Formatter methods from modules" do
56
- # expect(format_double).to respond_to(:render_navbox_self_core)
57
- # expect(format_double.method(:render_navbox_self_core)).to be
58
- # expect(format_double.method(:_render_right_right_raw)).to be
59
- # expect(format_double.method(:render_type_search_core)).to be
60
- # expect(format_double.method(:_final_type_search_raw)).to be
61
- # end
62
- # it "calls set render methods" do
63
- # expect(card_self).to receive(:_final_self_navbox_core)
64
- # card_self.format.render_core
65
- # #expect(card_right.format.method(:_render_right_right_raw)).to be
66
- # #expect(card_right.format).to respond_to(:_render_right_right_raw)
67
- # card_right.format.render_core
68
- # expect(card_type_search.method(:render_type_search_core)).to be
69
- # card_type_search.format.render_core
70
- # expect(card.method(:_final_type_search_raw)).to be
71
- # card.format.render_core
72
- # end
73
- # it "defines Formatter methods from modules" do
74
- # expect(html_format_double.method(:render_self_navbox_core)).to be
75
- # expect(html_format_double.method(:_render_right_right_raw)).to be
76
- # expect(html_format_double.method(:render_type_search_core)).to be
77
- # expect(html_format_double.method(:_final_type_search_raw)).to be
78
- # end
79
- # it "defines Formatter methods from modules" do
80
- # expect(card_self).to receive(:_final_self_navbox_titled)
81
- # card_self.render_titled
82
- # expect(card_right.method(:_render_right_right_edit)).to be
83
- # card_right.render_edit
84
- # expect(card_type_search.method(:render_type_search_menu)).to be
85
- # card_type_search.render_menu
86
- # expect(card.method(:_final_type_search_content)).to be
87
- # card.render_content
88
- # end
89
- # end