card 1.16.4 → 1.16.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/db/migrate_core_cards/20150429090551_search_card_context.rb +34 -0
  4. data/db/migrate_core_cards/20150824135418_update_file_history.rb +10 -5
  5. data/db/migrate_core_cards/20150910085603_remove_performance_log_card.rb +10 -0
  6. data/db/seed/new/card_actions.yml +358 -366
  7. data/db/seed/new/card_acts.yml +1 -1
  8. data/db/seed/new/card_changes.yml +1379 -1399
  9. data/db/seed/new/card_references.yml +1109 -710
  10. data/db/seed/new/cards.yml +1436 -1454
  11. data/db/seed/test/fixtures/card_actions.yml +1031 -1039
  12. data/db/seed/test/fixtures/card_acts.yml +155 -155
  13. data/db/seed/test/fixtures/card_changes.yml +4148 -4168
  14. data/db/seed/test/fixtures/card_references.yml +1577 -1178
  15. data/db/seed/test/fixtures/cards.yml +2259 -2277
  16. data/db/version_core_cards.txt +1 -1
  17. data/lib/card.rb +3 -2
  18. data/lib/card/env.rb +66 -0
  19. data/lib/card/format.rb +3 -38
  20. data/lib/card/loader.rb +0 -4
  21. data/lib/card/location.rb +38 -0
  22. data/lib/card/set.rb +1 -3
  23. data/lib/card/success.rb +2 -3
  24. data/mod/01_core/format/html_format.rb +0 -48
  25. data/mod/01_core/set/all/collection.rb +9 -7
  26. data/mod/01_core/set/all/initialize.rb +5 -0
  27. data/mod/01_core/set/all/location_history.rb +10 -0
  28. data/mod/01_core/set/all/phases.rb +2 -1
  29. data/mod/01_core/set/all/rules.rb +0 -2
  30. data/mod/01_core/set/all/trash.rb +3 -2
  31. data/mod/01_core/set/all/utils.rb +12 -0
  32. data/mod/01_core/spec/set/all/permissions_spec.rb +8 -8
  33. data/mod/01_core/spec/set/all/type_spec.rb +14 -14
  34. data/mod/01_history/set/all/content_history.rb +7 -3
  35. data/mod/01_history/set/all/history.rb +3 -3
  36. data/mod/02_basic_types/set/type/pointer.rb +8 -1
  37. data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +39 -0
  38. data/mod/03_machines/lib/stylesheets/style_cards.scss +12 -2
  39. data/mod/03_machines/set/right/machine_output.rb +4 -0
  40. data/mod/03_machines/set/type/css.rb +1 -1
  41. data/mod/04_settings/spec/set/right/structure_spec.rb +1 -1
  42. data/mod/05_email/set/all/observer.rb +5 -5
  43. data/mod/05_email/set/type_plus_right/user/follow.rb +1 -1
  44. data/mod/05_standard/file/favicon/image-icon.png +0 -0
  45. data/mod/05_standard/file/favicon/image-large.png +0 -0
  46. data/mod/05_standard/file/favicon/image-medium.png +0 -0
  47. data/mod/05_standard/file/favicon/image-original.png +0 -0
  48. data/mod/05_standard/file/favicon/image-small.png +0 -0
  49. data/mod/05_standard/lib/carrier_wave/cardmount.rb +8 -2
  50. data/mod/05_standard/lib/file_uploader.rb +47 -35
  51. data/mod/05_standard/set/abstract/attachment.rb +87 -35
  52. data/mod/05_standard/set/all/error.rb +1 -1
  53. data/mod/05_standard/set/all/links.rb +1 -0
  54. data/mod/05_standard/set/self/signin.rb +1 -1
  55. data/mod/05_standard/set/type/file.rb +16 -1
  56. data/mod/05_standard/set/type/image.rb +2 -0
  57. data/mod/05_standard/set/type/search_type.rb +2 -2
  58. data/mod/05_standard/spec/chunk/link_spec.rb +42 -32
  59. data/mod/05_standard/spec/set/all/links_spec.rb +15 -0
  60. data/mod/05_standard/spec/set/self/head_spec.rb +3 -3
  61. data/mod/05_standard/spec/set/type/email_template_spec.rb +39 -39
  62. data/mod/05_standard/spec/set/type/file_spec.rb +0 -12
  63. data/mod/05_standard/spec/set/type/image_spec.rb +26 -2
  64. data/spec/lib/card/content_spec.rb +169 -154
  65. data/spec/lib/card/format_spec.rb +7 -7
  66. data/spec/lib/card/success_spec.rb +1 -1
  67. metadata +7 -6
  68. data/lib/card/log.rb +0 -545
  69. data/mod/05_standard/set/self/performance_log.rb +0 -92
  70. data/spec/lib/card/log_spec.rb +0 -270
