vigetlabs-acts_as_markdown 0.1.0 → 0.1.1

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.
data/Rakefile CHANGED
@@ -15,9 +15,11 @@ PROJ.email = 'brian.landau@viget.com'
15
15
  PROJ.url = 'http://viget.rubyforge.com/acts_as_markdown'
16
16
  PROJ.description = "Represent ActiveRecord markdown text columns as Markdown objects using various external libraries to convert to HTML."
17
17
  PROJ.rubyforge.name = 'viget'
18
- PROJ.dependencies = ['active_support', 'active_record']
19
18
  PROJ.version = ActsAsMarkdown::VERSION
20
19
  PROJ.rdoc.include = %w(^lib/ LICENSE\.txt README\.rdoc)
21
20
  PROJ.rdoc.remote_dir = 'acts_as_markdown'
22
21
  PROJ.test.files = FileList['test/**/*_test.rb']
23
22
 
23
+ %W(activesupport activerecord rdiscount).each do |gem|
24
+ depend_on gem
25
+ end
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{acts_as_markdown}
3
- s.version = "0.1.0"
3
+ s.version = "0.1.1"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Brian Landau"]
7
- s.date = %q{2008-08-04}
7
+ s.date = %q{2008-08-05}
8
8
  s.description = %q{Represent ActiveRecord markdown text columns as Markdown objects using various external libraries to convert to HTML.}
9
9
  s.email = %q{brian.landau@viget.com}
10
10
  s.extra_rdoc_files = ["LICENSE.txt", "README.rdoc"]
@@ -23,8 +23,17 @@ Gem::Specification.new do |s|
23
23
  s.specification_version = 2
24
24
 
25
25
  if current_version >= 3 then
26
+ s.add_runtime_dependency(%q<activesupport>, [">= 2.1.0"])
27
+ s.add_runtime_dependency(%q<activerecord>, [">= 2.1.0"])
28
+ s.add_runtime_dependency(%q<rdiscount>, [">= 1.2.7"])
26
29
  else
30
+ s.add_dependency(%q<activesupport>, [">= 2.1.0"])
31
+ s.add_dependency(%q<activerecord>, [">= 2.1.0"])
32
+ s.add_dependency(%q<rdiscount>, [">= 1.2.7"])
27
33
  end
28
34
  else
35
+ s.add_dependency(%q<activesupport>, [">= 2.1.0"])
36
+ s.add_dependency(%q<activerecord>, [">= 2.1.0"])
37
+ s.add_dependency(%q<rdiscount>, [">= 1.2.7"])
29
38
  end
30
39
  end
@@ -2,7 +2,7 @@ require 'active_support'
2
2
 
3
3
  module ActsAsMarkdown
4
4
  # :stopdoc:
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
7
7
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
8
8
  # :startdoc:
@@ -27,6 +27,30 @@ class ActsAsMarkdownTest < Test::Unit::TestCase
27
27
  assert_match(/<h2>\s*Markdown Test Text\s*<\/h2>/, @post.body.to_html)
28
28
  end
29
29
 
30
+ context "changing value of markdown field should return new markdown object" do
31
+ setup do
32
+ @old_body = @post.body
33
+ @post.body = "`@count = 20`"
34
+ end
35
+
36
+ should "still have an RDiscount object but not the same object" do
37
+ assert_kind_of RDiscount, @post.body
38
+ assert_not_same @post.body, @old_body
39
+ end
40
+
41
+ should "return correct text for `to_s`" do
42
+ assert_equal "`@count = 20`", @post.body.to_s
43
+ end
44
+
45
+ should "return correct HTML for the `to_html` method" do
46
+ assert_match(/<code>\s*\@count\s\=\s20\s*<\/code>/, @post.body.to_html)
47
+ end
48
+
49
+ teardown do
50
+ @old_body = nil
51
+ end
52
+ end
53
+
30
54
  teardown do
31
55
  @post = nil
32
56
  Post.delete_all
@@ -54,6 +78,30 @@ class ActsAsMarkdownTest < Test::Unit::TestCase
54
78
  assert_match(/<h2>\s*Markdown Test Text\s*<\/h2>/, @post.body.to_html)
55
79
  end
56
80
 
81
+ context "changing value of markdown field should return new markdown object" do
82
+ setup do
83
+ @old_body = @post.body
84
+ @post.body = "`@count = 20`"
85
+ end
86
+
87
+ should "still have an PEGMarkdown object but not the same object" do
88
+ assert_kind_of PEGMarkdown, @post.body
89
+ assert_not_same @post.body, @old_body
90
+ end
91
+
92
+ should "return correct text for `to_s`" do
93
+ assert_equal "`@count = 20`", @post.body.to_s
94
+ end
95
+
96
+ should "return correct HTML for the `to_html` method" do
97
+ assert_match(/<code>\s*\@count\s\=\s20\s*<\/code>/, @post.body.to_html)
98
+ end
99
+
100
+ teardown do
101
+ @old_body = nil
102
+ end
103
+ end
104
+
57
105
  teardown do
58
106
  @post = nil
59
107
  Post.delete_all
@@ -81,6 +129,30 @@ class ActsAsMarkdownTest < Test::Unit::TestCase
81
129
  assert_match(/<h2>\s*Markdown Test Text\s*<\/h2>/, @post.body.to_html)
82
130
  end
83
131
 
132
+ context "changing value of markdown field should return new markdown object" do
133
+ setup do
134
+ @old_body = @post.body
135
+ @post.body = "`@count = 20`"
136
+ end
137
+
138
+ should "still have an BlueCloth object but not the same object" do
139
+ assert_kind_of BlueCloth, @post.body
140
+ assert_not_same @post.body, @old_body
141
+ end
142
+
143
+ should "return correct text for `to_s`" do
144
+ assert_equal "`@count = 20`", @post.body.to_s
145
+ end
146
+
147
+ should "return correct HTML for the `to_html` method" do
148
+ assert_match(/<code>\s*\@count\s\=\s20\s*<\/code>/, @post.body.to_html)
149
+ end
150
+
151
+ teardown do
152
+ @old_body = nil
153
+ end
154
+ end
155
+
84
156
  teardown do
85
157
  @post = nil
86
158
  Post.delete_all
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vigetlabs-acts_as_markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Landau
@@ -9,10 +9,36 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-04 00:00:00 -07:00
12
+ date: 2008-08-05 00:00:00 -07:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activesupport
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.1.0
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: activerecord
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: 2.1.0
32
+ version:
33
+ - !ruby/object:Gem::Dependency
34
+ name: rdiscount
35
+ version_requirement:
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.2.7
41
+ version:
16
42
  description: Represent ActiveRecord markdown text columns as Markdown objects using various external libraries to convert to HTML.
17
43
  email: brian.landau@viget.com
18
44
  executables: []