miniblog 1.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +7 -0
  2. data/.autotest +5 -0
  3. data/.gitignore +17 -0
  4. data/.rspec +2 -0
  5. data/.simplecov +13 -0
  6. data/.travis.yml +17 -0
  7. data/CHANGELOG.md +7 -0
  8. data/Gemfile +20 -0
  9. data/Gemfile.4.1 +19 -0
  10. data/MIT-LICENSE +20 -0
  11. data/README.md +86 -0
  12. data/Rakefile +29 -0
  13. data/app/assets/images/crowdblog/.gitkeep +0 -0
  14. data/app/assets/javascripts/miniblog.js +7 -0
  15. data/app/assets/javascripts/miniblog/alerts.js +5 -0
  16. data/app/assets/javascripts/miniblog/form-errors.js +3 -0
  17. data/app/assets/stylesheets/application.css +3 -0
  18. data/app/assets/stylesheets/miniblog.css +5 -0
  19. data/app/assets/stylesheets/miniblog/bootstrap_and_overrides.css.scss +1 -0
  20. data/app/assets/stylesheets/miniblog/posts.css.scss +34 -0
  21. data/app/controllers/miniblog/admin/assets_controller.rb +20 -0
  22. data/app/controllers/miniblog/admin/base_controller.rb +7 -0
  23. data/app/controllers/miniblog/admin/posts_controller.rb +63 -0
  24. data/app/controllers/miniblog/admin/preview_controller.rb +8 -0
  25. data/app/controllers/miniblog/admin/states_controller.rb +11 -0
  26. data/app/controllers/miniblog/admin/transitions_controller.rb +22 -0
  27. data/app/controllers/miniblog/application_controller.rb +14 -0
  28. data/app/controllers/miniblog/posts_controller.rb +7 -0
  29. data/app/helpers/miniblog/admin/posts_helper.rb +18 -0
  30. data/app/helpers/miniblog/application_helper.rb +4 -0
  31. data/app/models/miniblog/asset.rb +7 -0
  32. data/app/models/miniblog/post.rb +135 -0
  33. data/app/models/miniblog/status_change_record.rb +6 -0
  34. data/app/models/miniblog/user.rb +32 -0
  35. data/app/presenters/miniblog/post_presenter.rb +13 -0
  36. data/app/uploaders/attachment_uploader.rb +48 -0
  37. data/app/views/layouts/miniblog/admin/base.html.erb +26 -0
  38. data/app/views/miniblog/admin/posts/_form.html.erb +10 -0
  39. data/app/views/miniblog/admin/posts/_form.html.slim +27 -0
  40. data/app/views/miniblog/admin/posts/_post.html.erb +14 -0
  41. data/app/views/miniblog/admin/posts/_post.html.slim +20 -0
  42. data/app/views/miniblog/admin/posts/edit.html.erb +19 -0
  43. data/app/views/miniblog/admin/posts/edit.html.slim +14 -0
  44. data/app/views/miniblog/admin/posts/index.html.erb +5 -0
  45. data/app/views/miniblog/admin/posts/new.html.erb +17 -0
  46. data/app/views/miniblog/admin/posts/new.html.slim +12 -0
  47. data/app/views/miniblog/application/_navbar.html.erb +19 -0
  48. data/app/views/miniblog/application/_notices.html.slim +6 -0
  49. data/app/views/miniblog/posts/_post.html.slim +4 -0
  50. data/app/views/miniblog/posts/index.html.slim +1 -0
  51. data/config/cucumber.yml +9 -0
  52. data/config/initializers/date_formats.rb +1 -0
  53. data/config/initializers/state_machine.rb +4 -0
  54. data/config/locales/devise.en.yml +57 -0
  55. data/config/routes.rb +26 -0
  56. data/db/migrate/20120217213920_create_miniblog_posts.rb +17 -0
  57. data/db/migrate/20120219071614_create_miniblog_assets.rb +10 -0
  58. data/lib/generators/miniblog/views_generator.rb +11 -0
  59. data/lib/miniblog.rb +18 -0
  60. data/lib/miniblog/devise/failure_app.rb +9 -0
  61. data/lib/miniblog/engine.rb +9 -0
  62. data/lib/miniblog/rspec.rb +1 -0
  63. data/lib/miniblog/rspec/miniblog_shared_examples.rb +77 -0
  64. data/lib/miniblog/version.rb +3 -0
  65. data/miniblog.gemspec +40 -0
  66. data/script/cucumber +10 -0
  67. data/script/rails +8 -0
  68. data/spec/dummy/README.rdoc +261 -0
  69. data/spec/dummy/Rakefile +7 -0
  70. data/spec/dummy/app/assets/javascripts/application.js +16 -0
  71. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  72. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  73. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  74. data/spec/dummy/app/mailers/.gitkeep +0 -0
  75. data/spec/dummy/app/models/.gitkeep +0 -0
  76. data/spec/dummy/app/models/user.rb +3 -0
  77. data/spec/dummy/app/views/home/show.html.slim +4 -0
  78. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  79. data/spec/dummy/bin/bundle +3 -0
  80. data/spec/dummy/bin/rails +4 -0
  81. data/spec/dummy/bin/rake +4 -0
  82. data/spec/dummy/config.ru +4 -0
  83. data/spec/dummy/config/application.rb +28 -0
  84. data/spec/dummy/config/boot.rb +4 -0
  85. data/spec/dummy/config/database.yml +25 -0
  86. data/spec/dummy/config/environment.rb +5 -0
  87. data/spec/dummy/config/environments/development.rb +37 -0
  88. data/spec/dummy/config/environments/production.rb +82 -0
  89. data/spec/dummy/config/environments/test.rb +39 -0
  90. data/spec/dummy/config/initializers/assets.rb +8 -0
  91. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  92. data/spec/dummy/config/initializers/carrierwave.rb +18 -0
  93. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  94. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  95. data/spec/dummy/config/initializers/inflections.rb +16 -0
  96. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  97. data/spec/dummy/config/initializers/miniblog.rb +2 -0
  98. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  99. data/spec/dummy/config/initializers/session_store.rb +3 -0
  100. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  101. data/spec/dummy/config/locales/en.yml +23 -0
  102. data/spec/dummy/config/routes.rb +3 -0
  103. data/spec/dummy/config/secrets.yml +22 -0
  104. data/spec/dummy/db/schema.rb +50 -0
  105. data/spec/dummy/db/seed.rb +6 -0
  106. data/spec/dummy/lib/assets/.gitkeep +0 -0
  107. data/spec/dummy/lib/tasks/cucumber.rake +65 -0
  108. data/spec/dummy/public/404.html +26 -0
  109. data/spec/dummy/public/422.html +26 -0
  110. data/spec/dummy/public/500.html +25 -0
  111. data/spec/dummy/public/favicon.ico +0 -0
  112. data/spec/dummy/script/rails +6 -0
  113. data/spec/features/miniblog_spec.rb +5 -0
  114. data/spec/generators/miniblog/views_generator_spec.rb +16 -0
  115. data/spec/models/post_spec.rb +163 -0
  116. data/spec/spec_helper.rb +58 -0
  117. data/vendor/assets/javascripts/markdown.js +1470 -0
  118. data/vendor/assets/javascripts/uploader/jquery.html5uploader.js +148 -0
  119. metadata +464 -0
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ mount Miniblog::Engine => '/'
3
+ end
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: 6a441d70d11746af3ab8ec4ae145c09a7075323d768af04fe6bd1abc477f85840b4d734bffb833e045178d03e883b3650bf3bfe2a9995ce6efdaf1bd4900a0c1
15
+
16
+ test:
17
+ secret_key_base: a21663c921f987339b3f60d00605da9f7243405e6d0e1fa89ac0aa6de255cfb9488bfe3742cef8d2b1aef436cd0c2b73d528ab502bf3d531dca74f7185ea67b8
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -0,0 +1,50 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20140501164642) do
15
+
16
+ create_table "miniblog_assets", force: :cascade do |t|
17
+ t.integer "post_id"
18
+ t.string "attachment"
19
+ t.datetime "created_at"
20
+ t.datetime "updated_at"
21
+ end
22
+
23
+ create_table "miniblog_posts", force: :cascade do |t|
24
+ t.string "title"
25
+ t.text "body"
26
+ t.string "permalink"
27
+ t.datetime "published_at"
28
+ t.integer "author_id"
29
+ t.string "state"
30
+ t.integer "publisher_id"
31
+ t.boolean "ready_for_review"
32
+ t.datetime "marked_for_review_at"
33
+ t.datetime "created_at"
34
+ t.datetime "updated_at"
35
+ end
36
+
37
+ create_table "miniblog_status_change_records", force: :cascade do |t|
38
+ t.integer "user_id"
39
+ t.integer "post_id"
40
+ t.string "state"
41
+ t.datetime "created_at"
42
+ t.datetime "updated_at"
43
+ end
44
+
45
+ create_table "users", force: :cascade do |t|
46
+ t.string "email"
47
+ t.string "name"
48
+ end
49
+
50
+ end
@@ -0,0 +1,6 @@
1
+ user = Miniblog::User.new
2
+ user.email = "test@example.com"
3
+ user.password = "123456"
4
+ user.password_confirmation = "123456"
5
+
6
+ user.save!
File without changes
@@ -0,0 +1,65 @@
1
+ # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
+ # It is recommended to regenerate this file in the future when you upgrade to a
3
+ # newer version of cucumber-rails. Consider adding your own code to a new file
4
+ # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
+ # files.
6
+
7
+
8
+ unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
9
+
10
+ vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
11
+ $LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
12
+
13
+ begin
14
+ require 'cucumber/rake/task'
15
+
16
+ namespace :cucumber do
17
+ Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
18
+ t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
19
+ t.fork = true # You may get faster startup if you set this to false
20
+ t.profile = 'default'
21
+ end
22
+
23
+ Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
24
+ t.binary = vendored_cucumber_bin
25
+ t.fork = true # You may get faster startup if you set this to false
26
+ t.profile = 'wip'
27
+ end
28
+
29
+ Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
30
+ t.binary = vendored_cucumber_bin
31
+ t.fork = true # You may get faster startup if you set this to false
32
+ t.profile = 'rerun'
33
+ end
34
+
35
+ desc 'Run all features'
36
+ task :all => [:ok, :wip]
37
+
38
+ task :statsetup do
39
+ require 'rails/code_statistics'
40
+ ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
41
+ ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
42
+ end
43
+ end
44
+ desc 'Alias for cucumber:ok'
45
+ task :cucumber => 'cucumber:ok'
46
+
47
+ task :default => :cucumber
48
+
49
+ task :features => :cucumber do
50
+ STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
51
+ end
52
+
53
+ # In case we don't have ActiveRecord, append a no-op task that we can depend upon.
54
+ task 'db:test:prepare' do
55
+ end
56
+
57
+ task :stats => 'cucumber:statsetup'
58
+ rescue LoadError
59
+ desc 'cucumber rake task not available (cucumber not installed)'
60
+ task :cucumber do
61
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
62
+ end
63
+ end
64
+
65
+ end
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe "miniblog" do
4
+ it_should_behave_like "a miniblog"
5
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe Miniblog::ViewsGenerator do
4
+ let(:destination) { 'tmp' }
5
+
6
+ before do
7
+ FileUtils.rm_rf 'tmp'
8
+ end
9
+
10
+ it "copies all the views" do
11
+ Miniblog::ViewsGenerator.start([], :destination_root => destination)
12
+ Dir['app/views/**/*'].each do |f|
13
+ expect(File.read(f)).to eq File.read(File.join(destination, f)) unless File.directory?(f)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,163 @@
1
+ require 'spec_helper'
2
+
3
+ module Miniblog
4
+ describe Post do
5
+ describe 'Class Methods' do
6
+ describe '#self.all_posts_json' do
7
+ it 'convert ordered posts to JSON' do
8
+ expect(Post).to receive(:order_by_publish_date).and_return Post
9
+ expect(Post).to receive(:to_json)
10
+ Post.all_posts_json
11
+ end
12
+ end
13
+
14
+ describe '#self.last_published' do
15
+ it 'should find the last given post published, ordered' do
16
+ expect(Post).to receive(:published_and_ordered).and_return Post
17
+ expect(Post).to receive(:limit).with(11)
18
+ Post.last_published(11)
19
+ end
20
+ end
21
+
22
+ describe '#self.order_by_publish_date' do
23
+ it 'should order by published' do
24
+ expect(Post).to receive(:order).with('published_at DESC, created_at DESC, id DESC')
25
+ Post.order_by_publish_date
26
+ end
27
+ end
28
+
29
+ describe '#self.published' do
30
+ it 'should only find Published Posts' do
31
+ expect(Post).to receive(:where).with(state: 'published')
32
+ Post.published
33
+ end
34
+ end
35
+
36
+ describe '#self.published_and_ordered' do
37
+ it 'should find published posts and order them by published date (FILO)' do
38
+ expect(Post).to receive(:published).and_return Post
39
+ expect(Post).to receive(:order_by_publish_date).and_return Post
40
+ Post.published_and_ordered
41
+ end
42
+ end
43
+
44
+ describe '#self.scoped_for' do
45
+ let(:user) { double(is_publisher?: true) }
46
+
47
+ context 'user is publisher' do
48
+ it 'should see all the Posts' do
49
+ expect(Post.scoped_for(user)).to eq Post.all
50
+ end
51
+ end
52
+
53
+ context 'user is not publisher' do
54
+ before { expect(user).to receive(:is_publisher?).and_return false }
55
+
56
+ it 'should see my own Posts only' do
57
+ expect(user).to receive(:authored_posts)
58
+ Post.scoped_for(user)
59
+ end
60
+ end
61
+ end
62
+ end
63
+
64
+ describe "#allowed_to_update_permalink?" do
65
+ context "post is published" do
66
+ before do
67
+ subject.state = 'published'
68
+ end
69
+
70
+ it "returns false" do
71
+ expect(subject.allowed_to_update_permalink?).to be_falsey
72
+ end
73
+ end
74
+
75
+ context "post is not published" do
76
+ before do
77
+ subject.state = 'draft'
78
+ end
79
+
80
+ it "returns true" do
81
+ expect(subject.allowed_to_update_permalink?).to be_truthy
82
+ end
83
+ end
84
+ end
85
+
86
+ describe "#day" do
87
+ context "published at in february" do
88
+ before do
89
+ subject.published_at = Date.new(2012, 12, 2)
90
+ end
91
+
92
+ it "returns 02" do
93
+ expect(subject.day).to eq "02"
94
+ end
95
+ end
96
+ end
97
+
98
+ describe "#formatted_published_date" do
99
+ it "Formats the published_at date" do
100
+ subject.published_at = Time.zone.parse('2012/02/18')
101
+ expect(subject.formatted_published_date).to eq 'Feb 18, 2012'
102
+ end
103
+ end
104
+
105
+ describe '#html_body' do
106
+ before { expect(subject).to receive(:body).and_return '**w00t**' }
107
+
108
+ it 'should parse the Markdown in the body' do
109
+ expect(subject.html_body).to match /<strong>w00t<\/strong>/
110
+ end
111
+ end
112
+
113
+ describe "#month" do
114
+ context "published at in february" do
115
+ before do
116
+ subject.published_at = Date.new(2012, 2, 1)
117
+ end
118
+
119
+ it "returns 02" do
120
+ expect(subject.month).to eq "02"
121
+ end
122
+ end
123
+ end
124
+
125
+ describe "#publish_if_allowed" do
126
+ context "user is publisher" do
127
+ let(:user) { stub_model(::User, :is_publisher? => true) }
128
+ it "changes its state" do
129
+ expect(subject).to receive(:publisher=).with(user)
130
+ expect(subject).to receive('publish')
131
+ subject.publish_if_allowed('publish', user)
132
+ end
133
+ end
134
+
135
+ context "user is not publisher" do
136
+ let(:user) { stub_model(::User, :is_publisher? => false) }
137
+
138
+ it "does not change its state" do
139
+ expect(subject).to_not receive('publish')
140
+ subject.publish_if_allowed('publish', user)
141
+ end
142
+ end
143
+ end
144
+
145
+ describe "#regenerate_permalink" do
146
+ it "generates the permalink based on the post title" do
147
+ subject.title = 'A big long post title'
148
+ subject.regenerate_permalink
149
+ expect(subject.permalink).to eq 'a-big-long-post-title'
150
+ end
151
+ end
152
+
153
+ describe '#url_params' do
154
+ before { subject.stub(year: 'YEAR', month: 'MONTH',
155
+ day: 'DAY', permalink: 'PERMALINK') }
156
+
157
+ it 'should return the array for permalink (year/month/day/permalink)' do
158
+ expect(subject.url_params).to eq %w(YEAR MONTH DAY PERMALINK html)
159
+ end
160
+ end
161
+
162
+ end
163
+ end
@@ -0,0 +1,58 @@
1
+ require 'simplecov'
2
+
3
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
4
+ ENV["RAILS_ENV"] ||= 'test'
5
+ require File.expand_path("../dummy/config/environment", __FILE__)
6
+ require 'rspec/rails'
7
+ require 'rspec/active_model/mocks'
8
+ require 'capybara/rspec'
9
+ require 'miniblog/rspec'
10
+ require 'database_cleaner'
11
+ require 'coffee_script'
12
+
13
+ ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
14
+
15
+ # Requires supporting ruby files with custom matchers and macros, etc,
16
+ # in spec/support/ and its subdirectories.
17
+ Dir[File.join(ENGINE_RAILS_ROOT, 'spec/support/**/*.rb')].each {|f| require f }
18
+
19
+ RSpec.configure do |config|
20
+ # ## Mock Framework
21
+ #
22
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
23
+ #
24
+ # config.mock_with :mocha
25
+ # config.mock_with :flexmock
26
+ # config.mock_with :rr
27
+
28
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
29
+ config.fixture_path = "#{ENGINE_RAILS_ROOT}/spec/fixtures"
30
+
31
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
32
+ # examples within a transaction, remove the following line or assign false
33
+ # instead of true.
34
+ config.use_transactional_fixtures = false
35
+
36
+ # If true, the base class of anonymous controllers will be inferred
37
+ # automatically. This will be the default behavior in future versions of
38
+ # rspec-rails.
39
+ config.infer_base_class_for_anonymous_controllers = false
40
+
41
+ # Include Engine routes (needed for Controller specs)
42
+ config.include Miniblog::Engine.routes.url_helpers
43
+
44
+ config.include Capybara::DSL
45
+
46
+ config.before(:suite) do
47
+ DatabaseCleaner.strategy = :truncation
48
+ DatabaseCleaner.clean_with(:truncation)
49
+ end
50
+
51
+ config.before(:each) do
52
+ DatabaseCleaner.start
53
+ end
54
+
55
+ config.after(:each) do
56
+ DatabaseCleaner.clean
57
+ end
58
+ end