comfy_blog 1.12.2 → 1.12.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74cd97579b4570e8cac85c457007e8eb2db33031
4
- data.tar.gz: f5bcdabd960071e1be2a3191ef51033b460483d7
3
+ metadata.gz: 09145ea32c2a6b0cfd5b35c66dfa9d59af182c04
4
+ data.tar.gz: 0efe6fd8ebed393e88d9f255448e54d7ca8fc9d3
5
5
  SHA512:
6
- metadata.gz: 8b5db4dde5c35dc687d4e496ccf5febd576ffe14ea20aefd93ee51f0311f366db10b61c241e1deb858ac0cdabe23c0b66c79e0447dd941a4b2f600da10011a93
7
- data.tar.gz: 5669fe544894ed906cad147e0ca8b3e031c01718691656d959cf453f6bdab91909e566df951e18f30e83e308b766f758962dd0a2867f8bc857c4e03268e8205c
6
+ metadata.gz: 93531bcfed2ee3d3c2cffce8a90503e487ae7e49aa7f0c9269f0f02f6791ca913faef0ec93e628adf2a6b8fe4d4d125b2d561ebe60434473885e52114c0c55b3
7
+ data.tar.gz: 5f16da3322937f76771c5b2a94b21348db82bbf7470fe2955f6e03b52967dd965b6023a62350cac483789667190637e0c64986d3d8bc661a3df0a72286c92d9f
data/.travis.yml CHANGED
@@ -4,7 +4,7 @@ before_install:
4
4
  before_script:
5
5
  - rake db:migrate
6
6
  script:
7
- - rake test:all
7
+ - rake ci
8
8
  rvm:
9
9
  - 1.9.3
10
10
  - 2.0.0
data/Rakefile CHANGED
@@ -1,21 +1,31 @@
1
- require_relative 'config/application'
1
+ require 'bundler'
2
+ Bundler.setup
3
+
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new(:ci) do |t|
7
+ t.libs << 'test'
8
+ t.test_files = FileList['test/**/*_test.rb']
9
+ t.verbose = true
10
+ end
2
11
 
12
+ require_relative 'config/application'
3
13
  ComfyBlog::Application.load_tasks
4
14
 
5
15
  namespace :test do
6
-
16
+
7
17
  Rake::TestTask.new(:lib) do |t|
8
18
  t.libs << 'test'
9
19
  t.pattern = 'test/lib/**/*_test.rb'
10
20
  t.verbose = true
11
21
  end
12
-
22
+
13
23
  Rake::TestTask.new(:generators) do |t|
14
24
  t.libs << 'test'
15
25
  t.pattern = 'test/generators/**/*_test.rb'
16
26
  t.verbose = true
17
27
  end
18
-
28
+
19
29
  end
20
30
 
21
31
  Rake::Task[:test].enhance do
@@ -1,31 +1,33 @@
1
1
  class Comfy::Blog::BaseController < Comfy::Cms::BaseController
2
-
2
+
3
+ include Comfy::Paginate
4
+
3
5
  layout :set_blog_layout
4
6
 
5
7
  before_action :load_blog
6
8
 
7
9
  protected
8
-
10
+
9
11
  def load_cms_site
10
12
  super
11
13
  if @cms_site.path.blank? && params[:cms_path].present?
12
14
  raise ActionController::RoutingError.new('Site Not Found')
13
15
  end
14
16
  end
15
-
17
+
16
18
  def load_blog
17
19
  @blog = if @cms_site.blogs.count <= 1
18
20
  @cms_site.blogs.first!
19
21
  else
20
22
  @cms_site.blogs.where(:path => params[:blog_path]).first!
21
23
  end
22
-
24
+
23
25
  rescue ActiveRecord::RecordNotFound
24
26
  raise ActionController::RoutingError.new('Blog Not Found')
25
27
  end
26
-
28
+
27
29
  def set_blog_layout
28
30
  @blog.app_layout
29
31
  end
30
-
32
+
31
33
  end
@@ -1,17 +1,17 @@
1
1
  class Comfy::Blog::PostsController < Comfy::Blog::BaseController
2
-
2
+
3
3
  skip_before_action :load_blog, :only => [:serve]
4
-
4
+
5
5
  # due to fancy routing it's hard to say if we need show or index
6
6
  # action. let's figure it out here.
7
7
  def serve
8
8
  # if there are more than one blog, blog_path is expected
