junebug 0.0.9 → 0.0.10

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/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ v0.0.10 2006-11-12
2
+
3
+ * Submit bugfix
4
+ * More unit tests
5
+
1
6
  v0.0.9 2006-11-10
2
7
 
3
8
  * Mosquito unit tests
@@ -5,7 +10,7 @@ v0.0.9 2006-11-10
5
10
  v0.0.8 2006-11-08
6
11
 
7
12
  * Style work
8
- * Addd rss link to head
13
+ * Add rss link to head
9
14
  * Stylesheet update rake task
10
15
 
11
16
  v0.0.7 2006-11-07
data/README CHANGED
@@ -5,8 +5,6 @@ Junebug is a minimalist wiki, running on Camping.
5
5
 
6
6
  == Status
7
7
 
8
- Junebug v0.0.9 release, 2006-11-10
9
-
10
8
  This is an alpha release. Use at your own risk. Please do not use this for anything important.
11
9
 
12
10
 
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ Gem.manage_gems
12
12
 
13
13
  gem_spec = Gem::Specification.new do |s|
14
14
  s.name = 'junebug'
15
- s.version = '0.0.9'
15
+ s.version = '0.0.10'
16
16
  s.summary = "Junebug is a minimalist ruby wiki."
17
17
  s.description = "Junebug is a minimalist ruby wiki running on Camping."
18
18
  s.author = "Tim Myrtle"
@@ -33,19 +33,19 @@ gem_spec = Gem::Specification.new do |s|
33
33
  s.add_dependency('activerecord', '>=1.14.4')
34
34
  end
35
35
 
36
+
36
37
  Rake::GemPackageTask.new(gem_spec) do |pkg|
37
38
  pkg.need_zip = false
38
39
  pkg.need_tar = false
39
40
  end
40
41
 
42
+
41
43
  desc "View tidy html from dev server in editor"
42
44
  task :tidy do
43
45
  system("curl http://localhost:3301/#{ENV['PAGE']} | tidy -i -wrap 1000 | #{ENV['VISUAL'] || ENV['EDITOR'] || 'vim' }")
44
46
  end
45
47
 
46
48
 
47
-
48
-
49
49
  desc "Clean up directory"
50
50
  task :clean => :clobber_package do
51
51
  rm 'deploy/junebug.db', :force => true
@@ -34,13 +34,15 @@ module Junebug::Controllers
34
34
  if input.submit == 'delete'
35
35
  Page.find_by_title(page_name).destroy() if @state.user_id == 1
36
36
  redirect Junebug.startpage
37
- else
37
+ elsif input.submit == 'save'
38
38
  attrs = { :body => input.post_body, :title => input.post_title }
39
39
  attrs[:readonly] = input.post_readonly if @state.user_id == 1
40
40
  if Page.find_or_create_by_title(page_name).update_attributes( attrs )
41
41
  # redirect Show, input.post_title
42
42
  redirect "#{Junebug.config['url']}/#{input.post_title}"
43
43
  end
44
+ else
45
+ redirect "#{Junebug.config['url']}/#{page_name}"
44
46
  end
45
47
  end
46
48
  end
@@ -48,7 +48,7 @@ module Junebug::Models
48
48
  t.column :title, :string, :limit => 255
49
49
  t.column :body, :text
50
50
  t.column :user_id, :integer, :null => false
51
- t.column :readonly, :boolean
51
+ t.column :readonly, :boolean, :default => false
52
52
  t.column :created_at, :datetime
53
53
  t.column :updated_at, :datetime
54
54
  end
data/lib/junebug/views.rb CHANGED
@@ -75,7 +75,7 @@ module Junebug::Views
75
75
  text " Readonly"
76
76
  br
77
77
  end
78
- _button 'cancel', :href => R(Show, @page.title, @page.version), :style=>'float: right;'
78
+ input :type => 'submit', :name=>'submit', :value=>'cancel', :class=>'button', :style=>'float: right;'
79
79
  input :type => 'submit', :name=>'submit', :value=>'save', :class=>'button', :style=>'float: right;'
80
80
  input :type => 'submit', :name=>'submit', :value=>'delete', :class=>'button', :onclick=>'return confirm("You sure?")'
81
81
  end
File without changes
@@ -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.
data/test/wiki_test.rb CHANGED
@@ -36,15 +36,15 @@ include Junebug::Models
36
36
  # end
