junebug-wiki 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ page_1:
2
+ id: 1
3
+ user_id: 1
4
+ title: TestTitle1
5
+ body: The quick fox jumped over the lazy dog.
@@ -0,0 +1,5 @@
1
+ id_1:
2
+ id: 1
3
+ username: admin
4
+ password: password
5
+ role: 10
@@ -0,0 +1,2 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../lib/junebug'
@@ -0,0 +1,270 @@
1
+ require File.dirname(__FILE__) + "/../lib/junebug/ext/mosquito"
2
+ require File.dirname(__FILE__) + "/../lib/junebug"
3
+
4
+ Junebug.create
5
+ include Junebug::Models
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 :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
+
60
+ #
61
+ # def test_comment
62
+ # assert_difference(Comment) {
63
+ # page 'comment', :page_username => 'jim',
64
+ # :page_body => 'Nice article.',
65
+ # :page_id => 1
66
+ # assert_response :redirect
67
+ # assert_redirected_to '/view/1'
68
+ # }
69
+ # end
70
+ #
71
+ end
72
+
73
+ class PageTest < Camping::UnitTest
74
+
75
+ fixtures :junebug_users, :junebug_pages, :junebug_page_versions
76
+
77
+ def test_create
78
+ page = create
79
+ assert page.valid?
80
+ end
81
+
82
+ def test_user_assoc
83
+ page = Page.find :first
84
+ assert_kind_of User, page.user
85
+ assert_equal 1, page.user.id
86
+ end
87
+
88
+ def test_destroy
89
+ original_count = Page.count
90
+ Page.destroy 1
91
+ assert_equal original_count - 1, Page.count
92
+ end
93
+
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
119
+ page = create(:title => nil)
120
+ deny page.valid?
121
+ assert_not_nil page.errors.on(:title)
122
+
123
+ page = create(:title => '')
124
+ deny page.valid?
125
+ assert_not_nil page.errors.on(:title)
126
+
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')
140
+ deny page.valid?
141
+ assert_not_nil page.errors.on(:title)
142
+ end
143
+
144
+ def test_unique_title
145
+ page1 = create(:title => 'TestTitle')
146
+ assert page1.valid?
147
+
148
+ # identical
149
+ page2 = create
150
+ deny page2.valid?
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
184
+ end
185
+
186
+
187
+ private
188
+
189
+ def create(options={})
190
+ Page.create({ :title => "TestTitle",
191
+ :body => "Body",
192
+ :user_id => 1,
193
+ }.merge(options))
194
+ end
195
+
196
+ end
197
+
198
+
199
+ class UserTest < Camping::UnitTest
200
+
201
+ fixtures :junebug_users
202
+
203
+ def test_create
204
+ user = create
205
+ assert user.valid?
206
+ end
207
+
208
+ def test_required
209
+ user = create(:username => nil)
210
+ deny user.valid?
211
+ assert_not_nil user.errors.on(:username)
212
+
213
+ user = create(:password => nil)
214
+ deny user.valid?
215
+ assert_not_nil user.errors.on(:password)
216
+ end
217
+
218
+ def test_valid_username
219
+ user = create(:username => 'aa')
220
+ deny user.valid?
221
+ assert_not_nil user.errors.on(:username)
222
+
223
+ user = create(:username => 'aaa aaa')
224
+ deny user.valid?
225
+ assert_not_nil user.errors.on(:username)
226
+ end
227
+
228
+ def test_valid_password
229
+ user = create(:password => 'aa')
230
+ deny user.valid?
231
+ assert_not_nil user.errors.on(:password)
232
+
233
+ user = create(:password => 'aaa aaa')
234
+ deny user.valid?
235
+ assert_not_nil user.errors.on(:password)
236
+ end
237
+
238
+ def test_unique
239
+ user = create(:username => 'admin')
240
+ deny user.valid?
241
+ assert_not_nil user.errors.on(:username)
242
+
243
+ user = create(:username => 'Admin')
244
+ deny user.valid?
245
+ assert_not_nil user.errors.on(:username)
246
+ end
247
+
248
+ def test_spaces
249
+ user = create(:username => 'aaaaaa ', :password =>'aaaaaa ')
250
+ assert user.valid?
251
+ assert user.username == 'aaaaaa'
252
+ assert user.password == 'aaaaaa'
253
+ end
254
+
255
+ def test_lowercase
256
+ user = create(:username => 'AAaaaa')
257
+ assert user.valid?
258
+ assert user.username == 'aaaaaa'
259
+ end
260
+
261
+
262
+ private
263
+
264
+ def create(options={})
265
+ User.create({ :username => 'godfrey',
266
+ :password => 'password' }.merge(options))
267
+ end
268
+
269
+ end
270
+
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.0
3
+ specification_version: 1
4
+ name: junebug-wiki
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.0.19
7
+ date: 2006-11-22 00:00:00 -08:00
8
+ summary: Junebug is a minimalist ruby wiki running on Camping.
9
+ require_paths:
10
+ - lib
11
+ email: tim.myrtle@gmail.com
12
+ homepage: http://www.junebugwiki.com
13
+ rubyforge_project: junebug
14
+ description: Junebug is a minimalist ruby wiki running on Camping.
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Tim Myrtle
31
+ files:
32
+ - History.txt
33
+ - Manifest.txt
34
+ - README.txt
35
+ - RELEASE_NOTES.txt
36
+ - Rakefile
37
+ - bin/junebug
38
+ - deploy/Rakefile
39
+ - deploy/config.yml
40
+ - deploy/console
41
+ - deploy/public/images/feed-icon-14x14.png
42
+ - deploy/public/style/base.css
43
+ - deploy/public/style/yui/fonts.css
44
+ - deploy/public/style/yui/grids.css
45
+ - deploy/public/style/yui/reset.css
46
+ - deploy/wiki
47
+ - dump/junebug_pages.yml
48
+ - lib/junebug.rb
49
+ - lib/junebug/config.rb
50
+ - lib/junebug/controllers.rb
51
+ - lib/junebug/ext/acts_as_versioned.rb
52
+ - lib/junebug/ext/diff.rb
53
+ - lib/junebug/ext/mosquito.rb
54
+ - lib/junebug/generator.rb
55
+ - lib/junebug/helpers.rb
56
+ - lib/junebug/models.rb
57
+ - lib/junebug/tasks.rb
58
+ - lib/junebug/tasks/dump.rake
59
+ - lib/junebug/tasks/update.rake
60
+ - lib/junebug/version.rb
61
+ - lib/junebug/views.rb
62
+ - setup.rb
63
+ - test/fixtures/junebug_page_versions.yml
64
+ - test/fixtures/junebug_pages.yml
65
+ - test/fixtures/junebug_users.yml
66
+ - test/test_helper.rb
67
+ - test/wiki_test.rb
68
+ test_files:
69
+ - test/wiki_test.rb
70
+ rdoc_options: []
71
+
72
+ extra_rdoc_files: []
73
+
74
+ executables:
75
+ - junebug
76
+ extensions: []
77
+
78
+ requirements: []
79
+
80
+ dependencies:
81
+ - !ruby/object:Gem::Dependency
82
+ name: mongrel
83
+ version_requirement:
84
+ version_requirements: !ruby/object:Gem::Version::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 0.3.13.3
89
+ version:
90
+ - !ruby/object:Gem::Dependency
91
+ name: camping
92
+ version_requirement:
93
+ version_requirements: !ruby/object:Gem::Version::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: "1.5"
98
+ version:
99
+ - !ruby/object:Gem::Dependency
100
+ name: RedCloth
101
+ version_requirement:
102
+ version_requirements: !ruby/object:Gem::Version::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: 3.0.4
107
+ version:
108
+ - !ruby/object:Gem::Dependency
109
+ name: daemons
110
+ version_requirement:
111
+ version_requirements: !ruby/object:Gem::Version::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: 1.0.3
116
+ version:
117
+ - !ruby/object:Gem::Dependency
118
+ name: sqlite3-ruby
119
+ version_requirement:
120
+ version_requirements: !ruby/object:Gem::Version::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: 1.1.0.1
125
+ version:
126
+ - !ruby/object:Gem::Dependency
127
+ name: activerecord
128
+ version_requirement:
129
+ version_requirements: !ruby/object:Gem::Version::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: 1.14.4
134
+ version: