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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/db/migrate/20170908114452_increase_text_size_for_delayed_jobs.rb +9 -0
- data/db/migrate_core_cards/data/cards/*header +2 -2
- data/lib/card/format/nest.rb +12 -5
- data/lib/card/format/nest/fetch.rb +1 -2
- data/lib/card/format/render.rb +2 -2
- data/lib/card/model/save_helper.rb +1 -1
- data/lib/card/set/format/haml_views.rb +7 -3
- data/lib/card/subcards.rb +27 -228
- data/lib/card/subcards/add.rb +121 -0
- data/lib/card/subcards/relate.rb +27 -0
- data/lib/card/subcards/remove.rb +42 -0
- data/lib/card/tasks/card/create.rake +35 -132
- data/lib/card/tasks/card/file_card_creator.rb +25 -0
- data/lib/card/tasks/card/file_card_creator/abstract_file_card.rb +44 -0
- data/lib/card/tasks/card/file_card_creator/abstract_file_card/migration_file.rb +49 -0
- data/lib/card/tasks/card/file_card_creator/abstract_file_card/ruby_file.rb +30 -0
- data/lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb +36 -0
- data/lib/card/tasks/card/file_card_creator/haml_card.rb +42 -0
- data/lib/card/tasks/card/file_card_creator/output_helper.rb +50 -0
- data/lib/card/tasks/card/file_card_creator/script_card.rb +33 -0
- data/lib/card/tasks/card/file_card_creator/style_card.rb +25 -0
- data/lib/generators/card/template/template_generator.rb +1 -1
- data/mod/account/set/self/account_links.rb +1 -1
- data/mod/basic_formats/set/all/all_csv.rb +63 -0
- data/mod/basic_formats/set/all/json.rb +4 -1
- data/mod/bootstrap/db/migrate_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb +5 -2
- data/mod/carrierwave/set/abstract/attachment.rb +1 -2
- data/mod/core/set/abstract/haml_file.rb +20 -0
- data/mod/core/set/all/chunk.rb +125 -0
- data/mod/core/set/all/collection.rb +2 -351
- data/mod/core/set/all/content.rb +26 -7
- data/mod/core/set/all/extended.rb +45 -0
- data/mod/core/set/all/haml.rb +3 -7
- data/mod/core/set/all/item.rb +92 -0
- data/mod/core/set/all/name.rb +36 -0
- data/mod/core/set/all/subcards.rb +21 -12
- data/mod/core/set/all/tabs.rb +50 -0
- data/mod/core/set/all/trash.rb +4 -0
- data/mod/core/spec/set/all/chunk_spec.rb +45 -0
- data/mod/core/spec/set/all/collection_spec.rb +6 -6
- data/mod/history/set/all/action_view.rb +1 -1
- data/mod/machines/lib/javascript/decko.js.coffee +3 -0
- data/mod/pointer/set/abstract/02_pointer/edit.rb +0 -2
- data/mod/search/set/abstract/search.rb +1 -1
- data/mod/search/set/all/filter.rb +0 -2
- data/mod/search/template/all/filter/_filter_input.haml +1 -1
- data/mod/search/template/all/filter/filter_form.haml +1 -1
- data/mod/standard/set/all/rich_html/editing.rb +1 -1
- data/mod/standard/set/all/rich_html/form.rb +6 -7
- data/mod/standard/set/all/rich_html/menu.rb +2 -3
- data/mod/standard/set/all/rich_html/toolbar.rb +3 -4
- data/mod/standard/set/type/cardtype.rb +1 -1
- data/mod/standard/spec/set/all/rich_html/editing_spec.rb +15 -4
- data/mod/tinymce_editor/db/migrate_cards/{20171113233150_update_tinymce_config.rb → 20171113233151_update_tinymce_config.rb} +1 -0
- metadata +25 -161
- data/.rspec +0 -4
- data/card.gemspec +0 -87
- data/db/seed/test/fixtures/.gitkeep +0 -0
- data/mod/bootstrap/vendor/bootstrap/.babelrc.js +0 -16
- data/mod/bootstrap/vendor/bootstrap/.editorconfig +0 -17
- data/mod/bootstrap/vendor/bootstrap/.eslintignore +0 -3
- data/mod/bootstrap/vendor/bootstrap/.gitattributes +0 -16
- data/mod/bootstrap/vendor/bootstrap/.github/CONTRIBUTING.md +0 -252
- data/mod/bootstrap/vendor/bootstrap/.github/ISSUE_TEMPLATE.md +0 -22
- data/mod/bootstrap/vendor/bootstrap/.gitignore +0 -46
- data/mod/bootstrap/vendor/bootstrap/.hound.yml +0 -19
- data/mod/bootstrap/vendor/bootstrap/.houndignore +0 -4
- data/mod/bootstrap/vendor/bootstrap/.travis.yml +0 -32
- data/mod/bootstrap/vendor/bootstrap/build/.htmllintrc +0 -19
- data/mod/bootstrap/vendor/bootstrap/build/.stylelintrc +0 -248
- data/mod/bootstrap/vendor/bootstrap/docs/4.0/examples/.stylelintrc +0 -12
- data/mod/bootstrap/vendor/bootstrap/js/.eslintrc.json +0 -240
- data/mod/bootstrap/vendor/bootstrap/js/tests/.eslintrc.json +0 -46
- data/mod/bootstrap/vendor/bootswatch/.gitignore +0 -7
- data/mod/bootstrap/vendor/bootswatch/.npmignore +0 -12
- data/mod/bootstrap/vendor/bootswatch/.travis.yml +0 -21
- data/mod/bootstrap/vendor/bootswatch/docs/.nojekyll +0 -0
- data/mod/bootstrap/vendor/bootswatch/docs/2/.travis.yml +0 -15
- data/mod/bootstrap/vendor/bootswatch/docs/2/bower_components/bootstrap/.bower.json +0 -20
- data/mod/bootstrap/vendor/bootswatch/docs/2/bower_components/bootstrap/.gitignore +0 -37
- data/mod/bootstrap/vendor/bootswatch/docs/2/bower_components/bootstrap/.travis.yml +0 -3
- data/mod/bootstrap/vendor/bootswatch/docs/2/bower_components/bootstrap/js/.jshintrc +0 -12
- data/mod/bootstrap/vendor/bootswatch/docs/2/bower_components/jquery/.bower.json +0 -20
- data/mod/bootstrap/vendor/bootswatch/docs/2/bower_components/jquery/.gitignore +0 -1
- data/mod/bootstrap/vendor/bootswatch/docs/2/swatchmaker/.gitignore +0 -1
- data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/bootstrap-sass-official/.bower.json +0 -45
- data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/bootstrap/.bower.json +0 -44
- data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/bootstrap/grunt/.jshintrc +0 -7
- data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/bootstrap/js/.jscsrc +0 -42
- data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/bootstrap/js/.jshintrc +0 -15
- data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/bootstrap/less/.csscomb.json +0 -304
- data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/bootstrap/less/.csslintrc +0 -19
- data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/font-awesome/.bower.json +0 -14
- data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/font-awesome/.gitignore +0 -32
- data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/html5shiv/.bower.json +0 -25
- data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/jquery/.bower.json +0 -38
- data/mod/bootstrap/vendor/bootswatch/docs/3/bower_components/respond/.bower.json +0 -20
- data/mod/bootstrap/vendor/select2/.editorconfig +0 -6
- data/mod/bootstrap/vendor/select2/.github/CONTRIBUTING.md +0 -204
- data/mod/bootstrap/vendor/select2/.github/ISSUE_TEMPLATE.md +0 -46
- data/mod/bootstrap/vendor/select2/.github/PULL_REQUEST_TEMPLATE.md +0 -13
- data/mod/bootstrap/vendor/select2/.gitignore +0 -3
- data/mod/bootstrap/vendor/select2/.jshintignore +0 -4
- data/mod/bootstrap/vendor/select2/.jshintrc +0 -25
- data/mod/bootstrap/vendor/select2/.travis.yml +0 -22
- data/script/fetch_bootswatch_themes.rb +0 -38
- data/spec/config/initializers/core_extensions_spec.rb +0 -47
- data/spec/config/initializers/patches/active_job_spec.rb +0 -7
- data/spec/lib/card/action_spec.rb +0 -15
- data/spec/lib/card/auth_spec.rb +0 -58
- data/spec/lib/card/cache_spec.rb +0 -116
- data/spec/lib/card/chunk_spec.rb +0 -18
- data/spec/lib/card/codename_spec.rb +0 -66
- data/spec/lib/card/content_spec.rb +0 -428
- data/spec/lib/card/diff_spec.rb +0 -208
- data/spec/lib/card/format/nest_spec.rb +0 -13
- data/spec/lib/card/format/render_spec.rb +0 -26
- data/spec/lib/card/format_spec.rb +0 -117
- data/spec/lib/card/i18n_spec.rb +0 -24
- data/spec/lib/card/loader/Modfile +0 -2
- data/spec/lib/card/loader_spec.rb +0 -98
- data/spec/lib/card/migration/import_spec.rb +0 -80
- data/spec/lib/card/mod/loader/mod_dirs.rb +0 -8
- data/spec/lib/card/mod/loader/set_loader_spec.rb +0 -19
- data/spec/lib/card/mod/loader/set_pattern_loader_spec.rb +0 -19
- data/spec/lib/card/name/fields_and_traits_spec.rb +0 -18
- data/spec/lib/card/name_spec.rb +0 -70
- data/spec/lib/card/query/sorting_spec.rb +0 -68
- data/spec/lib/card/query_spec.rb +0 -574
- data/spec/lib/card/reference_spec.rb +0 -212
- data/spec/lib/card/set/event_spec.rb +0 -22
- data/spec/lib/card/set/trait_spec.rb +0 -80
- data/spec/lib/card/set_pattern_spec.rb +0 -59
- data/spec/lib/card/set_spec.rb +0 -89
- data/spec/lib/card/stage_director_spec.rb +0 -482
- data/spec/lib/card/subcards_spec.rb +0 -177
- data/spec/lib/card/success_spec.rb +0 -148
- data/spec/lib/card/view_cache_spec.rb +0 -27
- data/spec/mailers/mailer_spec.rb +0 -62
- data/spec/models/card/create_spec.rb +0 -119
- data/spec/models/card/trash_spec.rb +0 -189
- data/spec/models/card_spec.rb +0 -136
- data/spec/spec_helper.rb +0 -45
- data/spec/support/card_spec_helper.rb +0 -74
- data/spec/support/card_spec_loader.rb +0 -112
- data/spec/support/helper/card_helper.rb +0 -58
- data/spec/support/helper/event_helper.rb +0 -94
- data/spec/support/helper/render_helper.rb +0 -44
- data/spec/support/helper/save_helper.rb +0 -30
- data/spec/support/helper/set_helper.rb +0 -80
- data/spec/support/matchers/card_matchers.rb +0 -160
- data/spec/support/matchers/expectations.rb +0 -5
- data/spec/support/matchers/file_matchers.rb +0 -71
- data/spec/support/matchers/html_matchers.rb +0 -29
- data/spec/support/matchers/negated_matchers.rb +0 -2
- data/spec/support/simplecov_helper.rb +0 -70
- data/spec/support/test_mods/mod1/set/all/test_set.rb +0 -3
- data/spec/support/test_mods/mod2/set_pattern/test_pattern.rb +0 -0
data/spec/lib/card/diff_spec.rb
DELETED
@@ -1,208 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
# !/usr/bin/env ruby
|
3
|
-
|
4
|
-
require "card/content/diff"
|
5
|
-
|
6
|
-
describe Card::Content::Diff do
|
7
|
-
def del text
|
8
|
-
"<del class='diffdel diff-deleted'>#{text}</del>"
|
9
|
-
end
|
10
|
-
|
11
|
-
def ins text
|
12
|
-
"<ins class='diffins diff-added'>#{text}</ins>"
|
13
|
-
end
|
14
|
-
|
15
|
-
def tag text
|
16
|
-
"<#{text}>"
|
17
|
-
end
|
18
|
-
|
19
|
-
def diff old_s, new_s, opts=@opts
|
20
|
-
Card::Content::Diff.complete(old_s, new_s, opts)
|
21
|
-
end
|
22
|
-
|
23
|
-
def summary old_s, new_s, opts=@opts
|
24
|
-
Card::Content::Diff.summary(old_s, new_s, opts)
|
25
|
-
end
|
26
|
-
|
27
|
-
old_p = "<p>old</p>"
|
28
|
-
new_p = "<p>new</p>"
|
29
|
-
new_h = "<h1>new</h1>"
|
30
|
-
def p_diff
|
31
|
-
diff "<p>old</p>", "<p>new</p>"
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "traffic light" do
|
35
|
-
it "is green for addition" do
|
36
|
-
a = "a"
|
37
|
-
b = "a b"
|
38
|
-
db = Card::Content::Diff.new(a, b)
|
39
|
-
expect(db.green?).to be_truthy
|
40
|
-
expect(db.red?).to be_falsey
|
41
|
-
end
|
42
|
-
it "is red for deletion" do
|
43
|
-
a = "a"
|
44
|
-
b = ""
|
45
|
-
db = Card::Content::Diff.new(a, b)
|
46
|
-
expect(db.green?).to be_falsey
|
47
|
-
expect(db.red?).to be_truthy
|
48
|
-
end
|
49
|
-
it "is green and red for change" do
|
50
|
-
a = "a"
|
51
|
-
b = "b"
|
52
|
-
db = Card::Content::Diff.new(a, b)
|
53
|
-
expect(db.green?).to be_truthy
|
54
|
-
expect(db.red?).to be_truthy
|
55
|
-
end
|
56
|
-
it "is off for no change" do
|
57
|
-
a = "a"
|
58
|
-
b = "a"
|
59
|
-
db = Card::Content::Diff.new(a, b)
|
60
|
-
expect(db.green?).to be_falsey
|
61
|
-
expect(db.red?).to be_falsey
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe "summary" do
|
66
|
-
before(:all) do
|
67
|
-
@opts = { diff_format: :html }
|
68
|
-
end
|
69
|
-
|
70
|
-
it "omits unchanged text" do
|
71
|
-
a = "<p>this was the original string</p>"
|
72
|
-
b = "<p>this is the new string</p>"
|
73
|
-
expect(summary a, b).to eq(
|
74
|
-
"...#{del 'was'}#{ins 'is'}...#{del 'original'}#{ins 'new'}..."
|
75
|
-
)
|
76
|
-
end
|
77
|
-
|
78
|
-
it "no ellipsis if changes fit exactly" do
|
79
|
-
a = "123"
|
80
|
-
b = "456"
|
81
|
-
expect(summary a, b, summary: { length: 6 }).to eq(
|
82
|
-
"#{del '123'}#{ins '456'}"
|
83
|
-
)
|
84
|
-
end
|
85
|
-
|
86
|
-
it "green ellipsis if added text does not fit" do
|
87
|
-
a = "123"
|
88
|
-
b = "5678"
|
89
|
-
expect(summary a, b, summary: { length: 6 }).to eq(
|
90
|
-
"#{del '123'}#{ins '...'}"
|
91
|
-
)
|
92
|
-
end
|
93
|
-
|
94
|
-
it "neutral ellipsis if complete change does not fit" do
|
95
|
-
a = "123 123"
|
96
|
-
b = "456 456"
|
97
|
-
expect(summary a, b, summary: { length: 9 }).to eq(
|
98
|
-
"#{del '123'}#{ins '456'}..."
|
99
|
-
)
|
100
|
-
end
|
101
|
-
|
102
|
-
it "red ellipsis if deleted text partially fits" do
|
103
|
-
a = "123456"
|
104
|
-
b = "567"
|
105
|
-
expect(summary a, b, summary: { length: 4 }).to eq(
|
106
|
-
(del "1...").to_s
|
107
|
-
)
|
108
|
-
end
|
109
|
-
|
110
|
-
it "green ellipsis if added text partially fits" do
|
111
|
-
a = "1234"
|
112
|
-
b = "56789"
|
113
|
-
expect(summary a, b, summary: { length: 8 }).to eq(
|
114
|
-
"#{del '1234'}#{ins '5...'}"
|
115
|
-
)
|
116
|
-
end
|
117
|
-
|
118
|
-
it "removes html tags" do
|
119
|
-
a = "<a>A</a>"
|
120
|
-
b = "<b>B</b>"
|
121
|
-
expect(summary a, b, diff_format: :html).to eq(
|
122
|
-
"#{del 'A'}#{ins 'B'}"
|
123
|
-
)
|
124
|
-
end
|
125
|
-
|
126
|
-
it "with html tags in raw format" do
|
127
|
-
a = "<a>1</a>"
|
128
|
-
b = "<b>1</b>"
|
129
|
-
expect(summary a, b, diff_format: :raw).to eq(
|
130
|
-
"#{del(tag 'a')}#{ins(tag 'b')}...#{del(tag '/a')}#{ins(tag '/b')}"
|
131
|
-
)
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
context "html format" do
|
136
|
-
before(:all) do
|
137
|
-
@opts = { diff_format: :html }
|
138
|
-
end
|
139
|
-
|
140
|
-
it "doesn't change a text without changes" do
|
141
|
-
text = "Hello World!\n How are you?"
|
142
|
-
expect(diff text, text).to eq(text)
|
143
|
-
end
|
144
|
-
it "preserves html" do
|
145
|
-
expect(p_diff).to eq("<p>#{del 'old'}#{ins 'new'}</p>")
|
146
|
-
end
|
147
|
-
it "ignores html changes" do
|
148
|
-
expect(diff old_p, new_h).to eq("<h1>#{del 'old'}#{ins 'new'}</h1>")
|
149
|
-
end
|
150
|
-
|
151
|
-
it "diff with multiple paragraphs" do
|
152
|
-
a = "<p>this was the original string</p>"
|
153
|
-
b = "<p>this is</p>\n<p> the new string</p>\n<p>around the world</p>"
|
154
|
-
|
155
|
-
expect(diff a, b).to eq(
|
156
|
-
"<p>this #{del 'was'}#{ins 'is'}</p>"\
|
157
|
-
"\n<p> the " \
|
158
|
-
"#{del 'original'}#{ins 'new'}" \
|
159
|
-
" string</p>\n" \
|
160
|
-
"<p>#{ins 'around the world'}</p>"
|
161
|
-
)
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
context "text format" do
|
166
|
-
before(:all) do
|
167
|
-
@opts = { diff_format: :text }
|
168
|
-
end
|
169
|
-
|
170
|
-
it "removes html" do
|
171
|
-
expect(p_diff).to eq("#{del 'old'}#{ins 'new'}")
|
172
|
-
end
|
173
|
-
|
174
|
-
it "compares complete links" do
|
175
|
-
diff = Card::Content::Diff.complete("[[A]]\n[[B]]", "[[A]]\n[[C]]", diff_format: :html)
|
176
|
-
expect(diff).to eq("[[A]]\n#{del '[[B]]'}#{ins '[[C]]'}")
|
177
|
-
end
|
178
|
-
|
179
|
-
it "compares complete nests" do
|
180
|
-
diff = Card::Content::Diff.complete("{{A}}\n{{B}}", "{{A}}\n{{C}}", diff_format: :html)
|
181
|
-
expect(diff).to eq("{{A}}\n#{del '{{B}}'}#{ins '{{C}}'}")
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
context "raw format" do
|
186
|
-
before(:all) do
|
187
|
-
@opts = { diff_format: :raw }
|
188
|
-
end
|
189
|
-
|
190
|
-
it "excapes html" do
|
191
|
-
expect(p_diff).to eq("#{tag 'p'}#{del 'old'}#{ins 'new'}#{tag '/p'}")
|
192
|
-
end
|
193
|
-
|
194
|
-
it "diff for tag change" do
|
195
|
-
expect(diff old_p, new_h).to eq(del("#{tag 'p'}old#{tag '/p'}") + ins("#{tag 'h1'}new#{tag '/h1'}"))
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
context "pointer format" do
|
200
|
-
before(:all) do
|
201
|
-
@opts = { diff_format: :pointer }
|
202
|
-
end
|
203
|
-
|
204
|
-
it "removes square brackets" do
|
205
|
-
expect(diff "[[Hello]]", "[[Hi]]").to eq(del("Hello<br>") + ins("Hi<br>"))
|
206
|
-
end
|
207
|
-
end
|
208
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
describe Card::Format::Nest do
|
4
|
-
it "doesn't crash because of a loop in email templates" do
|
5
|
-
# 'follower notification email' in closed view is trapped in a loop of
|
6
|
-
# rendering a user card.
|
7
|
-
# It is expected to stop after a few iterations because we have a maximum
|
8
|
-
# content length for closed view. So if this crashes it's likely that
|
9
|
-
# there is a bug in calculating the @char_count in closed mode.
|
10
|
-
content = render_content "{{Email Templates+*type+by update|content}}"
|
11
|
-
expect(content).to be_truthy
|
12
|
-
end
|
13
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
describe Card::Format::Render do
|
2
|
-
describe "render" do
|
3
|
-
it "return nil with 'optional: :hide' argument" do
|
4
|
-
rendered = Card["A"].format(:html).render(:open, optional: :hide)
|
5
|
-
expect(rendered).to be_blank
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "view cache" do
|
10
|
-
before { Cardio.config.view_cache = true }
|
11
|
-
|
12
|
-
let(:cache_key) do
|
13
|
-
"z-Card::Format::HtmlFormat-normal-home_view:content;"\
|
14
|
-
"nest_name:Z;nest_syntax:Z|content;view:contentcontent:show"
|
15
|
-
end
|
16
|
-
|
17
|
-
subject { Card::Cache[Card::View] }
|
18
|
-
|
19
|
-
it "can be changed with nest option" do
|
20
|
-
is_expected.to receive(:fetch).with cache_key
|
21
|
-
render_content "{{Z|content}}"
|
22
|
-
is_expected.not_to receive(:fetch)
|
23
|
-
render_content "{{Z|cache:never}}"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,117 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
describe Card::Format do
|
4
|
-
describe "#show_view?" do
|
5
|
-
let(:format) { described_class.new Card.new }
|
6
|
-
|
7
|
-
def show_menu? args, default_viz=:show
|
8
|
-
args.merge! optional: true
|
9
|
-
format.with_voo(Card::View.new format, :nonview, args) do
|
10
|
-
format.show_view?(:menu, default_viz)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
it "respects defaults" do
|
15
|
-
expect(show_menu?({}, :show)).to be_truthy
|
16
|
-
expect(show_menu?({}, :hide)).to be_falsey
|
17
|
-
expect(show_menu?({})).to be_truthy
|
18
|
-
end
|
19
|
-
|
20
|
-
it "respects developer defaults" do
|
21
|
-
expect(show_menu?({ show: "menu" }, :hide)).to be_truthy
|
22
|
-
expect(show_menu?({ hide: "menu" }, :show)).to be_falsey
|
23
|
-
expect(show_menu?(hide: "menu")).to be_falsey
|
24
|
-
end
|
25
|
-
|
26
|
-
it "handles args from nests" do
|
27
|
-
expect(show_menu?({ show: "menu" }, :hide)).to be_truthy
|
28
|
-
expect(show_menu?({ hide: "menu, paging" }, :show)).to be_falsey
|
29
|
-
expect(show_menu?({ show: "menu" }, :hide)).to be_truthy
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "format helpers and link building" do
|
34
|
-
before :each do
|
35
|
-
# should be a way to get these defaults in these tests
|
36
|
-
Card::Env[:host] = "//test.host"
|
37
|
-
Card::Env[:protocol] = "http:"
|
38
|
-
end
|
39
|
-
|
40
|
-
let(:card) { Card["Home"] }
|
41
|
-
let(:text_format) { card.format(:text) }
|
42
|
-
let(:html_format) { card.format }
|
43
|
-
let(:url_text1) do
|
44
|
-
"with external free link http://localhost:2020/path?cgi=foo&bar=baz"
|
45
|
-
end
|
46
|
-
let(:url_text2) { "with external in link syntax: [[http://brain.org/Home|extra]]" }
|
47
|
-
let(:url_text3) { "with internal lik [[A]]" }
|
48
|
-
let(:url_text4) { "with internal lik [[Home|display text]]" }
|
49
|
-
let(:url_text5) do
|
50
|
-
"external with port: http://localhost:2020/path?cgi=foo+bar=baz after "
|
51
|
-
end
|
52
|
-
|
53
|
-
it "formats links" do
|
54
|
-
cobj = Card::Content.new url_text1, text_format
|
55
|
-
expect(cobj.to_s).to eq url_text1
|
56
|
-
cobj = Card::Content.new url_text2, text_format
|
57
|
-
expect(cobj.to_s).to eq url_text2
|
58
|
-
cobj = Card::Content.new url_text3, text_format
|
59
|
-
expect(cobj.to_s).to eq url_text3
|
60
|
-
cobj = Card::Content.new url_text4, text_format
|
61
|
-
expect(cobj.to_s).to eq url_text4
|
62
|
-
cobj = Card::Content.new url_text5, text_format
|
63
|
-
expect(cobj.to_s).to eq url_text5
|
64
|
-
end
|
65
|
-
|
66
|
-
it "formats html links" do
|
67
|
-
cobj = Card::Content.new url_text1, html_format
|
68
|
-
expect(cobj.to_s).to eq(
|
69
|
-
'with external free link <a target="_blank" class="external-link" ' \
|
70
|
-
'href="http://localhost:2020/path?cgi=foo&bar=baz">' \
|
71
|
-
"http://localhost:2020/path?cgi=foo&bar=baz</a>"
|
72
|
-
)
|
73
|
-
cobj = Card::Content.new url_text2 + url_text3 + url_text4, html_format
|
74
|
-
expect(cobj.to_s).to eq url_text2 + url_text3 + url_text4
|
75
|
-
cobj = Card::Content.new url_text5, html_format
|
76
|
-
expect(cobj.to_s).to eq(
|
77
|
-
'external with port: <a target="_blank" class="external-link" ' \
|
78
|
-
'href="http://localhost:2020/path?cgi=foo+bar=baz">' \
|
79
|
-
"http://localhost:2020/path?cgi=foo+bar=baz</a> after "
|
80
|
-
)
|
81
|
-
end
|
82
|
-
|
83
|
-
it "formats page_path" do
|
84
|
-
expect(text_format.page_path(card.name)).to eq "/" + card.name
|
85
|
-
expect(html_format.page_path(card.name)).to eq "/" + card.name
|
86
|
-
page_path = text_format.page_path card.name,
|
87
|
-
format: "txt", opt1: 11, opt2: "foo"
|
88
|
-
expect(page_path).to eq "/#{card.name}.txt?opt1=11&opt2=foo"
|
89
|
-
end
|
90
|
-
|
91
|
-
it "fomats full path and url" do
|
92
|
-
expect(text_format.card_path(card.name)).to eq "/#{card.name}"
|
93
|
-
expect(html_format.card_url(card.name))
|
94
|
-
.to eq "http://test.host/#{card.name}"
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
describe "async view" do
|
99
|
-
let(:format) do
|
100
|
-
Card["A"].format_with do
|
101
|
-
view :lazy_view, async: true do
|
102
|
-
"content"
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
it "renders placeholder" do
|
108
|
-
expect(format.render!(:lazy_view))
|
109
|
-
.to eq %(<card-view-placeholder data-url="/A?view=lazy_view_async_content" />)
|
110
|
-
end
|
111
|
-
|
112
|
-
it "renders content in _async_content view" do
|
113
|
-
expect(format.render!(:lazy_view_async_content))
|
114
|
-
.to eq "content"
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
data/spec/lib/card/i18n_spec.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
require "i18n/tasks"
|
4
|
-
|
5
|
-
RSpec.describe "I18n" do
|
6
|
-
# Note: I18n::Tasks only knows how to function when run from root of Card GEM,
|
7
|
-
# since it locates its configuration file and source to parse relative to this
|
8
|
-
let(:i18n) { Dir.chdir(Cardio.gem_root) { I18n::Tasks::BaseTask.new } }
|
9
|
-
let(:missing_keys) { Dir.chdir(Cardio.gem_root) { i18n.missing_keys } }
|
10
|
-
let(:unused_keys) { Dir.chdir(Cardio.gem_root) { i18n.unused_keys } }
|
11
|
-
|
12
|
-
it "does not have missing keys" do
|
13
|
-
expect(missing_keys).to be_empty,
|
14
|
-
"Missing #{missing_keys.leaves.count} i18n keys, to show them `cd` to " \
|
15
|
-
"root of `card` gem and run `i18n-tasks missing`"
|
16
|
-
end
|
17
|
-
|
18
|
-
it "does not have unused keys" do
|
19
|
-
pending
|
20
|
-
expect(unused_keys).to be_empty,
|
21
|
-
"#{unused_keys.leaves.count} unused i18n keys, to show them `cd` to " \
|
22
|
-
"root of `card` gem and run `i18n-tasks unused`"
|
23
|
-
end
|
24
|
-
end
|
@@ -1,98 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
describe Card::Mod::Loader do
|
4
|
-
# let(:card_double) { double "Card" }
|
5
|
-
# let(:pat_all_double) { proxy Card::Set::All }
|
6
|
-
# let(:format_double) { proxy Card::Format }
|
7
|
-
# let(:html_format_double) { proxy Card::Format::HtmlFormat }
|
8
|
-
# it "autos-load Card class methods from lib/card and mods" do
|
9
|
-
# #xpect(Card).to receive(:load_mods)
|
10
|
-
# #
|
11
|
-
# allow(Card::Mod::Loader).to receive(:load_mods)
|
12
|
-
# #card = Card[:all]
|
13
|
-
# #expect(card_double).to receive(:load_formats)
|
14
|
-
# #expect(Card).to receive(:load_sets)
|
15
|
-
# #expect(Card).to receive(:tracks).with(:any_args) # so Card still loads without core in failure testing
|
16
|
-
# Card[:all]
|
17
|
-
# expect(Card::Mod::Loader).to have_received(:load_mods)
|
18
|
-
# #expect(Card.instance_method(:version)).to be
|
19
|
-
# # allow(Card).to receive(:version)
|
20
|
-
# # expect(Card.instance_method(:type_card)).to be
|
21
|
-
# # allow(Card).to receive(:file_path_sdfs)
|
22
|
-
# #expect(Card.instance_method(:file_path)).to be
|
23
|
-
# end
|
24
|
-
# it "defines Card methods from modules" do
|
25
|
-
# expect(Card.instance_method(:set_modules)).to be
|
26
|
-
# end
|
27
|
-
# it "defines Formatter methods from modules" do
|
28
|
-
# #expect(Card.instance_method(:render_core)).to be
|
29
|
-
# expect(Card.instance_method(:_render_raw)).to be
|
30
|
-
# expect(Card.instance_method(:render_core)).to be
|
31
|
-
# expect(Card.instance_method(:_render_raw)).to be
|
32
|
-
# end
|
33
|
-
# it "defines Formatter methods from modules" do
|
34
|
-
# expect(html_format_double.method(:render_core)).to be
|
35
|
-
# expect(html_format_double.method(:_render_raw)).to be
|
36
|
-
# expect(html_format_double.method(:render_core)).to be
|
37
|
-
# expect(html_format_double.method(:_render_raw)).to be
|
38
|
-
# end
|
39
|
-
|
40
|
-
it "loads self set" do
|
41
|
-
create_card "set test load", codename: "set_test_load"
|
42
|
-
Card::Cache.reset_all
|
43
|
-
class ::Card::Set::Self
|
44
|
-
module SetTestLoad
|
45
|
-
extend Card::Set
|
46
|
-
def hello
|
47
|
-
"hello"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
expect(Card["set_test_load"]).to respond_to :hello
|
53
|
-
end
|
54
|
-
|
55
|
-
it "loads self set for junction card" do
|
56
|
-
create_card "set+test+load", codename: "set_test_load"
|
57
|
-
Card::Cache.reset_all
|
58
|
-
class ::Card::Set::Self
|
59
|
-
module SetTestLoad
|
60
|
-
extend Card::Set
|
61
|
-
def hello
|
62
|
-
"hello"
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
expect(Card["set+test+load"]).to respond_to :hello
|
68
|
-
end
|
69
|
-
|
70
|
-
it "loads type set" do
|
71
|
-
create_card "set test load", codename: "set_test_load", type_id: Card::CardtypeID
|
72
|
-
Card::Cache.reset_all
|
73
|
-
class ::Card::Set::Type
|
74
|
-
module SetTestLoad
|
75
|
-
extend Card::Set
|
76
|
-
def hello
|
77
|
-
"hello"
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
expect(Card.new(name: "test load", type: "set test load")).to respond_to :hello
|
82
|
-
end
|
83
|
-
|
84
|
-
it "loads type set for a junction cardtyp" do
|
85
|
-
create_card "set+test load", codename: "set_test_load", type_id: Card::CardtypeID
|
86
|
-
Card::Cache.reset_all
|
87
|
-
class ::Card::Set::Type
|
88
|
-
module SetTestLoad
|
89
|
-
extend Card::Set
|
90
|
-
def hi
|
91
|
-
"hello"
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
expect(Card.new(name: "test load", type: "set+test load")).to respond_to :hi
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|