9
- if @cms_site.blogs.count >= 2
9
+ if @cms_site.blogs.count >= 2
10
10
  params[:blog_path] = params.delete(:slug) if params[:blog_path].blank?
11
11
  end
12
-
12
+
13
13
  load_blog
14
-
14
+
15
15
  if params[:slug].present?
16
16
  show && render(:show)
17
17
  else
@@ -30,14 +30,14 @@ class Comfy::Blog::PostsController < Comfy::Blog::BaseController
30
30
  limit = ComfyBlog.config.posts_per_page
31
31
  respond_to do |format|
32
32
  format.html do
33
- @posts = scope.page(params[:page]).per(limit)
33
+ @posts = comfy_paginate(scope, limit)
34
34
  end
35
35
  format.rss do
36
36
  @posts = scope.limit(limit)
37
37
  end
38
38
  end
39
39
  end
40
-
40
+
41
41
  def show
42
42
  @post = if params[:slug] && params[:year] && params[:month]
43
43
  @blog.posts.published.where(:year => params[:year], :month => params[:month], :slug => params[:slug]).first!
@@ -13,7 +13,7 @@ class Comfy::Blog::Post < ActiveRecord::Base
13
13
  :presence => true
14
14
  validates :slug,
15
15
  :uniqueness => { :scope => [:blog_id, :year, :month] },
16
- :format => { :with => /\A\w[a-z0-9_-]*\z/i }
16
+ :format => { :with => /\A%*\w[a-z0-9_\-\%]*\z/i }
17
17
 
18
18
  # -- Scopes ---------------------------------------------------------------
