fetty-generators 2.0.3 → 2.0.4

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.
Files changed (37) hide show
  1. data/lib/generators/fetty.rb +40 -17
  2. data/lib/generators/fetty/authentication/USAGE +6 -1
  3. data/lib/generators/fetty/authentication/authentication_generator.rb +16 -10
  4. data/lib/generators/fetty/authentication/templates/controllers/sessions_controller.rb +3 -0
  5. data/lib/generators/fetty/authentication/templates/controllers/users_controller.rb +5 -1
  6. data/lib/generators/fetty/authentication/templates/lib/users_authentication.rb +1 -1
  7. data/lib/generators/fetty/authentication/templates/spec/controllers/sessions_controller_spec.rb +12 -2
  8. data/lib/generators/fetty/authentication/templates/spec/controllers/users_controller_spec.rb +13 -2
  9. data/lib/generators/fetty/messages/USAGE +5 -0
  10. data/lib/generators/fetty/messages/messages_generator.rb +21 -13
  11. data/lib/generators/fetty/messages/templates/spec/controllers/messages_controller_spec.rb +5 -0
  12. data/lib/generators/fetty/messages/templates/spec/support/message_factories.rb +3 -3
  13. data/lib/generators/fetty/scaffold/USAGE +13 -0
  14. data/lib/generators/fetty/scaffold/scaffold_generator.rb +6 -16
  15. data/lib/generators/fetty/scaffold/templates/{test/rspec → spec}/controller.rb +45 -14
  16. data/lib/generators/fetty/scaffold/templates/{test/rspec → spec}/factories.rb +0 -0
  17. data/lib/generators/fetty/scaffold/templates/{test/rspec → spec}/helper.rb +0 -0
  18. data/lib/generators/fetty/scaffold/templates/{test/rspec → spec}/model.rb +0 -0
  19. data/lib/generators/fetty/scaffold/templates/{test/rspec → spec}/request.rb +0 -0
  20. data/lib/generators/fetty/scaffold/templates/{test/rspec → spec}/routing.rb +0 -0
  21. data/lib/generators/fetty/scaffold/templates/views/_form.html.erb +4 -0
  22. data/lib/generators/fetty/setup/USAGE +12 -1
  23. data/lib/generators/fetty/setup/setup_generator.rb +56 -39
  24. data/lib/generators/fetty/setup/templates/Guardfile +45 -0
  25. data/lib/generators/fetty/setup/templates/env.rb +83 -44
  26. data/lib/generators/fetty/setup/templates/spec_helper.rb +77 -39
  27. data/lib/generators/fetty/views/USAGE +10 -0
  28. data/lib/generators/fetty/views/templates/application.css +5 -0
  29. data/lib/generators/fetty/views/templates/application.html.erb +19 -15
  30. data/lib/generators/fetty/views/templates/application.js +0 -2
  31. data/lib/generators/fetty/views/views_generator.rb +6 -6
  32. metadata +10 -14
  33. data/lib/generators/fetty/authentication/templates/views/layouts/application.html.erb +0 -33
  34. data/lib/generators/fetty/scaffold/templates/test/test_unit/controller.rb +0 -62
  35. data/lib/generators/fetty/scaffold/templates/test/test_unit/fixtures.yml +0 -11
  36. data/lib/generators/fetty/scaffold/templates/test/test_unit/helper.rb +0 -4
  37. data/lib/generators/fetty/scaffold/templates/test/test_unit/model.rb +0 -7
@@ -1,6 +1,10 @@
1
1
  <%- if has_type? :editor -%>
2
2
  <%% content_for(:head) do %>
3
+ <%- unless rails_3_1? -%>
3
4
  <%%= javascript_include_tag :ckeditor %>
5
+ <%- else -%>
6
+ <%%= javascript_include_tag "ckeditor/ckeditor.js" %>
7
+ <%- end -%>
4
8
  <%% end %>
5
9
  <%- end -%>
6
10
  <%%= simple_form_for <%= record_or_name_or_array %><%= ", :html => { :multipart => true }" if has_type? :image -%> do |f| %>
@@ -1,5 +1,16 @@
1
1
  Description:
2
2
  The fetty:setup generator will add / install the necessary gems
3
3
  to your Gemfile and automatically configure the gems.
4
-
4
+
5
+ Example:
6
+
7
+ rails g fetty:setup
8
+
9
+ or to use with mongoid:
10
+
11
+ rails g fetty:setup --mongoid
12
+
13
+ or to install only test gems:
14
+
15
+ rails g fetty:setup --only test
5
16
 
@@ -2,7 +2,8 @@ require 'generators/fetty'
2
2
 
3
3
  module Fetty
4
4
  module Generators
5
- class SetupGenerator < Base #:nodoc:
5
+ class SetupGenerator < Base #:nodoc:
6
+
6
7
  # required
7
8
  class_option :cancan, :desc => 'Install cancan for authorization', :type => :boolean, :default => true
8
9
  class_option :jquery_rails, :desc => 'Install jquery-rails for javascript framework', :type => :boolean, :default => true
@@ -10,7 +11,7 @@ module Fetty
10
11
  class_option :carrierwave, :desc => 'Install carrierwave for handling file attachment', :type => :boolean, :default => true
11
12
  class_option :kaminari, :desc => 'Install kaminari for pagination', :type => :boolean, :default => true
12
13
  class_option :ckeditor, :desc => 'Install ckeditor for WYSIWYG editor', :type => :boolean, :default => true
13
- class_option :test, :desc => 'Setup all test framework rspec / cucumber, capybara, guard, etc.', :type => :boolean, :default => true
14
+ class_option :test, :desc => 'Setup all test framework Rspec / Cucumber, spork, capybara, guard, etc.', :type => :boolean, :default => true
14
15
 
15
16
  # optional
16
17
  class_option :mongoid, :desc => 'Install mongoid for replacing your ORM', :type => :boolean, :default => false
@@ -27,8 +28,6 @@ module Fetty
27
28
  end
28
29
  end
29
30
  if options.only.empty?
30
- remove_file 'public/index.html' if file_exists?('public/index.html')
31
- remove_file 'public/images/rails.png' if file_exists?('public/images/rails.png')
32
31
  print_notes("Refreshing Bundle")
33
32
  refresh_bundle
34
33
  end
@@ -59,7 +58,7 @@ private
59
58
 
60
59
  def setup_jquery_rails
61
60
  gem "jquery-rails"
62
- generate("jquery:install")
61
+ generate("jquery:install") unless rails_3_1?
63
62
  rescue Exception => e
64
63
  raise e
65
64
  end
@@ -88,13 +87,19 @@ private
88
87
  end
89
88
 
90
89
  def setup_ckeditor
91
- # remove the existing install (if any)
92
- destroy("public/javascripts/ckeditor")
93
90
  ver = ask("==> What version of CKEditor javascript files do you need? [default 3.5.4]")
94
91
  if ver == "3.5.4" || ver.blank?
95
92
  gem "ckeditor", "3.5.4"
96
93
  template "ckeditor.rb", "config/initializers/ckeditor.rb"
97
- extract("setup/templates/ckeditor.tar.gz","public/javascripts","ckeditor")
94
+ unless rails_3_1?
95
+ # remove the existing install (if any)
96
+ remove_file("public/javascripts/ckeditor")
97
+ extract("setup/templates/ckeditor.tar.gz","public/javascripts","ckeditor")
98
+ else
99
+ remove_file("vendor/assets/javascripts/ckeditor")
100
+ `mkdir vendor/assets/javascripts` unless Dir.exists? "vendor/assets/javascripts"
101
+ extract("setup/templates/ckeditor.tar.gz","vendor/assets/javascripts","ckeditor")
102
+ end
98
103
  else
99
104
  gem "ckeditor", ver
100
105
  generate("ckeditor:base --version=#{ver}")
@@ -104,38 +109,50 @@ private
104
109
  end
105
110
 
106
111
  def setup_test
