Permalink
Browse files

Remove Diesel dependency

+ Updated installer to remove Diesel
+ Added new templates for generating features
+ Removed unused step definitions
  • Loading branch information...
harlow committed Oct 12, 2012
1 parent 0cc57b7 commit 337ba1b5e0405f1e55f845615e1b78db74645807
Showing with 304 additions and 118 deletions.
  1. +1 −4 Gemfile.lock
  2. +0 −1 Rakefile
  3. +0 −1 clearance.gemspec
  4. +7 −0 features/step_definitions/gem_file_steps.rb
  5. +8 −18 features/support/env.rb
  6. +1 −4 gemfiles/3.0.17.gemfile.lock
  7. +1 −4 gemfiles/3.1.8.gemfile.lock
  8. +1 −4 gemfiles/3.2.8.gemfile.lock
  9. +0 −9 features/support/clearance.rb → lib/clearance/testing/app/controllers/application_controller.rb
  10. +46 −0 lib/clearance/testing/application.rb
  11. +11 −0 lib/clearance/testing/config/database.yml
  12. +3 −0 lib/clearance/testing/config/routes.rb
  13. +5 −0 lib/generators/clearance/features/USAGE
  14. +11 −2 lib/generators/clearance/features/features_generator.rb
  15. 0 ...→ lib/generators/clearance/features/templates/features/clearance}/visitor_resets_password.feature
  16. 0 ...engine → lib/generators/clearance/features/templates/features/clearance}/visitor_signs_in.feature
  17. 0 ...ngine → lib/generators/clearance/features/templates/features/clearance}/visitor_signs_out.feature
  18. 0 ...engine → lib/generators/clearance/features/templates/features/clearance}/visitor_signs_up.feature
  19. 0 ...ngine → lib/generators/clearance/features/templates/features/step_definitions}/clearance_steps.rb
  20. +10 −0 lib/generators/clearance/features/templates/spec/factories/clearance.rb
  21. +103 −22 lib/generators/clearance/install/install_generator.rb
  22. +14 −7 lib/generators/clearance/install/templates/README
  23. +21 −0 lib/generators/clearance/install/templates/db/migrate/add_clearance_to_users.rb
  24. +18 −0 lib/generators/clearance/install/templates/db/migrate/create_users.rb
  25. +0 −37 lib/generators/clearance/install/templates/db/migrate/upgrade_clearance_to_diesel.rb
  26. +15 −0 lib/generators/clearance/views/USAGE
  27. +23 −2 lib/generators/clearance/views/views_generator.rb
  28. +5 −3 spec/spec_helper.rb