19
19
  default_scope -> {
data/comfy_blog.gemspec CHANGED
@@ -17,5 +17,5 @@ Gem::Specification.new do |s|
17
17
  s.platform = Gem::Platform::RUBY
18
18
  s.require_paths = ['lib']
19
19
 
20
- s.add_dependency 'comfortable_mexican_sofa', '~> 1.12.0'
20
+ s.add_dependency 'comfortable_mexican_sofa', '>= 1.12.7'
21
21
  end
@@ -33,4 +33,6 @@ defined?(ComfyBlog::Application) && ComfyBlog::Application.configure do
33
33
 
34
34
  # Print deprecation notices to the stderr.
35
35
  config.active_support.deprecation = :stderr
36
+
37
+ config.active_support.test_order = :random
36
38
  end
@@ -1,5 +1,5 @@
1
1
  class CreateBlog < ActiveRecord::Migration
2
-
2
+
3
3
  def self.up
4
4
  create_table :comfy_blogs do |t|
5
5
  t.integer :site_id, :null => false
@@ -11,7 +11,7 @@ class CreateBlog < ActiveRecord::Migration
11
11
  end
12
12
  add_index :comfy_blogs, [:site_id, :path]
13
13
  add_index :comfy_blogs, :identifier
14
-
14
+
15
15
  create_table :comfy_blog_posts do |t|
16
16
  t.integer :blog_id, :null => false
17
17
  t.string :title, :null => false
@@ -29,7 +29,7 @@ class CreateBlog < ActiveRecord::Migration
29
29
  :name => 'index_blog_posts_on_published_year_month_slug'
30
30
  add_index :comfy_blog_posts, [:is_published, :created_at]
31
31
  add_index :comfy_blog_posts, :created_at
32
-
32
+
33
33
  create_table :comfy_blog_comments do |t|
34
34
  t.integer :post_id, :null => false
35
35
  t.string :author, :null => false
@@ -42,11 +42,11 @@ class CreateBlog < ActiveRecord::Migration
42
42
  add_index :comfy_blog_comments, [:post_id, :is_published, :created_at],
43
43
  :name => 'index_blog_comments_on_post_published_created'
44
44
  end
45
-
45
+
46
46
  def self.down
47
47
  drop_table :comfy_blogs
48
- drop_table :comfy_posts
49
- drop_table :comfy_comments
48
+ drop_table :comfy_blog_posts
49
+ drop_table :comfy_blog_comments
50
50
  end
51
-
52
- end
51
+
52
+ end
@@ -1,3 +1,3 @@
1
1
  module ComfyBlog
2
- VERSION = "1.12.2"
2
+ VERSION = "1.12.3"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gem 'rails', '~> 4.0.0'
4
- gem 'comfortable_mexican_sofa', '~> 1.12.3'
4
+ gem 'comfortable_mexican_sofa'
5
5
  gem 'kaminari', '>= 0.16.1'
6
6
 
7
7
  group :test do
@@ -1,7 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gem 'rails', '~> 4.1.0'
4
- gem 'comfortable_mexican_sofa', '~> 1.12.3'
4
+ gem 'comfortable_mexican_sofa'
5
5
  gem 'kaminari', '>= 0.16.1'
6
6
 
7
7
  group :test do
@@ -1,7 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gem 'rails', '~> 4.2.0'
4
- gem 'comfortable_mexican_sofa', '~> 1.12.3'
4
+ gem 'comfortable_mexican_sofa'
5
5
  gem 'kaminari', '>= 0.16.1'
6
6
 
7
7
  group :test do
@@ -1,7 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gem 'rails', :github => 'rails/rails'
4
- gem 'comfortable_mexican_sofa', '~> 1.12.3'
4
+ gem 'comfortable_mexican_sofa'
5
5
  gem 'kaminari', '>= 0.16.1'
6
6
 
7
7
  group :test do
@@ -1,19 +1,19 @@
1
1
  require_relative '../test_helper'
2
2
 
3
3
  class BlogPostsTest < ActiveSupport::TestCase
4
-
4
+
5
5
  def test_fixtures_validity
6
6
  Comfy::Blog::Post.all.each do |post|
7
7
  assert post.valid?, post.errors.full_messages.to_s
8
8
  end
9
9
  end
10
-
10
+
11
11
  def test_validations
12
12
  post = Comfy::Blog::Post.new
13
13
  assert post.invalid?
14
14
  assert_errors_on post, :blog_id, :title, :slug, :content
15
15
  end
16
-
16
+
17
17
  def test_validation_of_slug_uniqueness
18
18
  old_post = comfy_blog_posts(:default)
19
19
  old_post.update_attributes!(:published_at => Time.now)
@@ -27,7 +27,16 @@ class BlogPostsTest < ActiveSupport::TestCase
27
27
  old_post.update_attributes!(:published_at => 1.year.ago)
28
28
  assert post.valid?
29
29
  end
30
-
30
+
31
+ def test_validation_of_slug_format
32
+ post = comfy_blog_blogs(:default).posts.new(
33
+ :title => 'Test Title',
34
+ :slug => 'test%slug',
35
+ :content => 'Test Content'
36
+ )
37
+ assert post.valid?
38
+ end
39
+
31
40
  def test_creation
32
41
  assert_difference 'Comfy::Blog::Post.count' do
33
42
  post = comfy_blog_blogs(:default).posts.create!(
@@ -39,13 +48,13 @@ class BlogPostsTest < ActiveSupport::TestCase
39
48
  assert_equal Time.now.month, post.month
40
49
  end
41
50
  end
42
-
51
+
43
52
  def test_set_slug
44
53
  post = Comfy::Blog::Post.new(:title => 'Test Title')
45
54
  post.send(:set_slug)
46
55
  assert_equal 'test-title', post.slug
47
56
  end
48
-
57
+
49
58
  def test_set_date
50
59
  post = Comfy::Blog::Post.new
51
60
  post.send(:set_published_at)
@@ -53,13 +62,13 @@ class BlogPostsTest < ActiveSupport::TestCase
53
62
  assert_equal post.published_at.year, post.year
54
63
  assert_equal post.published_at.month, post.month
55
64
  end
56
-
65
+
57
66
  def test_set_published_at
58
67
  post = Comfy::Blog::Post.new
59
68
  post.send(:set_published_at)
60
69
  assert post.published_at.present?
61
70
  end
62
-
71
+
63
72
  def test_destroy
64
73
  assert_difference ['Comfy::Blog::Post.count', 'Comfy::Blog::Comment.count'], -1 do
65
74
  comfy_blog_posts(:default).destroy
@@ -84,5 +93,5 @@ class BlogPostsTest < ActiveSupport::TestCase
84
93
  assert_equal 1, Comfy::Blog::Post.for_month(1).count
85
94
  assert_equal 0, Comfy::Blog::Post.for_month(2).count
86
95
  end
87
-
96
+
88
97
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comfy_blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.2
4
+ version: 1.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Khabarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-12 00:00:00.000000000 Z
11
+ date: 2015-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: comfortable_mexican_sofa
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.12.0
19
+ version: 1.12.7
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.12.0
26
+ version: 1.12.7
27
27
  description: Simple Blog Engine for ComfortableMexicanSofa
28
28
  email:
29
29
  - oleg@khabarov.ca