107
- # remove the existing install (if any)
108
- destroy("Guardfile")
109
-
110
- gem 'rspec-rails', :group => [:development, :test]
111
- gem 'capybara', :group => [:development, :test]
112
- gem 'factory_girl_rails', :group => [:development, :test]
113
- gem 'faker', :group => [:development, :test]
114
- gem 'database_cleaner', :group => [:development, :test]
115
- gem 'escape_utils', :group => [:development, :test]
116
- gem 'guard-rspec', :group => [:development, :test]
117
- if RUBY_PLATFORM =~ /darwin/i
118
- gem 'rb-fsevent', :group => [:development, :test], :require => false
119
- gem 'growl', :group => [:development, :test]
120
- end
121
-
122
- copy_file 'escape_utils.rb', 'config/initializers/escape_utils.rb'
123
- destroy("spec")
124
- generate("rspec:install")
125
- remove_file 'spec/spec_helper.rb'
126
- template 'spec_helper.rb', 'spec/spec_helper.rb', :force => true
127
- `guard init rspec`
128
-
129
- asking "Would you like to install Cucumber?" do
130
- destroy("features")
131
- gem "cucumber-rails", :group => [:development, :test]
132
- gem "guard-cucumber", :group => [:development, :test]
133
- generate("cucumber:install", "--rspec", "--capybara")
134
- template 'env.rb', 'features/support/env.rb', :force => true
135
- `guard init cucumber`
112
+ print_notes("This generator will destroy Test::Unit folder if exist and install RSpec / Cucumber")
113
+ asking "Do you wish to proceed?" do
114
+ # remove the existing Guardfile (if any)
115
+ remove_file("test")
116
+ gem_group :development, :test do
117
+ gem "spork", "> 0.9.0.rc"
118
+ gem "guard-spork"
119
+ gem 'capybara'
120
+ gem 'factory_girl_rails'
121
+ gem 'faker'
122
+ gem 'database_cleaner'
123
+ gem 'escape_utils'
124
+ asking "Would you like to install RSpec?" do
125
+ gem 'rspec-rails'
126
+ gem 'guard-rspec'
127
+ @use_guard_rspec = true
128
+ copy_file 'escape_utils.rb', 'config/initializers/escape_utils.rb'
129
+ remove_file("spec", :verbose => false)
130
+ generate("rspec:install")
131
+ template 'spec_helper.rb', 'spec/spec_helper.rb', :force => true, :verbose => false
132
+ end
133
+ asking "Would you like to install Cucumber?" do
134
+ gem "cucumber-rails"
135
+ gem "guard-cucumber"
136
+ @use_guard_cucumber = true
137
+ remove_file("features", :verbose => false)
138
+ if folder_exists? "spec"
139
+ generate("cucumber:install", "--rspec", "--capybara")
140
+ else
141
+ generate("cucumber:install", "--capybara")
142
+ end
143
+ template 'env.rb', 'features/support/env.rb', :force => true, :verbose => false
144
+ end
145
+ if RUBY_PLATFORM =~ /darwin/i
146
+ gem 'rb-fsevent', :require => false
147
+ gem 'growl'
148
+ print_notes("Please make sure you already install growl with growlnotify!!")
149
+ end
150
+ end
151
+
152
+ # remove the existing Guardfile (if any)
153
+ remove_file("Guardfile", :verbose => false)
154
+ template "Guardfile", "Guardfile", :force => true
136
155
  end
137
-
138
- print_notes("Please make sure you already install growl with growlnotify!!")
139
156
  rescue Exception => e
140
157
  raise e
141
158
  end
@@ -0,0 +1,45 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
5
+ watch('config/application.rb')
6
+ watch('config/environment.rb')
7
+ watch(%r{^config/environments/.+\.rb$})
8
+ watch(%r{^config/initializers/.+\.rb$})
9
+ watch('Gemfile')
10
+ watch('Gemfile.lock')
11
+ <%- if @use_guard_rspec -%>
12
+ watch('spec/spec_helper.rb')
13
+ <%- end -%>
14
+ <%- if @use_guard_cucumber -%>
15
+ watch('features/support/env.rb')
16
+ <%- end -%>
17
+ end
18
+
19
+ <%- if @use_guard_rspec -%>
20
+ guard 'rspec', :version => 2 , :cli => '--drb' do
21
+ watch(%r{^spec/.+_spec\.rb$})
22
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
23
+ watch('spec/spec_helper.rb') { "spec" }
24
+
25
+ # Rails example
26
+ watch(%r{^spec/.+_spec\.rb$})
27
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
28
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
29
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
30
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
31
+ watch('spec/spec_helper.rb') { "spec" }
32
+ watch('config/routes.rb') { "spec/routing" }
33
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
34
+ # Capybara request specs
35
+ watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
36
+ end
37
+ <%- end -%>
38
+
39
+ <%- if @use_guard_cucumber -%>
40
+ guard 'cucumber', :cli => '--drb' do
41
+ watch(%r{^features/.+\.feature$})
42
+ watch(%r{^features/support/.+$}) { 'features' }
43
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
44
+ end
45
+ <%- end -%>
@@ -1,50 +1,89 @@
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
- require 'cucumber/rails'
8
-
9
- # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
10
- # order to ease the transition to Capybara we set the default here. If you'd
11
- # prefer to use XPath just remove this line and adjust any selectors in your
12
- # steps to use the XPath syntax.
13
- Capybara.default_selector = :css
14
-
15
- # By default, any exception happening in your Rails application will bubble up
16
- # to Cucumber so that your scenario will fail. This is a different from how
17
- # your application behaves in the production environment, where an error page will
18
- # be rendered instead.
1
+ require 'rubygems'
2
+ require 'spork'
3
+
4
+ # --- Instructions ---
5
+ # Sort the contents of this file into a Spork.prefork and a Spork.each_run
6
+ # block.
7
+ #
8
+ # The Spork.prefork block is run only once when the spork server is started.
9
+ # You typically want to place most of your (slow) initializer code in here, in
10
+ # particular, require'ing any 3rd-party gems that you don't normally modify
11
+ # during development.
19
12
  #
