acts_as_markup 1.3.4 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,217 @@
1
+ module ActsAsMarkup
2
+ module ActiveRecordExtension
3
+ extend ActiveSupport::Concern
4
+
5
+ module ClassMethods
6
+
7
+ # This allows you to specify columns you want to define as containing
8
+ # Markdown, Textile, Wikitext or RDoc content.
9
+ # Then you can simply call <tt>.to_html</tt> method on the attribute.
10
+ #
11
+ # You can also specify the language as <tt>:variable</tt>. The language used
12
+ # to process the column will be based on another column. By default a column
13
+ # named "<tt>markup_language</tt>" is used, but this can be changed by providing
14
+ # a <tt>:language_column</tt> option. When a value is accessed it will create
15
+ # the correct object (Markdown, Textile, Wikitext or RDoc) based on the value
16
+ # of the language column. If any value besides markdown, textile, mediawiki, or
17
+ # RDoc is supplied for the markup language the text will pass through as a string.
18
+ #
19
+ # You can specify additional options to pass to the markup library by using
20
+ # <tt>:markdown_options</tt>, <tt>:textile_options</tt> or <tt>:mediawiki_options</tt>.
21
+ # RDoc does not support any useful options. The options should be given as an array
22
+ # of arguments. You can specify options for more than one language when using
23
+ # <tt>:variable</tt>. See each library's documentation for more details on what
24
+ # options are available.
25
+ #
26
+ #
27
+ # ==== Examples
28
+ #
29
+ # ===== Using Markdown language
30
+ #
31
+ # class Post < ActiveRecord
32
+ # acts_as_markup :language => :markdown, :columns => [:body]
33
+ # end
34
+ #
35
+ # @post = Post.find(:first)
36
+ # @post.body.to_s # => "## Markdown Headline"
37
+ # @post.body.to_html # => "<h2> Markdown Headline</h2>"
38
+ #
39
+ #
40
+ # ===== Using variable language
41
+ #
42
+ # class Post < ActiveRecord
43
+ # acts_as_markup :language => :variable, :columns => [:body], :language_column => 'language_name'
44
+ # end
45
+ #
46
+ # @post = Post.find(:first)
47
+ # @post.language_name # => "markdown"
48
+ # @post.body.to_s # => "## Markdown Headline"
49
+ # @post.body.to_html # => "<h2> Markdown Headline</h2>"
50
+ #
51
+ #
52
+ # ===== Using options
53
+ #
54
+ # class Post < ActiveRecord
55
+ # acts_as_markup :language => :markdown, :columns => [:body], :markdown_options => [ :filter_html ]
56
+ # end
57
+ #
58
+ # class Post < ActiveRecord
59
+ # acts_as_markup :language => :textile, :columns => [:body], :textile_options => [ [ :filter_html ] ]
60
+ # end
61
+ #
62
+ # class Post < ActiveRecord
63
+ # acts_as_markup :language => :mediawiki, :columns => [:body], :mediawiki_options => [ { :space_to_underscore => true } ]
64
+ # end
65
+ #
66
+ #
67
+ def acts_as_markup(options)
68
+ options.reverse_merge!(:language_column => :markup_language)
69
+ markup_class = load_markup_class(options)
70
+
71
+ unless options[:language].to_sym == :variable
72
+ define_markup_columns_reader_methods(markup_class, options)
73
+ else
74
+ define_variable_markup_columns_reader_methods(markup_class, options)
75
+ end
76
+ end
77
+
78
+ # This is a convenience method for
79
+ # `<tt>acts_as_markup :language => :markdown, :columns => [:body]</tt>`
80
+ # Additional options can be given at the end, if necessary.
81
+ #
82
+ def acts_as_markdown(*columns)
83
+ options = columns.extract_options!
84
+ acts_as_markup options.merge(:language => :markdown, :columns => columns)
85
+ end
86
+
87
+ # This is a convenience method for
88
+ # `<tt>acts_as_markup :language => :textile, :columns => [:body]</tt>`
89
+ # Additional options can be given at the end, if necessary.
90
+ #
91
+ def acts_as_textile(*columns)
92
+ options = columns.extract_options!
93
+ acts_as_markup options.merge(:language => :textile, :columns => columns)
94
+ end
95
+
96
+ # This is a convenience method for
97
+ # `<tt>acts_as_markup :language => :mediawiki, :columns => [:body]</tt>`
98
+ # Additional options can be given at the end, if necessary.
99
+ #
100
+ def acts_as_mediawiki(*columns)
101
+ options = columns.extract_options!
102
+ acts_as_markup options.merge(:language => :mediawiki, :columns => columns)
103
+ end
104
+
105
+ # This is a convenience method for
106
+ # `<tt>acts_as_markup :language => :rdoc, :columns => [:body]</tt>`
107
+ # Additional options can be given at the end, if necessary.
108
+ #
109
+ def acts_as_rdoc(*columns)
110
+ options = columns.extract_options!
111
+ acts_as_markup options.merge(:language => :rdoc, :columns => columns)
112
+ end
113
+
114
+
115
+ private
116
+ def get_markdown_class
117
+ if ActsAsMarkup::MARKDOWN_LIBS.keys.include? ActsAsMarkup.markdown_library
118
+ markdown_library_names = ActsAsMarkup::MARKDOWN_LIBS[ActsAsMarkup.markdown_library]
119
+ require markdown_library_names[:lib_name]
120
+ require_extensions(markdown_library_names[:lib_name])
121
+ return markdown_library_names[:class_name].constantize
122
+ else
123
+ raise ActsAsMarkup::UnsportedMarkdownLibrary, "#{ActsAsMarkup.markdown_library} is not currently supported."
124
+ end
125
+ end
126
+
127
+ def get_mediawiki_class
128
+ if ActsAsMarkup::MEDIAWIKI_LIBS.keys.include? ActsAsMarkup.mediawiki_library
129
+ mediawiki_library_names = ActsAsMarkup::MEDIAWIKI_LIBS[ActsAsMarkup.mediawiki_library]
130
+ require mediawiki_library_names[:lib_name]
131
+ require_extensions(mediawiki_library_names[:lib_name])
132
+ return mediawiki_library_names[:class_name].constantize
133
+ else
134
+ raise ActsAsMarkup::UnsportedMediawikiLibrary, "#{ActsAsMarkup.mediawiki_library} is not currently supported."
135
+ end
136
+ end
137
+
138
+ def require_extensions(library)# :nodoc:
139
+ if ActsAsMarkup::LIBRARY_EXTENSIONS.include? library.to_s
140
+ require "acts_as_markup/exts/#{library}"
141
+ end
142
+ end
143
+
144
+ def require_library_and_get_class(language)
145
+ case language
146
+ when :markdown
147
+ return get_markdown_class
148
+ when :textile
149
+ require 'redcloth'
150
+ return RedCloth
151
+ when :mediawiki
152
+ return get_mediawiki_class
153
+ when :rdoc
154
+ require 'rdoc'
155
+ require_extensions 'rdoc'
156
+ return RDocText
157
+ else
158
+ return String
159
+ end
160
+ end
161
+
162
+ def load_markup_class(options)
163
+ case options[:language].to_sym
164
+ when :markdown, :textile, :mediawiki, :rdoc
165
+ require_library_and_get_class(options[:language].to_sym)
166
+ when :variable
167
+ markup_classes = {}
168
+ [:textile, :mediawiki, :rdoc, :markdown].each do |language|
169
+ markup_classes[language] = require_library_and_get_class(language)
170
+ end
171
+ markup_classes
172
+ else
173
+ raise ActsAsMarkup::UnsupportedMarkupLanguage, "#{options[:langauge]} is not a currently supported markup language."
174
+ end
175
+ end
176
+
177
+ def define_markup_columns_reader_methods(markup_class, options)
178
+ markup_options = options["#{options[:language]}_options".to_sym] || []
179
+
180
+ options[:columns].each do |col|
181
+ define_method col do
182
+ if instance_variable_defined?("@#{col}") && !send("#{col}_changed?")
183
+ instance_variable_get("@#{col}")
184
+ else
185
+ instance_variable_set("@#{col}", markup_class.new(self[col].to_s, *markup_options))
186
+ end
187
+ end
188
+ end
189
+ end
190
+
191
+ def define_variable_markup_columns_reader_methods(markup_classes, options)
192
+ options[:columns].each do |col|
193
+ define_method col do
194
+ if instance_variable_defined?("@#{col}")
195
+ unless send("#{col}_changed?") || send("#{options[:language_column]}_changed?")
196
+ return instance_variable_get("@#{col}")
197
+ end
198
+ end
199
+ instance_variable_set("@#{col}", case send(options[:language_column])
200
+ when /markdown/i
201
+ markup_classes[:markdown].new self[col].to_s, *(options[:markdown_options] || [])
202
+ when /textile/i
203
+ markup_classes[:textile].new self[col].to_s, *(options[:textile_options] || [])
204
+ when /mediawiki/i
205
+ markup_classes[:mediawiki].new self[col].to_s, *(options[:mediawiki_options] || [])
206
+ when /rdoc/i
207
+ markup_classes[:rdoc].new self[col].to_s
208
+ else
209
+ self[col]
210
+ end)
211
+ end
212
+ end
213
+ end
214
+
215
+ end
216
+ end
217
+ end
@@ -0,0 +1,16 @@
1
+ class BlueClothText < BlueCloth
2
+ include Stringlike
3
+
4
+ def initialize(string, options = BlueCloth::DEFAULT_OPTIONS)
5
+ @string = string
6
+ super
7
+ end
8
+
9
+ def to_s
10
+ @string
11
+ end
12
+
13
+ def blank?
14
+ @string.blank?
15
+ end
16
+ end
@@ -1,7 +1,6 @@
1
- require 'rdoc/markup/simple_markup'
2
- require 'rdoc/markup/simple_markup/to_html'
1
+ require 'rdoc'
3
2
 
4
- class RDocWithHyperlinkToHtml < SM::ToHtml
3
+ class RDocWithHyperlinkToHtml < RDoc::Markup::ToHtml
5
4
 
6
5
  # Generate a hyperlink for url, labeled with text. Handle the
7
6
  # special cases for img: and link: described under handle_special_HYPEDLINK
@@ -72,7 +71,7 @@ class RDocText < String
72
71
  def initialize(str)
73
72
  super(str)
74
73
  @text = str.to_s
75
- @markup = SM::SimpleMarkup.new
74
+ @markup = RDoc::Markup.new
76
75
 
77
76
  # external hyperlinks
78
77
  @markup.add_special(/((link:|https?:|mailto:|ftp:|www\.)\S+\w)/, :HYPERLINK)
@@ -0,0 +1,9 @@
1
+ class Redcarpet
2
+ include Stringlike
3
+
4
+ alias_method :to_s, :text
5
+
6
+ def blank?
7
+ text.blank?
8
+ end
9
+ end
@@ -0,0 +1,18 @@
1
+ require 'wikicloth'
2
+
3
+ class WikiClothText < WikiCloth::Parser
4
+ include Stringlike
5
+
6
+ def initialize(string)
7
+ @text = string
8
+ super({:data => string.to_s})
9
+ end
10
+
11
+ def to_s
12
+ @text
13
+ end
14
+
15
+ def blank?
16
+ @text.blank?
17
+ end
18
+ end
@@ -0,0 +1,26 @@
1
+ module ActsAsMarkup
2
+ class Railtie < Rails::Railtie
3
+ config.acts_as_markup = ActiveSupport::OrderedOptions.new
4
+
5
+ initializer 'acts_as_markup.set_config', :after => 'active_record.initialize_database' do |app|
6
+ ActiveSupport.on_load(:acts_as_markup) do
7
+ self.markdown_library = app.config.acts_as_makrup.markdown_library
8
+ self.mediawiki_library = app.config.acts_as_makrup.mediawiki_library
9
+ end
10
+ end
11
+
12
+ initializer 'acts_as_markup.extend_active_record', :after => 'acts_as_markup.set_config' do |app|
13
+ ActiveSupport.on_load(:active_record) do
14
+ require 'acts_as_markup/exts/object'
15
+ require 'acts_as_markup/stringlike'
16
+ require 'acts_as_markup/active_record_extension'
17
+ self.send :include, ActsAsMakup::ActiveRecordExtension
18
+ end
19
+ end
20
+
21
+ config.before_configuration do
22
+ config.acts_as_makrup.markdown_library = :rdiscount
23
+ config.acts_as_makrup.mediawiki_library = :wikicloth
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ module ActsAsMarkup
2
+ VERSION = '1.4.0'
3
+ end
data/tasks/rdoc.rb CHANGED
@@ -1,13 +1,7 @@
1
- begin
2
- gem 'brianjlandau-sdoc-helpers'
3
- require 'sdoc_helpers'
4
- require 'rake/sdoctask'
5
-
6
- Rake::SDocTask.new do |rdoc|
7
- version = ActsAsMarkup::VERSION
8
- rdoc.title = "ActsAsMarkup #{version} Documentation"
9
- rdoc.rdoc_files.include('lib/**/*.rb')
10
- end
11
- rescue LoadError
12
- puts "sdoc RDoc tasks not loaded. Please intall sdoc."
13
- end
1
+ require 'rake/sdoctask'
2
+
3
+ Rake::SDocTask.new do |rdoc|
4
+ version = ActsAsMarkup::VERSION
5
+ rdoc.title = "ActsAsMarkup #{version} Documentation"
6
+ rdoc.rdoc_files.include('lib/**/*.rb')
7
+ end
@@ -223,12 +223,13 @@ class ActsAsMarkdownTest < ActsAsMarkupTestCase
223
223
  context 'using BlueCloth with options' do
