card 1.93.3 → 1.93.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,177 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- describe Card::Subcards do
4
- describe "creating card with subcards" do
5
- it "works with subcard hash" do
6
- Card::Auth.as_bot do
7
- @card = Card.create!(
8
- name: "card with subs",
9
- subcards: { "+sub1" => { content: "this is sub1" } }
10
- )
11
- end
12
- expect(Card["card with subs+sub1"].content).to eq "this is sub1"
13
- end
14
-
15
- it "check name-key bug" do
16
- Card::Auth.as_bot do
17
- Card.create! name: "Matthias", subcards: {"+name" => "test"}
18
- expect(Card.exists? "Matthias+name").to be_truthy
19
- end
20
- end
21
-
22
- it "works with content string" do
23
- Card::Auth.as_bot do
24
- @card = Card.create!(
25
- name: "card with subs", subcards: { "+sub1" => "this is sub1" }
26
- )
27
- end
28
- expect(Card["card with subs+sub1"].content).to eq "this is sub1"
29
- end
30
-
31
- it "check unstable key bug" do
32
- Card::Auth.as_bot do
33
- Card.create! name: "Matthias", subcards: {"+name" => "test"}
34
- expect(Card.exists? "Matthias+name").to be_truthy
35
- end
36
- end
37
-
38
- it "works with +name key in args" do
39
- Card::Auth.as_bot do
40
- @card = Card.create!(
41
- name: "card with subs", "+sub1" => { content: "this is sub1" }
42
- )
43
- end
44
- expect(Card["card with subs+sub1"].content).to eq "this is sub1"
45
- end
46
-
47
- it "handles more than one level" do
48
- Card::Auth.as_bot do
49
- @card = Card.create!(
50
- name: "card with subs", "+sub1" => { "+sub2" => "this is sub2" }
51
- )
52
- end
53
- expect(Card["card with subs+sub1+sub2"].content).to eq "this is sub2"
54
- end
55
-
56
- it "handles compound names" do
57
- Card::Auth.as_bot do
58
- @card = Card.create! name: "superman", "+sub1+sub2" => "this is sub2"
59
- end
60
- expect(Card["superman+sub1"]).to be_truthy
61
- expect(Card["superman+sub1+sub2"].content).to eq "this is sub2"
62
- end
63
-
64
- it "keeps plural of left part" do
65
- Card::Auth.as_bot do
66
- @card = Card.create!(
67
- name: "supermen", content: "something",
68
- subcards: { "+pseudonym" => "clark" }
69
- )
70
- end
71
- expect(Card["supermen+pseudonym"].name).to eq "supermen+pseudonym"
72
- end
73
-
74
- it "cleans the cache for autonaming case" do
75
- Card::Auth.as_bot do
76
- Card.create!(
77
- name: "Book+*type+*autoname", content: "Book_1",
78
- type_id: Card::PhraseID
79
- )
80
- card = Card.create!(
81
- type: "Book",
82
- subcards: { "+editable" => "yes" }
83
- )
84
- expect(card.errors).to be_empty
85
- expect(Card["#{card.name}+editable"]).to be_truthy
86
- @card = Card.create!(
87
- type: "Book",
88
- subcards: { "+editable" => "sure" }
89
- )
90
- end
91
-
92
- expect(@card.errors).to be_empty
93
- expect(Card["#{@card.name}+editable"]).to be_truthy
94
- end
95
- end
96
-
97
- describe "#add_subfield" do
98
- before do
99
- @card = Card["A"]
100
- end
101
- subject do
102
- Card.fetch("#{@card.name}+sub", new: {}, local_only: true).content
103
- end
104
- it "works with string" do
105
- @card.add_subfield "sub", content: "this is a sub"
106
- is_expected.to eq "this is a sub"
107
- end
108
- it "works with codename" do
109
- @card.add_subfield :phrase, content: "this is a sub"
110
- subcard = Card.fetch("A+phrase", new: {}, local_only: true)
111
- expect(subcard.content).to eq "this is a sub"
112
- end
113
- end
114
-
115
- describe "#subfield" do
116
- before do
117
- @card = Card["A"]
118
- end
119
- subject do
120
- Card.fetch("#{@card.name}+sub", new: {}, local_only: true).content
121
- end
122
- it "works with string" do
123
- @card.add_subfield "sub", content: "this is a sub"
124
- expect(@card.subfield("sub").content).to eq "this is a sub"
125
- end
126
-
127
- it "works with codename" do
128
- @card.add_subfield :phrase, content: "this is a sub"
129
- expect(@card.subfield(":phrase").content).to eq "this is a sub"
130
- end
131
-
132
- it "works together with type change" do
133
- Card::Auth.as_bot do
134
- @card = Card.create!(
135
- name: "card with subs", "+sub1" => "first"
136
- )
137
- @card.update_attributes! type_id: Card::PhraseID, "+sub1" => "second"
138
- end
139
- expect(Card["card with subs+sub1"].content).to eq "second"
140
- end
141
- end
142
-
143
- describe "#add" do
144
- before do
145
- @card = Card["A"]
146
- end
147
- it "adds a subcard" do
148
- @card.add_subcard "sub", content: "sub content"
149
- @card.save!
150
- expect(Card["sub"].content).to eq "sub content"
151
- end
152
- end
153
- describe "two levels of subcards" do
154
- it "creates cards with subcards with subcards" do
155
- Card::Auth.as_bot do
156
- in_stage :validate, trigger: -> { Card.create!(name: "test") } do
157
- if name == "test"
158
- add_subfield("first-level")
159
- subfield("first-level").add_subfield "second-level", content: "yeah"
160
- end
161
- end
162
- end
163
- expect(Card.fetch("test+first-level+second-level").content).to eq "yeah"
164
- end
165
- it "creates cards with subcards with subcards using codenames" do
166
- Card::Auth.as_bot do
167
- in_stage :validate, trigger: -> { Card.create!(name: "test") } do
168
- if name == "test"
169
- add_subfield :children
170
- subfield(:children).add_subfield :title, content: "yeah"
171
- end
172
- end
173
- end
174
- expect(Card.fetch("test+*child+*title").content).to eq "yeah"
175
- end
176
- end
177
- end
@@ -1,148 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- describe Card::Env::Success do
4
- let(:context) { Card["A"].name }
5
- let(:previous) { "/B" }
6
- let(:home) { Card["Home"] }
7
- def success_params params
8
- Card::Env.save_location Card["B"]
9
- @success = Card::Env::Success.new context, params
10
- end
11
- describe "#target" do
12
- subject { @success.target }
13
-
14
- context "initialized with nil" do
15
- before do
16
- success_params nil
17
- end
18
- it { is_expected.to eq Card["A"] }
19
- end
20
-
21
- context "initialized with hash" do
22
- before do
23
- success_params id: home.id, view: "closed"
24
- end
25
- it { is_expected.to eq home }
26
- end
27
-
28
- context "initialized with REDIRECT string" do
29
- before do
30
- success_params "REDIRECT: Home"
31
- end
32
- it { is_expected.to eq home }
33
- end
34
-
35
- context "initialized with TEXT string" do
36
- before do
37
- success_params "TEXT: Hi"
38
- end
39
- it { is_expected.to eq "Hi" }
40
- end
41
-
42
- context "initialized with card object" do
43
- before do
44
- success_params home
45
- end
46
- it { is_expected.to eq home }
47
- end
48
-
49
- context "initialized with url" do
50
- before do
51
- success_params "http://wagn.org"
52
- end
53
- it { is_expected.to eq "http://wagn.org" }
54
- end
55
- end
56
-
57
- describe "#to_url" do
58
- subject { @success.to_url }
59
- context "with params" do
60
- context "using initilization" do
61
- before do
62
- success_params id: home.id, view: "closed", layout: "my_layout"
63
- end
64
- it { is_expected.to eq "/Home?layout=my_layout&view=closed" }
65
- end
66
- context "using array assignment" do
67
- before do
68
- success_params nil
69
- @success[:view] = "closed"
70
- end
71
- it { is_expected.to eq "/A?view=closed" }
72
- end
73
- context "using assignment" do
74
- before do
75
- success_params nil
76
- @success.view = "closed"
77
- end
78
- it { is_expected.to eq "/A?view=closed" }
79
- end
80
- context "using <<" do
81
- before do
82
- success_params nil
83
- @success << { card: home, view: "closed" }
84
- end
85
- it { is_expected.to eq "/Home?view=closed" }
86
- end
87
- end
88
- context "redirect string" do
89
- before do
90
- success_params "REDIRECT: *previous"
91
- end
92
- it { is_expected.to eq previous }
93
- end
94
- end
95
-
96
- describe "#soft_redirect?" do
97
- it "returns true if soft_redirect parameter is true" do
98
- success_params soft_redirect: true
99
- expect(@success.soft_redirect?).to be_truthy
100
- end
101
- end
102
-
103
- describe "#hard_redirect?" do
104
- it 'true for "REDIRECT: anywhere"' do
105
- success_params "REDIRECT: anywhere"
106
- expect(@success.hard_redirect?).to be_truthy
107
- end
108
- end
109
-
110
- describe "#mark=" do
111
- subject { @success.target }
112
- before do
113
- success_params nil
114
- end
115
- it "works with id" do
116
- @success.mark = home.id
117
- is_expected.to eq home
118
- end
119
- it "works with name" do
120
- @success.mark = home.name
121
- is_expected.to eq home
122
- end
123
- it "works with card object" do
124
- @success.mark = home
125
- is_expected.to eq home
126
- end
127
- end
128
-
129
- describe "params" do
130
- it "returns params hash" do
131
- success_params name: "Home", view: "View"
132
- @success.layout = "Layout"
133
- @success.apply script: "Script"
134
- @success << { structure: "Structure" }
135
- expect(@success.params.keys.sort).to eq [:layout, :script, :structure, :view]
136
- end
137
- it 'ignores "id", "name", "mark", "card"", target", and "redirect"' do
138
- success_params(id: 5,
139
- name: "Home",
140
- card: Card["Home"],
141
- mark: "Home",
142
- target: "Home",
143
- redirect: false,
144
- view: "View")
145
- expect(@success.params.keys).to eq [:view]
146
- end
147
- end
148
- end
@@ -1,27 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- describe Card::View do
4
- it "cache gets cleared by Card::Cache.reset_all" do
5
- Card::View.cache.write "testkey", 1
6
- expect(Card::View.cache.exist? "testkey").to be_truthy
7
- Card::Cache.reset_all
8
- expect(Card::View.cache.exist? "testkey").to be_falsey
9
- end
10
-
11
- def html_message_for user
12
- Card["follower notification email"].format(:email_html)
13
- .render_mail(context: Card["All Eyes On Me"],
14
- to: "#{user}@user.com",
15
- follower: user,
16
- followed_set: "All Eyes On Me+*self",
17
- follow_option: "*always")
18
- .html_part.body.raw_source
19
- end
20
-
21
- example "email templates" do
22
- html_message_for "John"
23
- msg = html_message_for "Sara"
24
- expect(msg).to include("update/Sara+*follow")
25
- .and not_include "John"
26
- end
27
- end
@@ -1,62 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- require "card/mailer"
3
-
4
- describe Card::Mailer do
5
- # include ActionMailer::Quoting
6
-
7
- before do
8
- ActionMailer::Base.deliveries = []
9
-
10
- @expected = Mail.new
11
- end
12
-
13
- #
14
- ## see notifier test for data used in these tests
15
- # FIXME: the cache is not cleared properly between tests. if the order changes
16
- # (ie try renamed change notice below to change_notice) then *notify+*from gets stuck on.
17
- # context "change notice" do
18
- # before do
19
- # user = Card['sara'].id
20
- # card = Card["Sunglasses"]
21
- # action = "edited"
22
- # Card::Mailer.change_notice( user, card, action, card.name ).deliver
23
- # end
24
- #
25
- # it "deliver a message" do
26
- # assert_equal 1, ActionMailer::Base.deliveries.size
27
- # end
28
- #
29
- # context "change notice message" do
30
- # before do
31
- # @mail = ActionMailer::Base.deliveries[0]
32
- # end
33
- # it "is addressed to users email" do
34
- # assert_equal ["sara@user.com"], @mail.to
35
- # end
36
- # it "is from Wag bot email" do
37
- # assert_equal [Card[Card::WagnBotID].account.email], @mail.from
38
- # end
39
- # end
40
- # end
41
- #
42
- # describe "flexmail" do
43
- # # FIXME: at least two tests should be here, with & w/o attachment.
44
- # end
45
-
46
- # describe "cardmail" do
47
- # before do
48
- # Card.gimme "mailtest", content: "test"
49
- # end
50
- # it "renders email text" do
51
- # Card::Mailer.cardmail(to: "sara@user.com").deliver
52
- # @mail = ActionMailer::Base.deliveries.last
53
- # expect(@mail.body).to eq("test")
54
- # end
55
- # end
56
-
57
- private
58
-
59
- def encode subject
60
- quoted_printable(subject, Card::Mailer::CHARSET)
61
- end
62
- end
@@ -1,119 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- describe Card, "created by Card.new" do
4
- before(:each) do
5
- Card::Auth.as_bot do
6
- @c = Card.new name: "New Card", content: "Great Content"
7
- end
8
- end
9
-
10
- it "does not create a new card until saved" do
11
- expect do
12
- Card.new(name: "foo", type: "Cardtype")
13
- end.not_to increase_card_count
14
- end
15
-
16
- it "does not override explicit content with default content", as_bot: true do
17
- create "blue+*right+*default", content: "joe", type: "Pointer"
18
- c = Card.new name: "Lady+blue", content: "[[Jimmy]]"
19
- expect(c.content).to eq("[[Jimmy]]")
20
- end
21
- end
22
-
23
- describe Card, "created by Card.create with valid attributes" do
24
- before(:each) do
25
- Card::Auth.as_bot do
26
- @b = Card.create name: "New Card", content: "Great Content"
27
- @c = Card.find(@b.id)
28
- end
29
- end
30
-
31
- it "does not have errors" do
32
- expect(@b.errors.size).to eq(0)
33
- end
34
- it "has the right class" do
35
- expect(@c.class).to eq(Card)
36
- end
37
- it "has the right key" do
38
- expect(@c.key).to eq("new_card")
39
- end
40
- it "has the right name" do
41
- expect(@c.name).to eq("New Card")
42
- end
43
- it "has the right content" do
44
- expect(@c.content).to eq("Great Content")
45
- end
46
-
47
- it "has the right content" do
48
- expect(@c.db_content).to eq "Great Content"
49
- end
50
-
51
- it "is findable by name" do
52
- expect(Card["New Card"]).to be_a Card
53
- end
54
- end
55
-
56
- describe Card, "create junction two parts" do
57
- before(:each) do
58
- @c = Card.create! name: "Peach+Pear", content: "juicy"
59
- end
60
-
61
- it "doesn't have errors" do
62
- expect(@c.errors.size).to eq(0)
63
- end
64
-
65
- it "creates junction card" do
66
- expect(Card["Peach+Pear"]).to be_a(Card)
67
- end
68
-
69
- it "creates trunk card" do
70
- expect(Card["Peach"]).to be_a(Card)
71
- end
72
-
73
- it "creates tag card" do
74
- expect(Card["Pear"]).to be_a(Card)
75
- end
76
- end
77
-
78
- describe Card, "create junction three parts" do
79
- it "creates very left card" do
80
- Card.create! name: "Apple+Peach+Pear", content: "juicy"
81
- expect(Card["Apple"].class).to eq(Card)
82
- end
83
-
84
- it "sets left and right ids" do
85
- Card.create! name: "Sugar+Milk+Flour", content: "tasty"
86
- sugar_milk = Card["Sugar+Milk"]
87
- sugar_milk_flour = Card["Sugar+Milk+Flour"]
88
- expect(sugar_milk_flour.left_id).to eq(sugar_milk.id)
89
- expect(sugar_milk_flour.right_id).to eq(Card.fetch_id("Flour"))
90
- expect(sugar_milk.left_id).to eq(Card.fetch_id("Sugar"))
91
- expect(sugar_milk.right_id).to eq(Card.fetch_id("Milk"))
92
- end
93
- end
94
-
95
-
96
- describe Card, "Joe User" do
97
- before do
98
- Card::Auth.as_bot do
99
- @r3 = Card["r3"]
100
- Card.create name: "Cardtype F+*type+*create", type: "Pointer", content: "[[r3]]"
101
- end
102
-
103
- @ucard = Card::Auth.current
104
- @type_names = Card::Auth.createable_types
105
- end
106
-
107
- it "does not have r3 permissions" do
108
- expect(@ucard.fetch(new: {}, trait: :roles).item_names.member?(@r3.name)).to be_falsey
109
- end
110
- it "ponders creating a card of Cardtype F, but find that he lacks create permissions" do
111
- expect(Card.new(type: "Cardtype F").ok?(:create)).to be_falsey
112
- end
113
- it "does not find Cardtype F on its list of createable cardtypes" do
114
- expect(@type_names.member?("Cardtype F")).to be_falsey
115
- end
116
- it "finds Basic on its list of createable cardtypes" do
117
- expect(@type_names.member?("Basic")).to be_truthy
118
- end
119
- end