20
- # Sometimes we want to override this default behaviour and allow Rails to rescue
21
- # exceptions and display an error page (just like when the app is running in production).
22
- # Typical scenarios where you want to do this is when you test your error pages.
23
- # There are two ways to allow Rails to rescue exceptions:
13
+ # The Spork.each_run block is run each time you run your specs. In case you
14
+ # need to load files that tend to change during development, require them here.
15
+ # With Rails, your application modules are loaded automatically, so sometimes
16
+ # this block can remain empty.
24
17
  #
25
- # 1) Tag your scenario (or feature) with @allow-rescue
18
+ # Note: You can modify files loaded *from* the Spork.each_run block without
19
+ # restarting the spork server. However, this file itself will not be reloaded,
20
+ # so if you change any of the code inside the each_run block, you still need to
21
+ # restart the server. In general, if you have non-trivial code in this file,
22
+ # it's advisable to move it into a separate file so you can easily edit it
23
+ # without restarting spork. (For example, with RSpec, you could move
24
+ # non-trivial code into a file spec/support/my_helper.rb, making sure that the
25
+ # spec/support/* files are require'd from inside the each_run block.)
26
26
  #
27
- # 2) Set the value below to true. Beware that doing this globally is not
28
- # recommended as it will mask a lot of errors for you!
27
+ # Any code that is left outside the two blocks will be run during preforking
28
+ # *and* during each_run -- that's probably not what you want.
29
29
  #
30
- ActionController::Base.allow_rescue = false
31
-
32
- # Remove/comment out the lines below if your app doesn't have a database.
33
- # For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
34
- begin
35
- DatabaseCleaner.strategy = <%= using_mongoid? ? ':truncation' : ':transaction' %>
36
- rescue NameError
37
- raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
30
+ # These instructions should self-destruct in 10 seconds. If they don't, feel
31
+ # free to delete them.
32
+
33
+ Spork.prefork do
34
+ # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
35
+ # It is recommended to regenerate this file in the future when you upgrade to a
36
+ # newer version of cucumber-rails. Consider adding your own code to a new file
37
+ # instead of editing this one. Cucumber will automatically load all features/**/*.rb
38
+ # files.
39
+
40
+ require 'cucumber/rails'
41
+
42
+ # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
43
+ # order to ease the transition to Capybara we set the default here. If you'd
44
+ # prefer to use XPath just remove this line and adjust any selectors in your
45
+ # steps to use the XPath syntax.
46
+ Capybara.default_selector = :css
47
+
48
+ # By default, any exception happening in your Rails application will bubble up
49
+ # to Cucumber so that your scenario will fail. This is a different from how
50
+ # your application behaves in the production environment, where an error page will
51
+ # be rendered instead.
52
+ #
53
+ # Sometimes we want to override this default behaviour and allow Rails to rescue
54
+ # exceptions and display an error page (just like when the app is running in production).
55
+ # Typical scenarios where you want to do this is when you test your error pages.
56
+ # There are two ways to allow Rails to rescue exceptions:
57
+ #
58
+ # 1) Tag your scenario (or feature) with @allow-rescue
59
+ #
60
+ # 2) Set the value below to true. Beware that doing this globally is not
61
+ # recommended as it will mask a lot of errors for you!
62
+ #
63
+ ActionController::Base.allow_rescue = false
64
+
65
+ # Remove/comment out the lines below if your app doesn't have a database.
66
+ # For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
67
+ begin
68
+ DatabaseCleaner.strategy = <%= using_mongoid? ? ':truncation' : ':transaction' %>
69
+ rescue NameError
70
+ raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
71
+ end
72
+
73
+ # You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
74
+ # See the DatabaseCleaner documentation for details. Example:
75
+ #
76
+ # Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
77
+ # DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]}
78
+ # end
79
+ #
80
+ # Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
81
+ # DatabaseCleaner.strategy = :transaction
82
+ # end
83
+ #
38
84
  end
39
85
 
