tb_blog 1.3.0.beta1 → 1.3.0

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: 5ff051c880e167863c62338d656dc998b1c646fd
4
- data.tar.gz: 7e92aee8c71a94de5703385f013d6f3157dd690f
3
+ metadata.gz: 2f325ca99ab25f5cc0a57406fb9bbf500cce4239
4
+ data.tar.gz: 3c3fd4d5d46142937d20e6744199434688c9df08
5
5
  SHA512:
6
- metadata.gz: e6b5299d1d8cbddadbd517e73f3bd1b78d2dc3a4fcc8d4f018f6829a3cde16b37288ad0beb30f4c11e35515a6e890908e6c40dce82b8ca4bd2b6ee286a37ee64
7
- data.tar.gz: a4074b7a6e3d868e23618767782531e226b7f561af8a2dff76b48a433e03179cadc3ead416e60127501d09adadb8a67cf0e826e16f73139cee802ce6c2efc5c8
6
+ metadata.gz: f57c1d89d0c55595738aba1c43a9ff748b37a810c8a97b17f266c7a0c65c54df5b9b9acfcbb62c8454f931f50e3574e57231868e086b3dde34443e3ebc448995
7
+ data.tar.gz: 6877f6e20b3e7a5ed815fc412c16838e108d1a97db23207914fffbc3e5abf59843b6cb4aa533877168466eb7236decfc61a5b6b8e6cbc60650d9fc698823ba29
@@ -4,8 +4,6 @@ class Admin::PostCommentsController < Admin::ApplicationController
4
4
  respond_to :html, :xml, :json
5
5
  before_action :load_blog, :only => :index
6
6
  before_action :find_comment, :only => [:show, :edit, :update, :destroy, :approve, :spam]
7
- # add_breadcrumb 'Blog Posts', :admin_posts_path
8
- # add_breadcrumb 'Comments', :admin_post_comments_path
9
7
 
10
8
  def index
11
9
  @page_name = "Comments"
@@ -18,7 +18,6 @@ class Admin::PostsController < Admin::ApplicationController
18
18
  end
19
19
 
20
20
  def update
21
- params[:spud_post][:updated_at] = Time.now()
22
21
  if @post.update_attributes(post_params)
23
22
  flash[:notice] = 'Post was successfully updated.'
24
23
  end
@@ -63,7 +62,9 @@ private
63
62
  if Spud::Blog.permitted_attributes.present?
64
63
  permitted = permitted + Spud::Blog.permitted_attributes
65
64
  end
66
- params.require(:spud_post).permit(permitted)
65
+ p = params.require(:spud_post).permit(permitted)
66
+ p[:updated_at] = DateTime.now
67
+ return p
67
68
  end
68
69
 
69
70
  def load_blog
@@ -11,12 +11,4 @@ module Admin::PostsHelper
11
11
  end
12
12
  end
13
13
 
14
- def spud_post_site_check_box_tag(site, post)
15
- return check_box_tag 'spud_post[spud_site_ids][]', site[:site_id], post.spud_site_ids.include?(site[:site_id]), :id => "spud_post_site_id_#{site[:site_id]}"
16
- end
17
-
18
- def spud_post_site_label_tag(site)
19
- return label_tag "spud_post_site_id_#{site[:site_id]}", site[:site_name], :class => 'checkbox inline'
20
- end
21
-
22
14
  end
@@ -15,7 +15,6 @@ class Spud::SpudPostModel < ActiveRecord::Base
15
15
  has_many :visible_comments, ->{ where(:spam => [nil,false], :approved => true) }, :class_name => 'SpudPostComment', :foreign_key => 'spud_post_id'
16
16
  has_many :spam_comments, ->{ where(:spam => true) }, :class_name => "SpudPostComment", :foreign_key => 'spud_post_id'
17
17
  has_many :spud_permalinks, :as => :attachment
18
- has_many :spud_post_sites, :dependent => :destroy, :foreign_key => 'spud_post_id'
19
18
 
20
19
  scope :blog_posts, ->{ for_blog('blog') }
21
20
  scope :news_posts, ->{ for_blog('news') }
@@ -35,14 +34,12 @@ class Spud::SpudPostModel < ActiveRecord::Base
35
34
  validates_presence_of :title, :content, :published_at, :spud_user_id, :url_name
36
35
  validates_uniqueness_of :url_name
37
36
  before_validation :set_url_name
38
- after_save :set_spud_site_ids
39
37
 
40
38
  acts_as_tb_liquid_content
41
39
 
42
- attr_accessor :spud_site_ids
43
-
44
40
  def self.for_spud_site(spud_site_id)
45
- return joins(:spud_post_sites).where(:spud_post_sites => {:spud_site_id => spud_site_id})
41
+ ActiveSupport::Deprecation.warn 'SpudBlog.for_spud_site is deprecated and will be removed in the future'
42
+ return all()
46
43
  end
47
44
 
48
45
  def self.recent_posts(limit=5)
@@ -133,36 +130,9 @@ class Spud::SpudPostModel < ActiveRecord::Base
133
130
  return self.categories.collect{ |c| c.name }.join(', ')
134
131
  end
135
132
 
136
- # Spud site ids getter
137
- def spud_site_ids
138
- if @spud_site_ids.nil?
139
- @spud_site_ids = spud_post_sites.collect{ |site| site.spud_site_id }
140
- end
141
- return @spud_site_ids
142
- end
143
-
144
- # Spud site ids setter
145
- def spud_site_ids=(site_ids)
146
- if site_ids.is_a?(Array)
147
- @spud_site_ids = site_ids.collect{ |id| id.to_i }
148
- else
149
- raise 'Site ids must be an Array'
150
- end
151
- end
152
-
153
133
  private
154
134
 
155
135
  def set_url_name
156
136
  self.url_name = "#{self.published_at.strftime('%Y-%m-%d')}-#{self.title.parameterize}"
157
137
  end
158
-
159
- def set_spud_site_ids
160
- if Spud::Core.multisite_mode_enabled
161
- _spud_post_sites = []
162
- self.spud_site_ids.each do |site_id|
163
- _spud_post_sites << SpudPostSite.new(:spud_post_id => id, :spud_site_id => site_id)
164
- end
165
- self.spud_post_sites = _spud_post_sites
166
- end
167
- end
168
138
  end
@@ -5,15 +5,11 @@ class AddNestedSetToPostCategories < ActiveRecord::Migration
5
5
  t.integer :rgt
6
6
  t.integer :depth
7
7
  end
8
-
9
- # Populates lft, rgt, and depth values for nested set
10
- # SpudPostCategory.where(:parent_id => 0).update_all({:parent_id => nil})
11
- # SpudPostCategory.rebuild!
12
8
  end
13
9
 
14
10
  def down
15
11
  change_table :spud_post_categories do |t|
16
- t.remove :ltf
12
+ t.remove :lft
17
13
  t.remove :rgt
18
14
  t.remove :depth
19
15
  end
@@ -9,7 +9,7 @@ class RemoveAwesomeNestedSetColumnsFromSpudPostCategories < ActiveRecord::Migrat
9
9
  t.integer :lft
10
10
  t.integer :rgt
11
11
  t.integer :depth
12
- t.inreger :parent_id
12
+ t.integer :parent_id
13
13
  end
14
14
  end
15
15
  end
@@ -0,0 +1,14 @@
1
+ class DropSpudPostSites < ActiveRecord::Migration
2
+ def up
3
+ drop_table :spud_post_sites
4
+ end
5
+ def down
6
+ create_table :spud_post_sites do |t|
7
+ t.integer :spud_post_id, :null => false
8
+ t.integer :spud_site_id, :null => false
9
+ t.timestamps
10
+ end
11
+ add_index :spud_post_sites, :spud_post_id
12
+ add_index :spud_post_sites, :spud_site_id
13
+ end
14
+ end
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Blog
3
- VERSION = "1.3.0.beta1"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
@@ -1,2 +1,2 @@
1
1
  require 'authlogic/test_case'
2
- include Authlogic::TestCase
2
+ include Authlogic::TestCase
@@ -1,5 +1,5 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe Admin::PostsController do
3
+ describe Admin::PostsController, :type => :controller do
4
4
 
5
5
  end
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe PostsController, :type => :controller do
4
4
 
@@ -6,11 +6,11 @@ describe PostsController, :type => :controller do
6
6
  activate_authlogic
7
7
  end
8
8
 
9
- describe :index do
9
+ describe 'index' do
10
10
  it "should display a list of posts" do
11
11
  2.times { |i| FactoryGirl.create(:spud_post) }
12
12
  get :index, {:blog_key => 'blog'}
13
- assigns(:posts).count.should be > 1
13
+ expect(assigns(:posts).count).to be > 1
14
14
  end
15
15
 
16
16
  it "should not display any posts" do
@@ -22,16 +22,16 @@ describe PostsController, :type => :controller do
22
22
  end
23
23
  }
24
24
  get :index, {:blog_key => 'blog'}
25
- assigns(:posts).count.should be 0
25
+ expect(assigns(:posts).count).to be 0
26
26
  Spud::Blog.config.query_for_user = nil
27
27
  end
28
28
  end
29
29
 
30
- describe :create_comment do
30
+ describe 'create_comment' do
31
31
  it "should create a comment" do
