junebug 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -65,7 +65,7 @@ module Junebug::Views
65
65
  br
66
66
  input :value => @page.title, :name => 'post_title', :size => 30,
67
67
  :type => 'text'
68
- small " [ CamelCase only ]"
68
+ small " word characters [0-9A-Za-z_] and spaces only"
69
69
  }
70
70
  p {
71
71
  label 'Page Content'
@@ -208,8 +208,8 @@ module Junebug::Views
208
208
  return '' if txt.blank?
209
209
  txt.gsub!(Junebug::Models::Page::PAGE_LINK) do
210
210
  page = title = $1
211
- # title = $2 unless $2.empty?
212
- # page = page.gsub /\W/, '_'
211
+ title = $2 unless $2.empty?
212
+ #page = page.gsub /\W/, '_'
213
213
  if Junebug::Models::Page.find(:all, :select => 'title').collect { |p| p.title }.include?(page)
214
214
  %Q{<a href="#{self/R(Show, page)}">#{title}</a>}
215
215
  else
@@ -4,41 +4,59 @@ require File.dirname(__FILE__) + "/../lib/junebug"
4
4
  Junebug.create
5
5
  include Junebug::Models
6
6
 
7
- # class JunebugTest < Camping::FunctionalTest
8
- #
9
- # fixtures :junebug_users
10
- #
11
- # def setup
12
- # super
13
- # end
14
- #
15
- # def test_index
16
- # get
17
- # assert_response :success
18
- # assert_match_body %r!>blog<!
19
- # end
20
- #
21
- # def test_view
22
- # get '/view/1'
23
- # assert_response :success
24
- # assert_match_body %r!The quick fox jumped over the lazy dog!
25
- # end
26
- #
27
- # def test_styles
28
- # get 'styles.css'
29
- # assert_match_body %r!Utopia!
30
- # end
31
- #
32
- # def test_edit_should_require_login
33
- # get '/edit/1'
34
- # assert_response :success
35
- # assert_match_body 'login'
36
- # end
37
- #
38
- # def test_login
39
- # page 'login', :username => 'quentin', :password => 'password'
40
- # assert_match_body 'login success'
41
- # end
7
+ class JunebugTest < Camping::FunctionalTest
8
+
9
+ fixtures :junebug_users
10
+
11
+ def setup
12
+ super
13
+ end
14
+
15
+ def test_index
16
+ get
17
+ assert_response :redirect
18
+ assert_redirected_to '/JunebugWiki'
19
+ end
20
+
21
+ def test_start_page
22
+ get '/JunebugWiki'
23
+ assert_response :success
24
+ assert_match_body %r!title>JunebugWiki</title!
25
+ end
26
+
27
+ def test_login
28
+ post '/login', :username => 'admin', :password => 'password'
29
+ assert_response :redirect
30
+ assert_redirected_to '/JunebugWiki'
31
+
32
+ get '/logout'
33
+ assert_response :redirect
34
+ assert_redirected_to '/JunebugWiki'
35
+ end
36
+
37
+ def test_required_login
38
+ get '/JunebugWiki/edit'
39
+ assert_response :redirect
40
+ assert_redirected_to '/login'
41
+
42
+ get '/JunebugWiki/1/edit'
43
+ assert_response :redirect
44
+ assert_redirected_to '/login'
45
+
46
+ post '/JunebugWiki/edit'
47
+ assert_response :redirect
48
+ assert_redirected_to '/login'
49
+
50
+ get '/JunebugWiki/delete'
51
+ assert_response :redirect
52
+ assert_redirected_to '/login'
53
+
54
+ get '/JunebugWiki/1/revert'
55
+ assert_response :redirect
56
+ assert_redirected_to '/login'
57
+ end
58
+
59
+
42
60
  #
43
61
  # def test_comment
44
62
  # assert_difference(Comment) {
@@ -50,8 +68,8 @@ include Junebug::Models
50
68
  # }
51
69
  # end
52
70
  #
53
- # end
54
- #
71
+ end
72
+
55
73
  class PageTest < Camping::UnitTest
56
74
 
57
75
  fixtures :junebug_users, :junebug_pages, :junebug_page_versions
@@ -74,6 +92,30 @@ class PageTest < Camping::UnitTest
74
92
  end
75
93
 
76
94
  def test_valid_title
95
+ page = create(:title => 'TestPage')
96
+ assert page.valid?
97
+
98
+ page = create(:title => 'Test Page')
99
+ assert page.valid?
100
+
101
+ page = create(:title => 'test page')
102
+ assert page.valid?
103
+
104
+ page = create(:title => 'test_page')
105
+ assert page.valid?
106
+
107
+ page = create(:title => 'test')
108
+ assert page.valid?
109
+
110
+ page = create(:title => 't')
111
+ assert page.valid?
112
+
113
+ page = create(:title => '1')
114
+ assert page.valid?
115
+
116
+ end
117
+
118
+ def test_invalid_title
77
119
  page = create(:title => nil)
78
120
  deny page.valid?
79
121
  assert_not_nil page.errors.on(:title)
@@ -82,20 +124,66 @@ class PageTest < Camping::UnitTest
82
124
  deny page.valid?
83
125
  assert_not_nil page.errors.on(:title)
84
126
 
85
- page = create(:title => 'Test')
127
+ page = create(:title => ' ')
128
+ deny page.valid?
129
+ assert_not_nil page.errors.on(:title)
130
+
131
+ page = create(:title => '*')
132
+ deny page.valid?
133
+ assert_not_nil page.errors.on(:title)
134
+
135
+ page = create(:title => 'page-1')
136
+ deny page.valid?
137
+ assert_not_nil page.errors.on(:title)
138
+
139
+ page = create(:title => 'page\'s')
86
140
  deny page.valid?
87
141
  assert_not_nil page.errors.on(:title)
88
142
  end
89
143
 
90
144
  def test_unique_title
91
- page1 = create
145
+ page1 = create(:title => 'TestTitle')
92
146
  assert page1.valid?
93
-
147
+
148
+ # identical
94
149
  page2 = create
95
150
  deny page2.valid?
96
151
  assert_not_nil page2.errors.on(:title)
152
+
153
+ # lowercase
154
+ page2 = create(:title => 'testtitle')
155
+ assert page2.valid?
156
+
157
+ # create page with underscores
158
+ page1 = create(:title => 'test_title')
159
+ assert page1.valid?
160
+
161
+ # different from page with spaces
162
+ page1 = create(:title => 'test title')
163
+ assert page1.valid?
164
+ end
165
+
166
+ def test_spaces
167
+ page1 = create(:title => 'TestTitle5')
168
+ assert page1.valid?
169
+ assert_equal 'TestTitle5', page1.title
170
+
171
+ # test strip
172
+ page1 = create(:title => ' TestTitle6 ')
173
+ assert page1.valid?
174
+ assert_equal 'TestTitle6', page1.title
175
+
176
+ page1 = create(:title => ' Test Title 7 ')
177
+ assert page1.valid?
178
+ assert_equal 'Test Title 7', page1.title
179
+
180
+ # test squeeze
181
+ page1 = create(:title => ' Test Title 8 ')
182
+ assert page1.valid?
183
+ assert_equal 'Test Title 8', page1.title
97
184
  end
98
185
 
186
+
99
187
  private
100
188
 
101
189
  def create(options={})
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: junebug
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.14
7
- date: 2006-11-14 00:00:00 -08:00
6
+ version: 0.0.15
7
+ date: 2006-11-17 00:00:00 -08:00
8
8
  summary: Junebug is a minimalist ruby wiki.
9
9
  require_paths:
10
10
  - lib
@@ -32,6 +32,7 @@ files:
32
32
  - README
33
33
  - LICENSE
34
34
  - CHANGELOG
35
+ - RELEASE_NOTES
35
36
  - Rakefile
36
37
  - lib/junebug
37
38
  - lib/junebug.rb
@@ -43,9 +44,16 @@ files:
43
44
  - lib/junebug/helpers.rb
44
45
  - lib/junebug/models.rb
45
46
  - lib/junebug/mosquito.rb
47
+ - lib/junebug/redcloth
48
+ - lib/junebug/redcloth.rb
46
49
  - lib/junebug/tasks
47
50
  - lib/junebug/tasks.rb
48
51
  - lib/junebug/views.rb
52
+ - lib/junebug/redcloth/all_formats.rb
53
+ - lib/junebug/redcloth/base.rb
54
+ - lib/junebug/redcloth/docbook.rb
55
+ - lib/junebug/redcloth/markdown.rb
56
+ - lib/junebug/redcloth/textile.rb
49
57
  - lib/junebug/tasks/dump.rake
50
58
  - lib/junebug/tasks/update.rake
51
59
  - deploy/config.yml
@@ -87,7 +95,7 @@ dependencies:
87
95
  requirements:
88
96
  - - ">="
89
97
  - !ruby/object:Gem::Version
90
- version: 0.3.13.4
98
+ version: 0.3.13.3
91
99
  version:
92
100
  - !ruby/object:Gem::Dependency
93
101
  name: camping