40
- # You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
41
- # See the DatabaseCleaner documentation for details. Example:
42
- #
43
- # Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
44
- # DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]}
45
- # end
46
- #
47
- # Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
48
- # DatabaseCleaner.strategy = :transaction
49
- # end
50
- #
86
+ Spork.each_run do
87
+ # This code will be run each time you run your specs.
88
+
89
+ end
@@ -1,44 +1,82 @@
1
- # This file is copied to spec/ when you run 'rails generate rspec:install'
2
- ENV["RAILS_ENV"] ||= 'test'
3
- require File.expand_path("../../config/environment", __FILE__)
4
- require 'rspec/rails'
5
-
6
- # Requires supporting ruby files with custom matchers and macros, etc,
7
- # in spec/support/ and its subdirectories.
8
- Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
9
-
10
- RSpec.configure do |config|
11
- # == Mock Framework
12
- #
13
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
14
- #
15
- # config.mock_with :mocha
16
- # config.mock_with :flexmock
17
- # config.mock_with :rr
18
- config.mock_with :rspec
19
-
20
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
21
- # config.fixture_path = "#{::Rails.root}/spec/fixtures"
22
-
23
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
24
- # examples within a transaction, remove the following line or assign false
25
- # instead of true.
26
- # config.use_transactional_fixtures = true
27
-
28
- config.before(:suite) do
29
- DatabaseCleaner.strategy = <%= using_mongoid? ? ':truncation' : ':transaction' %>
30
- end
31
-
32
- config.before(:each) do
33
- DatabaseCleaner.start
34
- end
1
+ require 'rubygems'
2
+ require 'spork'
3
+
4
+ # --- Instructions ---
5
+ # Sort the contents of this file into a Spork.prefork and a Spork.each_run
6
+ # block.
7
+ #
8
+ # The Spork.prefork block is run only once when the spork server is started.
9
+ # You typically want to place most of your (slow) initializer code in here, in
10
+ # particular, require'ing any 3rd-party gems that you don't normally modify
11
+ # during development.
12
+ #
13
+ # The Spork.each_run block is run each time you run your specs. In case you
14
+ # need to load files that tend to change during development, require them here.
15
+ # With Rails, your application modules are loaded automatically, so sometimes
16
+ # this block can remain empty.
17
+ #
18
+ # Note: You can modify files loaded *from* the Spork.each_run block without
19
+ # restarting the spork server. However, this file itself will not be reloaded,
20
+ # so if you change any of the code inside the each_run block, you still need to
21
+ # restart the server. In general, if you have non-trivial code in this file,
22
+ # it's advisable to move it into a separate file so you can easily edit it
23
+ # without restarting spork. (For example, with RSpec, you could move
24
+ # non-trivial code into a file spec/support/my_helper.rb, making sure that the
25
+ # spec/support/* files are require'd from inside the each_run block.)
26
+ #
27
+ # Any code that is left outside the two blocks will be run during preforking
28
+ # *and* during each_run -- that's probably not what you want.
29
+ #
30
+ # These instructions should self-destruct in 10 seconds. If they don't, feel
31
+ # free to delete them.
32
+
33
+ Spork.prefork do
34
+ # Loading more in this block will cause your tests to run faster. However,
35
+ # if you change any configuration or code from libraries loaded here, you'll
36
+ # need to restart spork for it take effect.
37
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
38
+ # ENV["RAILS_ENV"] ||= 'test'
39
+ require File.expand_path("../../config/environment", __FILE__)
40
+ require 'rspec/rails'
41
+
42
+ # Requires supporting ruby files with custom matchers and macros, etc,
43
+ # in spec/support/ and its subdirectories.
44
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
45
+
46
+ RSpec.configure do |config|
47
+ # == Mock Framework
48
+ #
49
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
50
+ #
51
+ # config.mock_with :mocha
52
+ # config.mock_with :flexmock
53
+ # config.mock_with :rr
54
+ config.mock_with :rspec
35
55
 
36
- config.after(:each) do
37
- DatabaseCleaner.clean
56
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
57
+ # config.fixture_path = "#{::Rails.root}/spec/fixtures"
58
+
59
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
60
+ # examples within a transaction, remove the following line or assign false
61
+ # instead of true.
62
+ # config.use_transactional_fixtures = true
63
+
64
+ config.before(:suite) do
65
+ DatabaseCleaner.strategy = <%= using_mongoid? ? ':truncation' : ':transaction' %>
66
+ end
67
+
68
+ config.before(:each) do
69
+ DatabaseCleaner.start
70
+ end
71
+
72
+ config.after(:each) do
73
+ DatabaseCleaner.clean
74
+ end
38
75
  end
39
-
76
+
40
77
  end
41
78
 
42
- def stub_authenticate_user
43
- controller.stub(:authenticate_user!).and_return(true)
79
+ Spork.each_run do
80
+ # This code will be run each time you run your specs.
81
+
44
82
  end