32
32
  @post = FactoryGirl.create(:spud_post)
33
33
  post :create_comment, :blog_key => 'blog', :id => @post.url_name, :spud_post_comment => {:author => "Test User", :content => "Lorem Ipsum"}
34
- @post.comments.length.should be > 0
34
+ expect(@post.comments.length).to be > 0
35
35
  end
36
36
 
37
37
  it "should approve a comment by default if default_comment_approval is true" do
@@ -40,7 +40,7 @@ describe PostsController, :type => :controller do
40
40
  end
41
41
  @post = FactoryGirl.create(:spud_post)
42
42
  post :create_comment, :blog_key => 'blog', :id => @post.url_name, :spud_post_comment => {:author => "Test User", :content => "Lorem Ipsum"}
43
- @post.comments.first.approved.should be_true
43
+ expect(@post.comments.first.approved).to eq(true)
44
44
  end
45
45
 
46
46
  it "should not approve a comment by default if default_comment_approval is false" do
@@ -49,7 +49,7 @@ describe PostsController, :type => :controller do
49
49
  end
50
50
  @post = FactoryGirl.create(:spud_post)
51
51
  post :create_comment, :blog_key => 'blog', :id => @post.url_name, :spud_post_comment => {:author => "Test User", :content => "Lorem Ipsum"}
52
- @post.comments.first.approved.should be_false
52
+ expect(@post.comments.first.approved).to eq(false)
53
53
  end
54
54
  end
55
55
 
@@ -0,0 +1,15 @@
1
+ # This migration comes from tb_blog (originally 20150116194722)
2
+ class DropSpudPostSites < ActiveRecord::Migration
3
+ def up
4
+ drop_table :spud_post_sites
5
+ end
6
+ def down
7
+ create_table :spud_post_sites do |t|
8
+ t.integer :spud_post_id, :null => false
9
+ t.integer :spud_site_id, :null => false
10
+ t.timestamps
11
+ end
12
+ add_index :spud_post_sites, :spud_post_id
13
+ add_index :spud_post_sites, :spud_site_id
14
+ end
15
+ end
@@ -11,102 +11,92 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20140811161503) do
14
+ ActiveRecord::Schema.define(version: 20150116195007) do
15
15
 
16
- create_table "spud_liquid_tags", force: true do |t|
17
- t.integer "attachment_id"
18
- t.string "attachment_type"
19
- t.string "tag_name"
20
- t.string "value"
16
+ create_table "spud_liquid_tags", force: :cascade do |t|
17
+ t.integer "attachment_id", limit: 4
18
+ t.string "attachment_type", limit: 255
19
+ t.string "tag_name", limit: 255
20
+ t.string "value", limit: 255
21
21
  t.datetime "created_at"
22
22
  t.datetime "updated_at"
23
23
  end
24
24
 
25
25
  add_index "spud_liquid_tags", ["tag_name", "value"], name: "index_spud_liquid_tags_on_tag_name_and_value", using: :btree
26
26
 
27
- create_table "spud_permalinks", force: true do |t|
28
- t.string "url_name"
29
- t.string "attachment_type"
30
- t.integer "attachment_id"
27
+ create_table "spud_permalinks", force: :cascade do |t|
28
+ t.string "url_name", limit: 255
29
+ t.string "attachment_type", limit: 255
30
+ t.integer "attachment_id", limit: 4
31
31
  t.datetime "created_at"
32
32
  t.datetime "updated_at"
33
- t.integer "site_id", default: 0, null: false
33
+ t.integer "site_id", limit: 4, default: 0, null: false
34
34
  end
35
35
 
36
36
  add_index "spud_permalinks", ["attachment_type", "attachment_id"], name: "idx_permalink_attachment", using: :btree
37
37
  add_index "spud_permalinks", ["site_id"], name: "idx_permalinks_site_id", using: :btree
38
38
 
39
- create_table "spud_permissions", force: true do |t|
40
- t.string "name", null: false
41
- t.string "tag", null: false
39
+ create_table "spud_permissions", force: :cascade do |t|
40
+ t.string "name", limit: 255, null: false
41
+ t.string "tag", limit: 255, null: false
42
42
  t.datetime "created_at"
43
43
  t.datetime "updated_at"
44
44
  end
45
45
 
46
46
  add_index "spud_permissions", ["tag"], name: "index_spud_permissions_on_tag", unique: true, using: :btree
47
47
 
48
- create_table "spud_post_categories", force: true do |t|
49
- t.string "name"
48
+ create_table "spud_post_categories", force: :cascade do |t|
49
+ t.string "name", limit: 255
50
50
  t.datetime "created_at"