@@ -74,16 +74,4 @@ describe Card::Set::Type::File do
74
74
  expect(Card['url test'].file.url).to match /\.png$/
75
75
  end
76
76
 
77
- context "mod file" do
78
- subject { Card[:logo] }
79
- describe "#mod_file?" do
80
- it "returns the mod name" do
81
- expect(subject.mod_file?).to eq('05_standard')
82
- end
83
- end
84
-
85
- it "has correct url " do
86
- expect(subject.content).to eq ":#{subject.codename}/05_standard.png"
87
- end
88
- end
89
77
  end
@@ -89,11 +89,35 @@ describe Card::Set::Type::Image do
89
89
  end
90
90
 
91
91
  describe '*logo mod image' do
92
+ subject { Card[:logo] }
92
93
  it 'exists' do
93
- expect(Card[:logo].image.size).to be > 0
94
+ expect(subject.image.size).to be > 0
94
95
  end
95
96
  it 'has correct url' do
96
- expect(Card[:logo].image.url).to eq "/files/:logo/image-original.png"
97
+ expect(subject.image.url).to eq "/files/:logo/05_standard-original.png"
98
+ end
99
+ it "has correct url as content" do
100
+ expect(subject.content).to eq ":#{subject.codename}/05_standard.png"
101
+ end
102
+
103
+ it "becomes a regular file when changed" do
104
+ Card::Auth.as_bot do
105
+ subject.update_attributes! :image=>File.new( File.join FIXTURES_PATH, 'rails.gif' )
106
+ end
107
+ expect(subject.mod_file?).to be_falsey
108
+ expect(subject.image.url).to eq "/files/~#{subject.id}/#{subject.last_action_id}-original.gif"
109
+ end
110
+
111
+ describe "#mod_file?" do
112
+ it "returns the mod name" do
113
+ expect(subject.mod_file?).to eq('05_standard')
114
+ end
115
+ end
116
+
117
+ describe "source view" do
118
+ it "renders url with medium version" do
119
+ expect(subject.format.render_source).to eq "/files/:#{subject.codename}/05_standard-medium.png"
120
+ end
97
121
  end
98
122
  end
99
123
 
@@ -1,27 +1,118 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'card/content'
3
3
 
