postmarkdown 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/app/models/post.rb CHANGED
@@ -11,7 +11,7 @@ class Post
11
11
 
12
12
  TIME_FORMAT = /-\d{6}/
13
13
  DATE_FORMAT = /\d{4}-\d{2}-\d{2}(#{TIME_FORMAT})?/
14
- SLUG_FORMAT = /[A-Za-z0-9\-]+/
14
+ SLUG_FORMAT = /[A-Za-z0-9_\-]+/
15
15
  EXTENSION_FORMAT = /\.[^.]+/
16
16
 
17
17
  FILENAME_FORMAT = /^(#{DATE_FORMAT})-(#{SLUG_FORMAT})(#{EXTENSION_FORMAT})$/
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: <%= slug.underscore.humanize %>
2
+ title: <%= slug.gsub('-',' ').capitalize %>
3
3
  <%- if author = Postmarkdown::Util.git_config('user.name') -%>
4
4
  author: <%= author %>
5
5
  <%- end -%>
@@ -1,3 +1,3 @@
1
1
  module Postmarkdown
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
@@ -29,6 +29,23 @@ module Postmarkdown
29
29
  end
30
30
  end
31
31
 
32
+ context 'with the slug parameter including an underscore' do
33
+ it 'creates the correct file and sets the right values' do
34
+ Timecop.freeze(Time.utc(2012, 1, 1, 10, 20, 30)) do
35
+ run_generator %w(test-post_with_underscores)
36
+
37
+ Dir.glob('tmp/app/posts/*').should == ['tmp/app/posts/2012-01-01-102030-test-post_with_underscores.markdown']
38
+
39
+ Post.all.count.should == 1
40
+
41
+ post = Post.first
42
+ post.slug.should == 'test-post_with_underscores'
43
+ post.date.should == Date.parse('2012-01-01')
44
+ post.title.should == 'Test post_with_underscores'
45
+ end
46
+ end
47
+ end
48
+
32
49
  context 'with the slug and date parameters' do
33
50
  it 'creates a file for the slug and the given date' do
34
51
  run_generator %w(other-post --date=2012-01-02)
@@ -44,6 +44,11 @@ describe Post do
44
44
  its(:content) { should == "Content goes here.\n" }
45
45
  end
46
46
 
47
+ context 'with a slug containing underscores' do
48
+ subject { test_post '2012-02-12-102030-slug_containing_underscores.markdown' }
49
+ its(:slug) { should == 'slug_containing_underscores' }
50
+ end
51
+
47
52
  context 'with author' do
48
53
  subject { test_post '2011-05-01-full-metadata.markdown' }
49
54
  its(:author) { should == 'John Smith' }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postmarkdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-12-19 00:00:00.000000000 Z
15
+ date: 2012-12-27 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rails
@@ -311,7 +311,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
311
311
  version: '0'
312
312
  segments:
313
313
  - 0
314
- hash: -2900006150133001093
314
+ hash: 62361496562515143
315
315
  required_rubygems_version: !ruby/object:Gem::Requirement
316
316
  none: false
317
317
  requirements:
@@ -320,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
320
320
  version: '0'
321
321
  segments:
322
322
  - 0
323
- hash: -2900006150133001093
323
+ hash: 62361496562515143
324
324
  requirements: []
325
325
  rubyforge_project: postmarkdown
326
326
  rubygems_version: 1.8.24