51
51
  t.datetime "updated_at"
52
- t.string "url_name"
52
+ t.string "url_name", limit: 255
53
53
  end
54
54
 
55
55
  add_index "spud_post_categories", ["url_name"], name: "index_spud_post_categories_on_url_name", using: :btree
56
56
 
57
- create_table "spud_post_categories_posts", force: true do |t|
58
- t.integer "spud_post_id"
59
- t.integer "spud_post_category_id"
57
+ create_table "spud_post_categories_posts", force: :cascade do |t|
58
+ t.integer "spud_post_id", limit: 4
59
+ t.integer "spud_post_category_id", limit: 4
60
60
  end
61
61
 
62
62
  add_index "spud_post_categories_posts", ["spud_post_category_id"], name: "index_spud_post_categories_posts_on_spud_post_category_id", using: :btree
63
63
 
64
- create_table "spud_post_comments", force: true do |t|
65
- t.integer "spud_post_id"
66
- t.string "author"
67
- t.text "content"
68
- t.boolean "approved", default: false
64
+ create_table "spud_post_comments", force: :cascade do |t|
65
+ t.integer "spud_post_id", limit: 4
66
+ t.string "author", limit: 255
67
+ t.text "content", limit: 65535
68
+ t.boolean "approved", limit: 1, default: false
69
69
  t.datetime "created_at"
70
70
  t.datetime "updated_at"
71
- t.boolean "spam"
72
- t.string "user_ip"
73
- t.string "user_agent"
74
- t.string "referrer"
75
- t.string "permalink"
76
- t.string "blog_key"
71
+ t.boolean "spam", limit: 1
72
+ t.string "user_ip", limit: 255
73
+ t.string "user_agent", limit: 255
74
+ t.string "referrer", limit: 255
75
+ t.string "permalink", limit: 255
76
+ t.string "blog_key", limit: 255
77
77
  end
78
78
 
79
79
  add_index "spud_post_comments", ["approved"], name: "index_spud_post_comments_on_approved", using: :btree
80
80
  add_index "spud_post_comments", ["blog_key"], name: "index_spud_post_comments_on_blog_key", using: :btree
81
81
  add_index "spud_post_comments", ["spud_post_id"], name: "index_spud_post_comments_on_spud_post_id", using: :btree
82
82
 
83
- create_table "spud_post_sites", force: true do |t|
84
- t.integer "spud_post_id", null: false
85
- t.integer "spud_site_id", null: false
86
- t.datetime "created_at"
87
- t.datetime "updated_at"
88
- end
89
-
90
- add_index "spud_post_sites", ["spud_post_id"], name: "index_spud_post_sites_on_spud_post_id", using: :btree
91
- add_index "spud_post_sites", ["spud_site_id"], name: "index_spud_post_sites_on_spud_site_id", using: :btree
92
-
93
- create_table "spud_posts", force: true do |t|
94
- t.integer "spud_user_id"
95
- t.string "title"
96
- t.text "content"
97
- t.boolean "comments_enabled", default: false
98
- t.boolean "visible", default: true
83
+ create_table "spud_posts", force: :cascade do |t|
84
+ t.integer "spud_user_id", limit: 4
85
+ t.string "title", limit: 255
86
+ t.text "content", limit: 65535
87
+ t.boolean "comments_enabled", limit: 1, default: false
88
+ t.boolean "visible", limit: 1, default: true
99
89
  t.datetime "published_at"
100
90
  t.datetime "created_at"
101
91
  t.datetime "updated_at"
102
- t.string "url_name"
103
- t.boolean "is_news", default: false
104
- t.string "meta_keywords"
105
- t.text "meta_description"
106
- t.integer "comments_count", default: 0
107
- t.string "content_format", default: "HTML"
108
- t.text "content_processed"
109
- t.string "blog_key"
92
+ t.string "url_name", limit: 255
93
+ t.boolean "is_news", limit: 1, default: false
94
+ t.string "meta_keywords", limit: 255
95
+ t.text "meta_description", limit: 65535
96
+ t.integer "comments_count", limit: 4, default: 0
97
+ t.string "content_format", limit: 255, default: "HTML"
98
+ t.text "content_processed", limit: 65535
99
+ t.string "blog_key", limit: 255
110
100
  end
111
101
 
112
102
  add_index "spud_posts", ["blog_key"], name: "index_spud_posts_on_blog_key", using: :btree
@@ -115,9 +105,9 @@ ActiveRecord::Schema.define(version: 20140811161503) do
115
105
  add_index "spud_posts", ["url_name"], name: "index_spud_posts_on_url_name", using: :btree
116
106
  add_index "spud_posts", ["visible"], name: "index_spud_posts_on_visible", using: :btree