224
224
  setup do
225
225
  class ::Post
226
- acts_as_markdown :body, :markdown_options => [ :filter_html ]
226
+ acts_as_markdown :body, :markdown_options => [{:escape_html => true}]
227
227
  end
228
228
  @post = Post.new(:title => 'Blah')
229
229
  end
230
230
 
231
- should "return escaped html because of :filter_html" do
231
+ # TODO: This test is broken because BleuCloth's behavior is broken.
232
+ should "return escaped html because of :escape_html" do
232
233
  @post.body = "## Markdown <i>Test</i> Text"
233
234
  assert_match(/&lt;i&gt;Test&lt;\/i&gt;/, @post.body.to_html)
234
235
  end
@@ -291,6 +292,68 @@ class ActsAsMarkdownTest < ActsAsMarkupTestCase
291
292
  end
292
293
  end
293
294
 
295
+ context 'using Redcarpet' do
296
+ setup do
297
+ ActsAsMarkup.markdown_library = :redcarpet
298
+ class ::Post < ActiveRecord::Base
299
+ acts_as_markdown :body
300
+ end
301
+ @post = Post.create!(:title => 'Blah', :body => @markdown_text)
302
+ end
303
+
304
+ should_act_like_a_string
305
+
306
+ should "have a Redcarpet object returned for the column value" do
307
+ assert_kind_of Redcarpet, @post.body
308
+ end
309
+
310
+ should "return original markdown text for a `to_s` method call on the column value" do
311
+ assert_equal @markdown_text, @post.body.to_s
312
+ end
313
+
314
+ should 'return false for .blank?' do
315
+ assert !@post.body.blank?
316
+ end
317
+
318
+ should "return formatted html for a `to_html` method call on the column value" do
319
+ assert_match(/<h2(\s\w+\=['"]\w*['"])*\s*>\s*Markdown Test Text\s*<\/h2>/, @post.body.to_html)
320
+ end
321
+
322
+ should "not return escaped html" do
323
+ @post.body = "## Markdown <i>Test</i> Text"
324
+ assert_match(/<i>Test<\/i>/, @post.body.to_html)
325
+ end
326
+
327
+ context "changing value of markdown field should return new markdown object" do
328
+ setup do
329
+ @old_body = @post.body
330
+ @post.body = "`@count = 20`"
331
+ end
332
+
333
+ should "still have an Redcarpet object but not the same object" do
334
+ assert_kind_of Redcarpet, @post.body
335
+ assert_not_same @post.body, @old_body
336
+ end
337
+
338
+ should "return correct text for `to_s`" do
339
+ assert_equal "`@count = 20`", @post.body.to_s
340
+ end
341
+
342
+ should "return correct HTML for the `to_html` method" do
343
+ assert_match(/<code>\s*\@count\s\=\s20\s*<\/code>/, @post.body.to_html)
344
+ end
345
+
346
+ teardown do
347
+ @old_body = nil
348
+ end
349
+ end
350
+
351
+ teardown do
352
+ @post = nil
353
+ Post.delete_all
354
+ end
355
+ end
356
+
294
357
  teardown do
295
358
  @markdown_text = nil
296
359
  end
@@ -7,7 +7,7 @@ class ActsAsMarkupTest < ActsAsMarkupTestCase
7
7
 
8
8
  context 'acts_as_markup' do
9
9
  setup do
10
- ActsAsMarkup.markdown_library = ActsAsMarkup::DEFAULT_MARKDOWN_LIB
10
+ ActsAsMarkup.markdown_library = :rdiscount
11
11
 
12
12
  @textile_text = "h2. Textile Test Text"
13
13
  class ::TextilePost < ActiveRecord::Base
@@ -76,7 +76,8 @@ class ActsAsMarkupTest < ActsAsMarkupTestCase
76
76
 
77
77
  context 'acts_as_markup with variable language' do
78
78
  setup do
79
- ActsAsMarkup.markdown_library = ActsAsMarkup::DEFAULT_MARKDOWN_LIB
79
+ ActsAsMarkup.markdown_library = :rdiscount
80
+ ActsAsMarkup.mediawiki_library = :wikicloth
80
81
  class ::VariablePost < ActiveRecord::Base
81
82
  acts_as_markup :language => :variable, :columns => [:body]
82
83
  end
@@ -176,14 +177,14 @@ class ActsAsMarkupTest < ActsAsMarkupTestCase
176
177
  end
177
178
  end
178
179
 
179
- context 'with a Wikitext post' do
180
+ context 'with a Mediawiki post' do
180
181
  setup do
181
182
  @wikitext = "== Wikitext Test Text =="
182
- @wikitext_post = VariablePost.create!(:title => 'Blah', :body => @wikitext, :markup_language => 'Wikitext')
183
+ @wikitext_post = VariablePost.create!(:title => 'Blah', :body => @wikitext, :markup_language => 'Mediawiki')
183
184
  end
184
185
 
185
186
  should "have a WikitextString object returned for the column value" do
186
- assert_kind_of WikitextString, @wikitext_post.body
187
+ assert_kind_of WikiClothText, @wikitext_post.body
187
188
  end
188
189
 
189
190
  should "return original wikitext text for a `to_s` method call on the column value" do
@@ -191,26 +192,26 @@ class ActsAsMarkupTest < ActsAsMarkupTestCase
191
192
  end
192
193
 
193
194
  should "return formated html for a `to_html` method call on the column value" do
194
- assert_match(/<h2>Wikitext Test Text<\/h2>/, @wikitext_post.body.to_html)
195
+ assert_match(/<h2>.*Wikitext Test Text.*<\/h2>/, @wikitext_post.body.to_html)
195
196
  end
196
197
 
197
198
  context "changing value of wikitext field should return new wikitext object" do
198
199
  setup do
199
200
  @old_body = @wikitext_post.body
200
- @wikitext_post.body = "`@count = 20`"
201
+ @wikitext_post.body = "'''This is very important'''"
201
202
  end
202
203
 
203
204
  should "still have an WikitextString object but not the same object" do
204
- assert_kind_of WikitextString, @wikitext_post.body
205
+ assert_kind_of WikiClothText, @wikitext_post.body
205
206
  assert_not_same @wikitext_post.body, @old_body
206
207
  end
207
208
 
208
209
  should "return correct text for `to_s`" do
209
- assert_equal "`@count = 20`", @wikitext_post.body.to_s
210
+ assert_equal "'''This is very important'''", @wikitext_post.body.to_s
210
211
  end
211
212
 
212
213
  should "return correct HTML for the `to_html` method" do
213
- assert_match(/<p><code>\@count\s\=\s20<\/code><\/p>/, @wikitext_post.body.to_html)
214
+ assert_match(/<p><b>This is very important<\/b><\/p>/, @wikitext_post.body.to_html)
214
215
  end
215
216
 
216
217
  teardown do
@@ -239,7 +240,7 @@ class ActsAsMarkupTest < ActsAsMarkupTestCase
239
240
  end
240
241
 
241
242
  should "return formated html for a `to_html` method call on the column value" do
242
- assert_match(/<h2>\s*RDoc Test Text\s*<\/h2>/, @rdoc_post.body.to_html)
243
+ assert_match(/<h2[^>]*>\s*RDoc Test Text\s*<\/h2>/, @rdoc_post.body.to_html)
243
244
  end
244
245
 
245
246
  context "changing value of RDoc field should return new RDoc object" do
@@ -325,7 +326,8 @@ class ActsAsMarkupTest < ActsAsMarkupTestCase
325
326
 
326
327
  context 'acts_as_markup with variable language setting the language column' do
327
328
  setup do
328
- ActsAsMarkup.markdown_library = ActsAsMarkup::DEFAULT_MARKDOWN_LIB
329
+ ActsAsMarkup.markdown_library = :rdiscount
330
+ ActsAsMarkup.mediawiki_library = :wikicloth
329
331
  class ::VariableLanguagePost < ActiveRecord::Base
330
332
  acts_as_markup :language => :variable, :columns => [:body], :language_column => :language_name
331
333
  end
@@ -380,10 +382,42 @@ class ActsAsMarkupTest < ActsAsMarkupTestCase
380
382
  end
381
383
  end
382
384
 
383
- context 'with wikitext' do
385
+ context 'with WikiCloth mediawiki' do
384
386
  setup do
387
+ ActsAsMarkup.mediawiki_library = :wikicloth
385
388
  class ::Post < ActiveRecord::Base
386
- acts_as_wikitext :body
389
+ acts_as_mediawiki :body
390
+ end
391
+ @post = Post.create!(:title => 'Blah', :body => @text)
392
+ end
393
+
394
+ should 'return a blank string for `to_s` method' do
395
+ assert_equal @post.body.to_s, ''
396
+ end
397
+
398
+ should 'return true for .blank?' do
399
+ assert @post.body.blank?
400
+ end
401
+
402
+ should 'return a blank string for `to_html` method' do
403
+ assert_match(/[\n\s]*/, @post.body.to_html)
404
+ end
405
+
406
+ should "have a WikitextString object returned for the column value" do
407
+ assert_kind_of WikiClothText, @post.body
408
+ end
409
+
410
+ teardown do
411
+ @post = nil
412
+ Post.delete_all
413
+ end
414
+ end
415
+
416
+ context 'with Wikitext mediawiki' do
417
+ setup do
418
+ ActsAsMarkup.mediawiki_library = :wikitext
419
+ class ::Post < ActiveRecord::Base
420
+ acts_as_mediawiki :body
387
421
  end
388
422
  @post = Post.create!(:title => 'Blah', :body => @text)
389
423
  end
@@ -481,7 +515,7 @@ class ActsAsMarkupTest < ActsAsMarkupTestCase
481
515
  end
482
516
 
483
517
  should 'return a blank string for `to_s` method' do
484
- assert_equal @post.body.to_s, ''
518
+ assert_equal '', @post.body.to_s
485
519
  end
486
520
 
487
521
  should 'return true for .blank?' do
@@ -563,6 +597,37 @@ class ActsAsMarkupTest < ActsAsMarkupTestCase
563
597
  Post.delete_all
564
598
  end
565
599
  end
600
+
601
+ context 'with Redcarpet Markdown' do
602
+ setup do
603
+ ActsAsMarkup.markdown_library = :redcarpet
604
+ class ::Post < ActiveRecord::Base
605
+ acts_as_markdown :body
606
+ end
607
+ @post = Post.create!(:title => 'Blah', :body => @text)
608
+ end
609
+
610
+ should 'return a blank string for `to_s` method' do
611
+ assert_equal @post.body.to_s, ''
612
+ end
613
+
614
+ should 'return true for .blank?' do
615
+ assert @post.body.blank?
616
+ end
617
+
618
+ should 'return a blank string for `to_html` method' do
619
+ assert_match(/[\n\s]*/, @post.body.to_html)
620
+ end
621
+
622
+ should "have a Maruku object returned for the column value" do
623
+ assert_kind_of Redcarpet, @post.body
624
+ end
625
+
626
+ teardown do
627
+ @post = nil
628
+ Post.delete_all
629
+ end
630
+ end
566
631
  end
567
632
 
568
633
  context 'acts_as_markup with bad language name' do
@@ -586,6 +651,17 @@ class ActsAsMarkupTest < ActsAsMarkupTestCase
586
651
  end
587
652
  end
588
653
 
654
+ context 'acts_as_markup with bad mediawiki library' do
655
+ should 'raise exception when a non-supported library is set as the mediawiki library attribute on ActsAsMarkup' do
656
+ assert_raise ActsAsMarkup::UnsportedMediawikiLibrary do
657
+ ActsAsMarkup.mediawiki_library = :fake
658
+ class ::Post < ActiveRecord::Base
659
+ acts_as_markup :language => :mediawiki, :columns => [:body]
660
+ end
661
+ end
662
+ end
663
+ end
664
+
589
665
  def teardown
590
666
  teardown_db
591
667
  end