37
37
  #
38
38
  # def test_login
39
- # post 'login', :username => 'quentin', :password => 'password'
39
+ # page 'login', :username => 'quentin', :password => 'password'
40
40
  # assert_match_body 'login success'
41
41
  # end
42
42
  #
43
43
  # def test_comment
44
44
  # assert_difference(Comment) {
45
- # post 'comment', :post_username => 'jim',
46
- # :post_body => 'Nice article.',
47
- # :post_id => 1
45
+ # page 'comment', :page_username => 'jim',
46
+ # :page_body => 'Nice article.',
47
+ # :page_id => 1
48
48
  # assert_response :redirect
49
49
  # assert_redirected_to '/view/1'
50
50
  # }
@@ -52,36 +52,61 @@ include Junebug::Models
52
52
  #
53
53
  # end
54
54
  #
55
- # class PostTest < Camping::UnitTest
56
- #
57
- # fixtures :junebug_users
58
- #
59
- # def test_create
60
- # post = create
61
- # assert post.valid?
62
- # end
63
- #
64
- # def test_assoc
65
- # post = Post.find :first
66
- # assert_kind_of User, post.user
67
- # assert_equal 1, post.user.id
68
- # end
69
- #
70
- # def test_destroy
71
- # original_count = Post.count
72
- # Post.destroy 1
73
- # assert_equal original_count - 1, Post.count
74
- # end
75
- #
76
- # private
77
- #
78
- # def create(options={})
79
- # Post.create({ :user_id => 1,
80
- # :title => "Title",
81
- # :body => "Body"}.merge(options))
82
- # end
83
- #
84
- # end
55
+ class PageTest < Camping::UnitTest
56
+
57
+ fixtures :junebug_users, :junebug_pages, :junebug_page_versions
58
+
59
+ def test_create
60
+ page = create
61
+ assert page.valid?
62
+ end
63
+
64
+ def test_user_assoc
65
+ page = Page.find :first
66
+ assert_kind_of User, page.user
67
+ assert_equal 1, page.user.id
68
+ end
69
+
70
+ def test_destroy
71
+ original_count = Page.count
72
+ Page.destroy 1
73
+ assert_equal original_count - 1, Page.count
74
+ end
75
+
76
+ def test_valid_title
77
+ page = create(:title => nil)
78
+ deny page.valid?
79
+ assert_not_nil page.errors.on(:title)
80
+
81
+ page = create(:title => '')
82
+ deny page.valid?
83
+ assert_not_nil page.errors.on(:title)
84
+
85
+ page = create(:title => 'Test')
86
+ deny page.valid?
87
+ assert_not_nil page.errors.on(:title)
88
+ end
89
+
90
+ def test_unique_title
91
+ page1 = create
92
+ assert page1.valid?
93
+
94
+ page2 = create
95
+ deny page2.valid?
96
+ assert_not_nil page2.errors.on(:title)
97
+ end
98
+
99
+ private
100
+
101
+ def create(options={})
102
+ Page.create({ :title => "TestTitle",
103
+ :body => "Body",
104
+ :user_id => 1,
105
+ }.merge(options))
106
+ end
107
+
108
+ end
109
+
85
110
 
86
111
  class UserTest < Camping::UnitTest
87
112
 
@@ -138,6 +163,12 @@ class UserTest < Camping::UnitTest
138
163
  assert user.username == 'aaaaaa'
139
164
  assert user.password == 'aaaaaa'
140
165
  end
166
+
167
+ def test_lowercase
168
+ user = create(:username => 'AAaaaa')
169
+ assert user.valid?
170
+ assert user.username == 'aaaaaa'
171
+ end
141
172
 
142
173
 
143
174
  private
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.9
7
- date: 2006-11-10 00:00:00 -08:00
6
+ version: 0.0.10
7
+ date: 2006-11-12 00:00:00 -08:00
8
8
  summary: Junebug is a minimalist ruby wiki.
9
9
  require_paths:
10
10
  - lib
@@ -61,6 +61,8 @@ files:
61
61
  test_files:
62
62
  - test/fixtures
63
63
  - test/wiki_test.rb
64
+ - test/fixtures/junebug_page_versions.yml
65
+ - test/fixtures/junebug_pages.yml
64
66
  - test/fixtures/junebug_users.yml
65
67
  rdoc_options: []
66
68