117
107
 
118
- create_table "spud_role_permissions", force: true do |t|
119
- t.integer "spud_role_id", null: false
120
- t.string "spud_permission_tag", null: false
108
+ create_table "spud_role_permissions", force: :cascade do |t|
109
+ t.integer "spud_role_id", limit: 4, null: false
110
+ t.string "spud_permission_tag", limit: 255, null: false
121
111
  t.datetime "created_at"
122
112
  t.datetime "updated_at"
123
113
  end
@@ -125,42 +115,42 @@ ActiveRecord::Schema.define(version: 20140811161503) do
125
115
  add_index "spud_role_permissions", ["spud_permission_tag"], name: "index_spud_role_permissions_on_spud_permission_tag", using: :btree
126
116
  add_index "spud_role_permissions", ["spud_role_id"], name: "index_spud_role_permissions_on_spud_role_id", using: :btree
127
117
 
128
- create_table "spud_roles", force: true do |t|
129
- t.string "name"
118
+ create_table "spud_roles", force: :cascade do |t|
119
+ t.string "name", limit: 255
130
120
  t.datetime "created_at"
131
121
  t.datetime "updated_at"
132
122
  end
133
123
 
134
- create_table "spud_user_settings", force: true do |t|
135
- t.integer "spud_user_id"
136
- t.string "key"
137
- t.string "value"
124
+ create_table "spud_user_settings", force: :cascade do |t|
125
+ t.integer "spud_user_id", limit: 4
126
+ t.string "key", limit: 255
127
+ t.string "value", limit: 255
138
128
  t.datetime "created_at"
139
129
  t.datetime "updated_at"
140
130
  end
141
131
 
142
- create_table "spud_users", force: true do |t|
143
- t.string "first_name"
144
- t.string "last_name"
145
- t.boolean "super_admin"
146
- t.string "login", null: false
147
- t.string "email", null: false
148
- t.string "crypted_password", null: false
149
- t.string "password_salt", null: false
150
- t.string "persistence_token", null: false
151
- t.string "single_access_token", null: false
152
- t.string "perishable_token", null: false
153
- t.integer "login_count", default: 0, null: false
154
- t.integer "failed_login_count", default: 0, null: false
132
+ create_table "spud_users", force: :cascade do |t|
133
+ t.string "first_name", limit: 255
134
+ t.string "last_name", limit: 255
135
+ t.boolean "super_admin", limit: 1
136
+ t.string "login", limit: 255, null: false
137
+ t.string "email", limit: 255, null: false
138
+ t.string "crypted_password", limit: 255, null: false
139
+ t.string "password_salt", limit: 255, null: false
140
+ t.string "persistence_token", limit: 255, null: false
141
+ t.string "single_access_token", limit: 255, null: false
142
+ t.string "perishable_token", limit: 255, null: false
143
+ t.integer "login_count", limit: 4, default: 0, null: false
144
+ t.integer "failed_login_count", limit: 4, default: 0, null: false
155
145
  t.datetime "last_request_at"
156
146
  t.datetime "current_login_at"
157
147
  t.datetime "last_login_at"
158
- t.string "current_login_ip"
159
- t.string "last_login_ip"
148
+ t.string "current_login_ip", limit: 255
149
+ t.string "last_login_ip", limit: 255
160
150
  t.datetime "created_at"
161
151
  t.datetime "updated_at"
162
- t.string "time_zone"
163
- t.integer "spud_role_id"
152
+ t.string "time_zone", limit: 255
153
+ t.integer "spud_role_id", limit: 4
164
154
  end
165
155
 
166
156
  add_index "spud_users", ["email"], name: "index_spud_users_on_email", using: :btree