4
- CONTENT = {
5
- :one => %(Some Literals: \\[{I'm not| a link]}, and \\{{This Card|Is not Included}}, but {{this is}}, and some tail),
6
- #:two => %(Some Links and includes: [[the card|the text]], and {{This Card|Is Included}}{{this too}}
7
- # more formats for links and includes: [the card][the text],
8
- # and [[http://external.wagn.org/path|link text]][This Card][Is linked]{{Included|open}}),
9
- :two => %(Some Links and includes: [[the card|the text]], and {{This Card|Is Included}}{{this too}}
4
+ EXAMPLES = {
5
+ :nests => {
6
+ :content =>
7
+ [
8
+ "Some Literals: \\[{I'm not| a link]}, and ",
9
+ "\\{{This Card|Is not Included}}",
10
+ ", but ",
11
+ "{{this is}}",
12
+ ", and some tail"
13
+ ].join(''),
14
+ :rendered =>
15
+ [
16
+ "Some Literals: \\[{I'm not| a link]}, and ",
17
+ "<span>{</span>{This Card|Is not Included}}",
18
+ ", but ",
19
+ {:options => {:inc_name=>"this is",:inc_syntax=>"this is"}},
20
+ ", and some tail"
21
+ ],
22
+ :classes => [String, :EscapedLiteral, String, :Include, String ]
23
+ },
24
+
25
+ :links_and_nests => {
26
+ :content => %(Some Links and includes: [[the card|the text]], and {{This Card|Is Included}}{{this too}}
10
27
  and [[http://external.wagn.org/path|link text]]{{Included|open}}),
11
-
12
- :three =>%(Some URIs and Links: http://a.url.com/
28
+ :rendered =>
29
+ [
30
+ "Some Links and includes: ",
31
+ "<a class=\"wanted-card\" href=\"/the_card?card%5Bname%5D=the+card\">the text</a>",
32
+ ", and ",
33
+ { :options => { :view => "Is Included", :inc_name=>"This Card", :inc_syntax => "This Card|Is Included"}},
34
+ { :options => { :inc_name=>"this too", :inc_syntax=>"this too"}},
35
+ "\n and ",
36
+ "<a target=\"_blank\" class=\"external-link\" href=\"http://external.wagn.org/path\">link text</a>",
37
+ { :options => { :view=>"open", :inc_name=>"Included", :inc_syntax=>"Included|open" }}
38
+ ],
39
+ :classes => [String, :Link, String, :Include, :Include, String, :Link, :Include ]
40
+ },
41
+
42
+ :uris_and_links => {
43
+ :content => %(Some URIs and Links: http://a.url.com/
13
44
  More urls: wagn.com/a/path/to.html
14
45
  http://localhost:2020/path?cgi=foo&bar=baz [[http://brain.org/Home|extra]]
15
46
  [ http://gerry.wagn.com/a/path ]
16
47
  { https://brain.org/more?args }),
17
- :three_b => %(Some URIs and Links: http://a.url.com
48
+ :rendered =>
49
+ [
50
+ "Some URIs and Links: ", '<a target="_blank" class="external-link" href="http://a.url.com/">http://a.url.com/</a>',
51
+ "\n More urls: ",
52
+ "<a target=\"_blank\" class=\"external-link\" href=\"http://wagn.com/a/path/to.html\">wagn.com/a/path/to.html</a>",
53
+ "\n ",
54
+ "<a target=\"_blank\" class=\"external-link\" href=\"http://localhost:2020/path?cgi=foo&amp;bar=baz\">http://localhost:2020/path?cgi=foo&bar=baz</a>",
55
+ " ",
56
+ "<a target=\"_blank\" class=\"external-link\" href=\"http://brain.org/Home\">extra</a>",
57
+ "\n [ ",
58
+ "<a target=\"_blank\" class=\"external-link\" href=\"http://gerry.wagn.com/a/path\">http://gerry.wagn.com/a/path</a>",
59
+ " ]\n { ",
60
+ "<a target=\"_blank\" class=\"external-link\" href=\"https://brain.org/more?args\">https://brain.org/more?args</a>",
61
+ " }"
62
+ ],
63
+ :text_rendered =>
64
+ [
65
+ "Some URIs and Links: ", 'http://a.url.com/',
66
+ "\n More urls: ",
67
+ "wagn.com/a/path/to.html[http://wagn.com/a/path/to.html]",
68
+ "\n ",
69
+ "http://localhost:2020/path?cgi=foo&bar=baz",
70
+ " ",
71
+ "extra[http://brain.org/Home]",
72
+ "\n [ ",
73
+ "http://gerry.wagn.com/a/path",
74
+ " ]\n { ",
75
+ "https://brain.org/more?args",
76
+ " }"
77
+ ],
78
+ :classes => [String, :URI, String, :HostURI, String, :URI, String, :Link, String, :URI, String, :URI, String ]
79
+ },
80
+
81
+ :uris_and_links_2 => {
82
+ :content => %(Some URIs and Links: http://a.url.com
18
83
  More urls: wagn.com/a/path/to.html
19
84
  [ http://gerry.wagn.com/a/path ]
20
85
  { https://brain.org/more?args }
21
86
  http://localhost:2020/path?cgi=foo&bar=baz [[http://brain.org/Home|extra]]),
22
- :four => "No chunks",
23
- :five => "{{one inclusion|size;large}}",
24
- :six => %~
87
+ :rendered =>
88
+ [
89
+ "Some URIs and Links: ","<a target=\"_blank\" class=\"external-link\" href=\"http://a.url.com\">http://a.url.com</a>",
90
+ "\n More urls: ",
91
+ "<a target=\"_blank\" class=\"external-link\" href=\"http://wagn.com/a/path/to.html\">wagn.com/a/path/to.html</a>",
92
+ "\n [ ",
93
+ "<a target=\"_blank\" class=\"external-link\" href=\"http://gerry.wagn.com/a/path\">http://gerry.wagn.com/a/path</a>",
94
+ " ]\n { ",
95
+ "<a target=\"_blank\" class=\"external-link\" href=\"https://brain.org/more?args\">https://brain.org/more?args</a>",
96
+ " }\n ",
97
+ "<a target=\"_blank\" class=\"external-link\" href=\"http://localhost:2020/path?cgi=foo&amp;bar=baz\">http://localhost:2020/path?cgi=foo&bar=baz</a>",
98
+ " ",
99
+ "<a target=\"_blank\" class=\"external-link\" href=\"http://brain.org/Home\">extra</a>"
100
+ ],
101
+ :classes => [String, :URI, String, :HostURI, String, :URI, String, :URI, String, :URI, String, :Link ]
102
+ },
103
+
104
+ :no_chunks => {
105
+ :content => "No chunks",
106
+ :rendered => "No chunks"
107
+ },
108
+
109
+ :single_nest => {
110
+ :content => "{{one inclusion|size;large}}",
111
+ :classes => [:Include]
112
+ },
113
+
114
+ :css => {
115
+ :content => %~
25
116
  /* body text */
26
117
  body {
27
118
  color: #444444;
@@ -44,91 +135,23 @@ CONTENT = {
44
135
  h1, h2 {
45
136
  color: #664444;
46
137
  }
47
- h1.page-header,
138
+ h1.page-header,
48
139
  h2.page-header {
49
- color: #222299;
140
+ color: #222299;
50
141
  }
51
142
  ~
143
+ }
52
144
  }
53
145
 
54
- CLASSES = {
55
- :one => [String, :EscapedLiteral, String, :Include, String ],
56
- # :two => [String, Chunk::Link, String, Chunk::Include, Chunk::Include, String, Chunk::Link, String, Chunk::Link, Chunk::Link, Chunk::Include ],
57
- :two => [String, :Link, String, :Include, :Include, String, :Link, :Include ],
58
- :three => [String, :URI, String, :HostURI, String, :URI, String, :Link, String, :URI, String, :URI, String ],
59
- :three_b => [String, :URI, String, :HostURI, String, :URI, String, :URI, String, :URI, String, :Link ],
60
- :five => [:Include]
61
- }
62
146
 
63
- CLASSES.each do |key, val|
64
- CLASSES[key] = val.map do |klass|
65
- Class === klass ? klass : Card::Chunk.const_get(klass)
147
+ EXAMPLES.each do |key, val|
148
+ if val[:classes]
149
+ val[:classes] = val[:classes].map do |klass|
150
+ Class === klass ? klass : Card::Chunk.const_get(klass)
151
+ end
66
152
  end
67
153
  end
68
154
 
69
- RENDERED = {
70
- :one => [
71
- "Some Literals: \\[{I'm not| a link]}, and ",
72
- "<span>{</span>{This Card|Is not Included}}",
73
- ", but ",
74
- {:options => {:inc_name=>"this is",:inc_syntax=>"this is"}},
75
- ", and some tail"
76
- ],
77
- :two => [
78
- "Some Links and includes: ",
79
- "<a class=\"wanted-card\" href=\"/the_card?card%5Bname%5D=the+card\">the text</a>",
80
- ", and ",
81
- { :options => { :view => "Is Included", :inc_name=>"This Card", :inc_syntax => "This Card|Is Included"}},
82
- { :options => { :inc_name=>"this too", :inc_syntax=>"this too"}},
83
- "\n and ",
84
- "<a class=\"external-link\" href=\"http://external.wagn.org/path\">link text</a>",
85
- { :options => { :view=>"open", :inc_name=>"Included", :inc_syntax=>"Included|open" }}
86
- ],
87
- :three => [
88
- "Some URIs and Links: ", '<a class="external-link" href="http://a.url.com/">http://a.url.com/</a>',
89
- "\n More urls: ",
90
- "<a class=\"external-link\" href=\"http://wagn.com/a/path/to.html\">wagn.com/a/path/to.html</a>",
91
- "\n ",
92
- "<a class=\"external-link\" href=\"http://localhost:2020/path?cgi=foo&amp;bar=baz\">http://localhost:2020/path?cgi=foo&bar=baz</a>",
93
- " ",
94
- "<a class=\"external-link\" href=\"http://brain.org/Home\">extra</a>",
95
- "\n [ ",
96
- "<a class=\"external-link\" href=\"http://gerry.wagn.com/a/path\">http://gerry.wagn.com/a/path</a>",
97
- " ]\n { ",
98
- "<a class=\"external-link\" href=\"https://brain.org/more?args\">https://brain.org/more?args</a>",
99
- " }"
100
- ],
101
- :three_b => [
102
- "Some URIs and Links: ","<a class=\"external-link\" href=\"http://a.url.com\">http://a.url.com</a>",
103
- "\n More urls: ",
104
- "<a class=\"external-link\" href=\"http://wagn.com/a/path/to.html\">wagn.com/a/path/to.html</a>",
105
- "\n [ ",
106
- "<a class=\"external-link\" href=\"http://gerry.wagn.com/a/path\">http://gerry.wagn.com/a/path</a>",
107
- " ]\n { ",
108
- "<a class=\"external-link\" href=\"https://brain.org/more?args\">https://brain.org/more?args</a>",
109
- " }\n ",
110
- "<a class=\"external-link\" href=\"http://localhost:2020/path?cgi=foo&amp;bar=baz\">http://localhost:2020/path?cgi=foo&bar=baz</a>",
111
- " ",
112
- "<a class=\"external-link\" href=\"http://brain.org/Home\">extra</a>"
113
- ],
114
- :four => "No chunks"
115
- }
116
- TEXT_RENDERED = {
117
- :three => [
118
- "Some URIs and Links: ", 'http://a.url.com/',
119
- "\n More urls: ",
120
- "wagn.com/a/path/to.html[http://wagn.com/a/path/to.html]",
121
- "\n ",
122
- "http://localhost:2020/path?cgi=foo&bar=baz",
123
- " ",
124
- "extra[http://brain.org/Home]",
125
- "\n [ ",
126
- "http://gerry.wagn.com/a/path",
127
- " ]\n { ",
128
- "https://brain.org/more?args",
129
- " }"
130
- ],
131
- }
132
155
 
133
156
  describe Card::Content do
134
157
  context "instance" do
@@ -151,116 +174,108 @@ describe Card::Content do
151
174
  @render_block = Proc.new do |opts| {:options => opts.inject({}) {|i,v| !v[1].nil? && i[v[0]]=v[1]; i } } end
152
175
  end
153
176
 
177
+ let(:example) { EXAMPLES[@example] }
178
+ let(:cobj) { Card::Content.new example[:content], @card }
179
+ let(:classes) { example[:classes] }
180
+ let(:rendered) { example[:rendered] }
181
+ let(:text_rendered) { example[:text_rendered] }
182
+ let(:content) { example[:content] }
154
183
 
155
184
  describe 'parse' do
156
- it "should find all the chunks and strings" do
157
- # note the mixed [} that are considered matching, needs some cleanup ...
158
- #warn "cont? #{CONTENT[:one].inspect}"
159
- cobj = Card::Content.new CONTENT[:one], @card
160
- expect(cobj.inject(CLASSES[:one], &@check_proc)).to eq(true)
161
- end
162
-
163
- it "should give just the chunks" do
164
- cobj = Card::Content.new CONTENT[:one], @card
165
- clist = CLASSES[:one].find_all {|c| String != c }
166
- #warn "clist #{clist.inspect}"
185
+ def check_chunk_classes
186
+ expect(cobj.inject(classes, &@check_proc)).to eq(true)
187
+ clist = classes.find_all {|c| String != c }
167
188
  cobj.each_chunk do |chk|
168
189
  expect(chk).to be_instance_of clist.shift
169
190
  end
170
191
  expect(clist).to be_empty
171
192
  end
172
193
 
173
- it "should find all the chunks links and trasclusions" do
174
- cobj = Card::Content.new CONTENT[:two], @card
175
- expect(cobj.inject(CLASSES[:two], &@check_proc)).to eq(true)
194
+ it "finds all the chunks and strings" do
195
+ # note the mixed [} that are considered matching, needs some cleanup ...
196
+ @example = :nests
197
+ expect(cobj.inject(classes, &@check_proc)).to eq(true)
176
198
  end
177
199
 
178
- it "should find uri chunks " do
200
+ it "gives just the chunks" do
201
+ @example = :nests
202
+ check_chunk_classes
203
+ end
204
+
205
+ it "finds all the chunks links and trasclusions" do
206
+ @example = :links_and_nests
207
+ expect(cobj.inject(classes, &@check_proc)).to eq(true)
208
+ end
209
+
210
+ it "finds uri chunks " do
179
211
  # tried some tougher cases that failed, don't know the spec, so hard to form better tests for URIs here
180
- cobj = Card::Content.new CONTENT[:three], @card
181
- expect(cobj.inject(CLASSES[:three], &@check_proc)).to eq(true)
182
- clist = CLASSES[:three].find_all {|c| String != c }
183
- #warn "clist #{clist.inspect}, #{cobj.inspect}"
184
- cobj.each_chunk do |chk|
185
- expect(chk).to be_instance_of clist.shift
186
- end
187
- expect(clist).to be_empty
212
+ @example = :uris_and_links
213
+ check_chunk_classes
188
214
  end
189
215
 
190
- it "should find uri chunks (b)" do
216
+ it "finds uri chunks (b)" do
191
217
  # tried some tougher cases that failed, don't know the spec, so hard to form better tests for URIs here
192
- cobj = Card::Content.new CONTENT[:three_b], @card
193
- #warn "cobj #{cobj.inspect} #{CLASSES[:three_b].inspect}"
194
- expect(cobj.inject(CLASSES[:three_b], &@check_proc)).to eq(true)
195
- clist = CLASSES[:three_b].find_all {|c| String != c }
196
- #warn "clist #{clist.inspect}, #{cobj.inspect}"
197
- cobj.each_chunk do |chk|
198
- expect(chk).to be_instance_of clist.shift
199
- end
200
- expect(clist).to be_empty
218
+ @example = :uris_and_links_2
219
+ check_chunk_classes
201
220
  end
202
221
 
203
- it "should parse just a string" do
204
- cobj = Card::Content.new CONTENT[:four], @card
205
- expect(cobj).to eq(RENDERED[:four])
222
+ it "parses just a string" do
223
+ @example = :no_chunks
224
+ expect(cobj).to eq(rendered)
206
225
  end
207
226
 
208
- it "should parse a single chunk" do
209
- cobj = Card::Content.new CONTENT[:five], @card
210
- expect(cobj.inject(CLASSES[:five], &@check_proc)).to eq(true)
211
- clist = CLASSES[:five].find_all {|c| String != c }
212
- cobj.each_chunk do |chk|
213
- expect(chk).to be_instance_of clist.shift
214
- end
215
- expect(clist).to be_empty
227
+ it "parses a single chunk" do
228
+ @example = :single_nest
229
+ check_chunk_classes
216
230
  end
217
-
218
- it "should leave css alone" do
219
- cobj = Card::Content.new CONTENT[:six], @card
220
- expect(cobj).to eq(CONTENT[:six])
231
+
232
+ it "leaves css alone" do
233
+ @example = :css
234
+ expect(cobj).to eq(content)
221
235
  end
222
236
  end
223
237
 
224
238
  describe "render" do
225
- it "should render all includes" do
226
- cobj = Card::Content.new CONTENT[:one], @card
239
+ it "renders all nests" do
240
+ @example = :nests
227
241
  expect(cobj.as_json.to_s).to match /not rendered/
228
242
  cobj.process_content_object &@render_block
229
243
  expect(rdr=cobj.as_json.to_json).not_to match /not rendered/
230
- expect(rdr).to eq(RENDERED[:one].to_json)
244
+ expect(rdr).to eq(rendered.to_json)
231
245
  end
232
246
 
233
- it "should render links and inclusions" do
234
- cobj = Card::Content.new CONTENT[:two], @card
247
+ it "renders links and nests" do
248
+ @example = :links_and_nests
235
249
  cobj.process_content_object &@render_block
236
250
  expect(rdr=cobj.as_json.to_json).not_to match /not rendered/
237
- expect(rdr).to eq(RENDERED[:two].to_json)
251
+ expect(rdr).to eq(rendered.to_json)
238
252
  end
239
253
 
240
254
  it "renders links correctly for text formatters" do
255
+ @example = :uris_and_links
241
256
  card2 = Card[@card.id]
242
257
  format = card2.format :format => :text
243
- cobj = Card::Content.new CONTENT[:three], format
258
+ cobj = Card::Content.new content, format
244
259
  cobj.process_content_object &@render_block
245
- expect(cobj.as_json.to_json).to eq(TEXT_RENDERED[:three].to_json)
260
+ expect(cobj.as_json.to_json).to eq(text_rendered.to_json)
246
261
  end
247
262
 
248
- it "should not need rendering if no inclusions" do
249
- cobj = Card::Content.new CONTENT[:three], @card
263
+ it "does not need rendering if no nests" do
264
+ @example = :uris_and_links
250
265
  cobj.process_content_object &@render_block
251
- expect(cobj.as_json.to_json).to eq(RENDERED[:three].to_json)
266
+ expect(cobj.as_json.to_json).to eq(rendered.to_json)
252
267
  end
253
268
 
254
- it "should not need rendering if no inclusions (b)" do
255
- cobj = Card::Content.new CONTENT[:three_b], @card
269
+ it "does not need rendering if no nests (b)" do
270
+ @example = :uris_and_links_2
256
271
  expect(rdr=cobj.as_json.to_json).to match /not rendered/ # links are rendered too, but not with a block
257
272
  cobj.process_content_object &@render_block
258
273
  expect(rdr=cobj.as_json.to_json).not_to match /not rendered/
259
- expect(rdr).to eq(RENDERED[:three_b].to_json)
274
+ expect(rdr).to eq(rendered.to_json)
260
275
  end
261
276
  end
262
277
  end
263
-
278
+
264
279
  UNTAGGED_CASES = [ ' [grrew][/wiki/grrew]ss ', ' {{this is a test}}, {{this|view|is:too}} and',
265
280
  ' so is http://foo.bar.come//', ' and foo="my attr, not int a tag" <not a=tag ', ' p class"foobar"> and more' ]
266
281
 
@@ -271,7 +286,7 @@ describe Card::Content do
271
286
  assert_equal test_case,Card::Content.clean!(test_case)
272
287
  end
273
288
  end
274
-
289
+
275
290
  it 'should strip disallowed html class attributes' do
276
291
  assert_equal '<p>html<div>with</div> funky tags</p>', Card::Content.clean!('<p>html<div class="boo">with</div><monkey>funky</butts>tags</p>')
277
292
  assert_equal '<span>foo</span>', Card::Content.clean!('<span class="banana">foo</span>')
@@ -320,7 +335,7 @@ describe Card::Content do
320
335
  end
321
336
  end
322
337
  end
323
-
324
-
338
+
339
+
325
340
  end
326
341