View
@@ -3,7 +3,6 @@ PATH
specs:
clearance (1.0.0.rc2)
bcrypt-ruby
- diesel (= 0.1.5)
rails (>= 3.0)
GEM
@@ -69,8 +68,6 @@ GEM
cucumber (>= 1.1.0)
nokogiri (>= 1.5.0)
database_cleaner (0.8.0)
- diesel (0.1.5)
- railties
diff-lcs (1.1.3)
erubis (2.7.0)
factory_girl (3.5.0)
@@ -152,7 +149,7 @@ GEM
thor (0.15.4)
tilt (1.3.3)
timecop (0.3.5)
- treetop (1.4.10)
+ treetop (1.4.11)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.33)
View
@@ -5,7 +5,6 @@ require 'bundler/setup'
require 'bundler/gem_tasks'
require 'rake'
-require 'diesel/tasks'
require 'cucumber/rake/task'
require 'rspec/core/rake_task'
require 'appraisal'
View
@@ -23,7 +23,6 @@ Gem::Specification.new do |s|
s.required_ruby_version = Gem::Requirement.new('>= 1.9.2')
s.add_dependency 'bcrypt-ruby'
- s.add_dependency 'diesel', '0.1.5'
s.add_dependency 'rails', '>= 3.0'
s.add_development_dependency 'appraisal', '0.4.1'
s.add_development_dependency 'aruba', '0.4.11'
@@ -0,0 +1,7 @@
+When /^I add the "([^"]*)" gem$/ do |gem_name|
+ append_to_file('Gemfile', %{\ngem "#{gem_name}"\n})
+end
+
+When /^I add the "([^"]*)" gem from this project$/ do |gem_name|
+ append_to_file('Gemfile', %{\ngem "#{gem_name}", :path => "../../.."\n})
+end
View
@@ -1,35 +1,25 @@
-# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
-# It is recommended to regenerate this file in the future when you upgrade to a
-# newer version of cucumber-rails. Consider adding your own code to a new file
-# instead of editing this one. Cucumber will automatically load all features/**/*.rb
-# files.
-
ENV['RAILS_ENV'] ||= 'test'
PROJECT_ROOT = File.expand_path('../../..', __FILE__)
$LOAD_PATH << File.join(PROJECT_ROOT, 'lib')
require 'rails/all'
+require 'rails/test_help'
Bundler.require
-require 'diesel/testing'
-require 'diesel/testing/integration'
-require 'cucumber/rails/application'
+require 'aruba/cucumber'
+require 'clearance/testing/application'
require 'cucumber/rails/action_controller'
-require 'rails/test_help'
-require 'cucumber/rails/world'
-require 'cucumber/rails/hooks'
+require 'cucumber/rails/application'
require 'cucumber/rails/capybara'
+require 'cucumber/rails/hooks'
+require 'cucumber/rails/world'
-# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
-# order to ease the transition to Capybara we set the default here. If you'd
-# prefer to use XPath just remove this line and adjust any selectors in your
-# steps to use the XPath syntax.
+ActionController::Base.allow_rescue = false
Capybara.default_selector = :css
Capybara.save_and_open_page_path = 'tmp'
-
-ActionController::Base.allow_rescue = false
+Clearance::Testing::Application.initialize!
begin
DatabaseCleaner.strategy = :transaction
@@ -1,9 +1,8 @@
PATH
- remote: /Users/croaky/dev/clearance
+ remote: /Users/harlow/Sites/clearance
specs:
clearance (1.0.0.rc2)
bcrypt-ruby
- diesel (= 0.1.5)
rails (>= 3.0)
GEM
@@ -69,8 +68,6 @@ GEM
cucumber (>= 1.1.0)
nokogiri (>= 1.5.0)
database_cleaner (0.8.0)
- diesel (0.1.5)
- railties
diff-lcs (1.1.3)
erubis (2.6.6)
abstract (>= 1.0.0)
@@ -1,9 +1,8 @@
PATH
- remote: /Users/croaky/dev/clearance
+ remote: /Users/harlow/Sites/clearance
specs:
clearance (1.0.0.rc2)
bcrypt-ruby
- diesel (= 0.1.5)
rails (>= 3.0)
GEM
@@ -70,8 +69,6 @@ GEM
cucumber (>= 1.1.0)
nokogiri (>= 1.5.0)
database_cleaner (0.8.0)
- diesel (0.1.5)
- railties
diff-lcs (1.1.3)
erubis (2.7.0)
factory_girl (3.5.0)
@@ -1,9 +1,8 @@
PATH
- remote: /Users/croaky/dev/clearance
+ remote: /Users/harlow/Sites/clearance
specs:
clearance (1.0.0.rc2)
bcrypt-ruby
- diesel (= 0.1.5)
rails (>= 3.0)
GEM
@@ -69,8 +68,6 @@ GEM
cucumber (>= 1.1.0)
nokogiri (>= 1.5.0)
database_cleaner (0.8.0)
- diesel (0.1.5)
- railties
diff-lcs (1.1.3)
erubis (2.7.0)
factory_girl (3.5.0)
@@ -1,16 +1,7 @@
-require 'clearance'
-
-Clearance.configure do |config|
-end
-
class ApplicationController < ActionController::Base
include Clearance::Authentication
def show
render :text => '', :layout => 'application'
end
end
-
-class User < ActiveRecord::Base
- include Clearance::User
-end
@@ -0,0 +1,46 @@
+require 'rails/all'
+
+module Clearance
+ module Testing
+ APP_ROOT = File.expand_path('..', __FILE__).freeze
+
+ class Application < Rails::Application
+ config.encoding = "utf-8"
+ config.action_mailer.default_url_options = { :host => 'localhost' }
+
+ if Rails::VERSION::MAJOR >= 3 && Rails::VERSION::MINOR >= 1
+ config.paths['config/database'] = "#{APP_ROOT}/config/database.yml"
+ config.paths['config/routes'] << "#{APP_ROOT}/config/routes.rb"
+ config.paths['app/controllers'] << "#{APP_ROOT}/app/controllers"
+ config.paths['app/views'] << "#{APP_ROOT}/app/views"
+ config.paths['log'] = "tmp/log/development.log"
+ config.assets.enabled = true
+ else
+ config.paths.config.database = "#{APP_ROOT}/config/database.yml"
+ config.paths.config.routes << "#{APP_ROOT}/config/routes.rb"
+ config.paths.app.controllers << "#{APP_ROOT}/app/controllers"
+ config.paths.app.views << "#{APP_ROOT}/app/views"
+ config.paths.log = "tmp/log"
+ end
+
+ config.cache_classes = true
+ config.whiny_nils = true
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+ config.action_dispatch.show_exceptions = false
+ config.action_controller.allow_forgery_protection = false
+ config.action_mailer.delivery_method = :test
+ config.active_support.deprecation = :stderr
+ config.secret_token = "SECRET_TOKEN_IS_MIN_30_CHARS_LONG"
+
+ def require_environment!
+ initialize!
+ end
+
+ def initialize!
+ FileUtils.mkdir_p(Rails.root.join("db").to_s)
+ super unless @initialized
+ end
+ end
+ end
+end
@@ -0,0 +1,11 @@
+development:
+ adapter: sqlite3
+ database: db/development.sqlite3
+ pool: 5
+ timeout: 5000
+
+test:
+ adapter: sqlite3
+ database: db/test.sqlite3
+ pool: 5
+ timeout: 5000
@@ -0,0 +1,3 @@
+Rails.application.routes.draw do
+ root :to => "application#show"
+end
@@ -0,0 +1,5 @@
+Description:
+ Generate Cucumber features and step definitions
+
+Examples:
+ rails generate clearance:cucumber_features
@@ -1,8 +1,17 @@
-require 'diesel/generators/features_base'
+require 'rails/generators/base'
module Clearance
module Generators
- class FeaturesGenerator < Diesel::Generators::FeaturesBase
+ class FeaturesGenerator < Rails::Generators::Base
+ source_root File.expand_path('../templates', __FILE__)
+
+ def create_features
+ directory 'features'
+ end
+
+ def create_factories
+ directory 'spec'
+ end
end
end
end
@@ -0,0 +1,10 @@
+FactoryGirl.define do
+ sequence :email do |n|
+ "user#{n}@example.com"
+ end
+
+ factory :user do
+ email
+ password "password"
+ end
+end
Oops, something went wrong.

0 comments on commit 337ba1b

Please sign in to comment.