@@ -0,0 +1,71 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require 'spec_helper'
6
+ require 'authlogic_helper'
7
+ require 'rspec/rails'
8
+ require 'database_cleaner'
9
+ require 'simplecov'
10
+ require 'factory_girl_rails'
11
+
12
+ SimpleCov.start 'rails'
13
+
14
+ # Add additional requires below this line. Rails is not loaded until this point!
15
+
16
+ # Requires supporting ruby files with custom matchers and macros, etc, in
17
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
18
+ # run as spec files by default. This means that files in spec/support that end
19
+ # in _spec.rb will both be required and run as specs, causing the specs to be
20
+ # run twice. It is recommended that you do not name files matching this glob to
21
+ # end with _spec.rb. You can configure this pattern with the --pattern
22
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
23
+ #
24
+ # The following line is provided for convenience purposes. It has the downside
25
+ # of increasing the boot-up time by auto-requiring all files in the support
26
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
27
+ # require only the support files necessary.
28
+ #
29
+ # Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
30
+
31
+ # Checks for pending migrations before tests are run.
32
+ # If you are not using ActiveRecord, you can remove this line.
33
+ #ActiveRecord::Migration.maintain_test_schema!
34
+
35
+ RSpec.configure do |config|
36
+ config.raise_errors_for_deprecations!
37
+ config.infer_base_class_for_anonymous_controllers = false
38
+
39
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
40
+ # examples within a transaction, remove the following line or assign false
41
+ # instead of true.
42
+ config.use_transactional_fixtures = true
43
+
44
+ # RSpec Rails can automatically mix in different behaviours to your tests
45
+ # based on their file location, for example enabling you to call `get` and
46
+ # `post` in specs under `spec/controllers`.
47
+ #
48
+ # You can disable this behaviour by removing the line below, and instead
49
+ # explicitly tag your specs with their type, e.g.:
50
+ #
51
+ # RSpec.describe UsersController, :type => :controller do
52
+ # # ...
53
+ # end
54
+ #
55
+ # The different available types are documented in the features, such as in
56
+ # https://relishapp.com/rspec/rspec-rails/docs
57
+ # config.infer_spec_type_from_file_location!
58
+
59
+ # Clean the database as needed
60
+ # https://github.com/DatabaseCleaner/database_cleaner#rspec-example
61
+ config.before(:suite) do
62
+ DatabaseCleaner.strategy = :transaction
63
+ DatabaseCleaner.clean_with(:truncation)
64
+ end
65
+ config.around(:each) do |example|
66
+ DatabaseCleaner.cleaning do
67
+ example.run
68
+ end
69
+ end
70
+
71
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,38 +1,85 @@
1
- # Track code coverage
2
- require 'simplecov'
3
- SimpleCov.start 'rails' do
4
- # root "dummy/"
5
- # add_filter "/factories/"
6
- end
1
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
+ # file to always be loaded, without a need to explicitly require it in any files.
5
+ #
6
+ # Given that it is always loaded, you are encouraged to keep this file as
7
+ # light-weight as possible. Requiring heavyweight dependencies from this file
8
+ # will add to the boot time of your test suite on EVERY test run, even for an
9
+ # individual file that may not need all of that loaded. Instead, consider making
10
+ # a separate helper file that requires the additional dependencies and performs
11
+ # the additional setup, and require it from the spec files that actually need it.
12
+ #
13
+ # The `.rspec` file also contains a few flags that are not defaults but that
14
+ # users commonly want.
15
+ #
16
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
+ RSpec.configure do |config|
18
+ # rspec-expectations config goes here. You can use an alternate
19
+ # assertion/expectation library such as wrong or the stdlib/minitest
20
+ # assertions if you prefer.
21
+ config.expect_with :rspec do |expectations|
22
+ # This option will default to `true` in RSpec 4. It makes the `description`
23
+ # and `failure_message` of custom matchers include text for helper methods
24
+ # defined using `chain`, e.g.:
25
+ # be_bigger_than(2).and_smaller_than(4).description
26
+ # # => "be bigger than 2 and smaller than 4"
27
+ # ...rather than:
28
+ # # => "be bigger than 2"
29
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
30
+ end
7
31
 
8
- # This file is copied to spec/ when you run 'rails generate rspec:install'
9
- ENV["RAILS_ENV"] = 'test'
10
- require File.expand_path("../dummy/config/environment", __FILE__)
11
- require 'rspec/rails'
12
- require 'rspec/autorun'
13
- require 'database_cleaner'
14
- require 'shoulda'
15
- require 'factory_girl'
16
- require 'mocha'
32
+ # rspec-mocks config goes here. You can use an alternate test double
33
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
34
+ config.mock_with :rspec do |mocks|
35
+ # Prevents you from mocking or stubbing a method that does not exist on
36
+ # a real object. This is generally recommended, and will default to
37
+ # `true` in RSpec 4.
38
+ mocks.verify_partial_doubles = true
39
+ end
17
40
 
18
- # Requires supporting ruby files with custom matchers and macros, etc,
19
- # in spec/support/ and its subdirectories.
20
- ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
21
- Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb"), File.join(ENGINE_RAILS_ROOT,"spec/factories/*")].each {|f| require f}
41
+ # The settings below are suggested to provide a good initial experience
42
+ # with RSpec, but feel free to customize to your heart's content.
43
+ =begin
44
+ # These two settings work together to allow you to limit a spec run
45
+ # to individual examples or groups you care about by tagging them with
46
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
47
+ # get run.
48
+ config.filter_run :focus
49
+ config.run_all_when_everything_filtered = true
22
50
 
23
- RSpec.configure do |config|
24
- config.mock_with :mocha
25
- config.use_transactional_fixtures = true
26
- config.infer_base_class_for_anonymous_controllers = false
51
+ # Limits the available syntax to the non-monkey patched syntax that is recommended.
52
+ # For more details, see:
53
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
54
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
55
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
56
+ config.disable_monkey_patching!
27
57
 
28
- config.before(:suite) do
29
- DatabaseCleaner.strategy = :truncation
30
- end
31
- config.before(:each) do
32
- DatabaseCleaner.start
33
- end
34
- config.after(:each) do
35
- DatabaseCleaner.clean
58
+ # Many RSpec users commonly either run the entire suite or an individual
59
+ # file, and it's useful to allow more verbose output when running an
60
+ # individual spec file.
61
+ if config.files_to_run.one?
62
+ # Use the documentation formatter for detailed output,
63
+ # unless a formatter has already been configured
64
+ # (e.g. via a command-line flag).
65
+ config.default_formatter = 'doc'
36
66
  end
37
67
 
68
+ # Print the 10 slowest examples and example groups at the
69
+ # end of the spec run, to help surface which specs are running
70
+ # particularly slow.
71
+ config.profile_examples = 10
72
+
73
+ # Run specs in random order to surface order dependencies. If you find an
74
+ # order dependency and want to debug it, you can fix the order by providing
75
+ # the seed, which is printed after each run.
76
+ # --seed 1234
77
+ config.order = :random
78
+
79
+ # Seed global randomization in this process using the `--seed` CLI option.
80
+ # Setting this allows you to use `--seed` to deterministically reproduce
81
+ # test failures related to randomization by passing the same `--seed` value
82
+ # as the one that triggered the failure.
83
+ Kernel.srand config.seed
84
+ =end
38
85
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tb_blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0.beta1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Westlake Design
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-30 00:00:00.000000000 Z
11
+ date: 2015-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -94,104 +94,62 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rspec
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - '='
102
- - !ruby/object:Gem::Version
103
- version: 2.8.0
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - '='
109
- - !ruby/object:Gem::Version
110
- version: 2.8.0
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: rspec-rails
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - '='
116
- - !ruby/object:Gem::Version
117
- version: 2.8.1
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - '='
123
- - !ruby/object:Gem::Version
124
- version: 2.8.1
125
- - !ruby/object:Gem::Dependency
126
- name: shoulda
127
99
  requirement: !ruby/object:Gem::Requirement
128
100
  requirements:
129
101
  - - "~>"
130
102
  - !ruby/object:Gem::Version
131
- version: 3.0.1
103
+ version: 3.1.0
132
104
  type: :development
133
105
  prerelease: false
134
106
  version_requirements: !ruby/object:Gem::Requirement
135
107
  requirements:
136
108
  - - "~>"
137
109
  - !ruby/object:Gem::Version
138
- version: 3.0.1
110
+ version: 3.1.0
139
111
  - !ruby/object:Gem::Dependency
140
- name: factory_girl
112
+ name: factory_girl_rails
141
113
  requirement: !ruby/object:Gem::Requirement
142
114
  requirements:
143
115
  - - "~>"
144
116
  - !ruby/object:Gem::Version
145
- version: '3.0'
117
+ version: 4.5.0
146
118
  type: :development
147
119
  prerelease: false
148
120
  version_requirements: !ruby/object:Gem::Requirement
149
121
  requirements:
150
122
  - - "~>"
151
123
  - !ruby/object:Gem::Version
152
- version: '3.0'
153
- - !ruby/object:Gem::Dependency
154
- name: mocha
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - '='
158
- - !ruby/object:Gem::Version
159
- version: 0.10.3
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - '='
165
- - !ruby/object:Gem::Version
166
- version: 0.10.3
124
+ version: 4.5.0
167
125
  - !ruby/object:Gem::Dependency
168
126
  name: database_cleaner
169
127
  requirement: !ruby/object:Gem::Requirement
170
128
  requirements:
171
- - - '='
129
+ - - "~>"
172
130
  - !ruby/object:Gem::Version
173
- version: 1.0.0.RC1
131
+ version: 1.3.0
174
132
  type: :development
175
133
  prerelease: false
176
134
  version_requirements: !ruby/object:Gem::Requirement
177
135
  requirements:
178
- - - '='
136
+ - - "~>"
179
137
  - !ruby/object:Gem::Version
180
- version: 1.0.0.RC1
138
+ version: 1.3.0
181
139
  - !ruby/object:Gem::Dependency
182
140
  name: simplecov
183
141
  requirement: !ruby/object:Gem::Requirement
184
142
  requirements:
185
143
  - - "~>"
186
144
  - !ruby/object:Gem::Version
187
- version: 0.6.4
145
+ version: 0.9.1
188
146
  type: :development
189
147
  prerelease: false
190
148
  version_requirements: !ruby/object:Gem::Requirement
191
149
  requirements:
192
150
  - - "~>"
193
151
  - !ruby/object:Gem::Version
194
- version: 0.6.4
152
+ version: 0.9.1
195
153
  description: Twice Baked blogging/news and rss engine.
196
154
  email:
197
155
  - greg@westlakedesign.com
@@ -263,6 +221,7 @@ files:
263
221
  - db/migrate/20140508200730_remove_awesome_nested_set_columns_from_spud_post_categories.rb
264
222
  - db/migrate/20140808132950_add_blog_key_to_spud_posts.rb
265
223
  - db/migrate/20140811152252_add_blog_key_to_spud_post_comments.rb
224
+ - db/migrate/20150116194722_drop_spud_post_sites.rb
266
225
  - lib/generators/spud/blog/blog_generator.rb
267
226
  - lib/generators/spud/blog/random_posts_generator.rb
268
227
  - lib/generators/spud/blog/views_generator.rb
@@ -271,6 +230,7 @@ files:
271
230
  - lib/spud_blog/version.rb
272
231
  - lib/tasks/spud_blog_tasks.rake
273
232
  - lib/tb_blog.rb
233
+ - spec/authlogic_helper.rb
274
234
  - spec/controllers/admin/posts_controller_spec.rb
275
235
  - spec/controllers/posts_controller_spec.rb
276
236
  - spec/dummy/README.rdoc
@@ -327,6 +287,7 @@ files:
327
287
  - spec/dummy/db/migrate/20140730131550_remove_awesome_nested_set_columns_from_spud_post_categories.tb_blog.rb
328
288
  - spec/dummy/db/migrate/20140811161502_add_blog_key_to_spud_posts.tb_blog.rb
329
289
  - spec/dummy/db/migrate/20140811161503_add_blog_key_to_spud_post_comments.tb_blog.rb
290
+ - spec/dummy/db/migrate/20150116195007_drop_spud_post_sites.tb_blog.rb
330
291
  - spec/dummy/db/schema.rb
331
292
  - spec/dummy/public/404.html
332
293
  - spec/dummy/public/422.html
@@ -335,8 +296,8 @@ files:
335
296
  - spec/dummy/script/rails
336
297
  - spec/factories/spud_post_factories.rb
337
298
  - spec/factories/spud_user_factories.rb
299
+ - spec/rails_helper.rb
338
300
  - spec/spec_helper.rb
339
- - spec/support/authlogic_helper.rb
340
301
  homepage: http://bitbucket.org/westlakedesign/tb_blog
341
302
  licenses: []
342
303
  metadata: {}
@@ -351,9 +312,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
351
312
  version: '0'
352
313
  required_rubygems_version: !ruby/object:Gem::Requirement
353
314
  requirements:
354
- - - ">"
315
+ - - ">="
355
316
  - !ruby/object:Gem::Version
356
- version: 1.3.1
317
+ version: '0'
357
318
  requirements: []
358
319
  rubyforge_project:
359
320
  rubygems_version: 2.2.1
@@ -361,6 +322,7 @@ signing_key:
361
322
  specification_version: 4
362
323
  summary: Twice Baked Blog Engine.
363
324
  test_files:
325
+ - spec/authlogic_helper.rb
364
326
  - spec/controllers/admin/posts_controller_spec.rb
365
327
  - spec/controllers/posts_controller_spec.rb
366
328
  - spec/dummy/app/assets/javascripts/application.js
@@ -415,6 +377,7 @@ test_files:
415
377
  - spec/dummy/db/migrate/20140730131550_remove_awesome_nested_set_columns_from_spud_post_categories.tb_blog.rb
416
378
  - spec/dummy/db/migrate/20140811161502_add_blog_key_to_spud_posts.tb_blog.rb
417
379
  - spec/dummy/db/migrate/20140811161503_add_blog_key_to_spud_post_comments.tb_blog.rb
380
+ - spec/dummy/db/migrate/20150116195007_drop_spud_post_sites.tb_blog.rb
418
381
  - spec/dummy/db/schema.rb
419
382
  - spec/dummy/public/404.html
420
383
  - spec/dummy/public/422.html
@@ -425,5 +388,5 @@ test_files:
425
388
  - spec/dummy/script/rails
426
389
  - spec/factories/spud_post_factories.rb
427
390
  - spec/factories/spud_user_factories.rb
391
+ - spec/rails_helper.rb
428
392
  - spec/spec_helper.rb
429
- - spec/support/authlogic_helper.rb