Skip to content

Commit

Permalink
Remove Diesel dependency
Browse files Browse the repository at this point in the history
+ Updated installer to remove Diesel
+ Added new templates for generating features
+ Removed unused step definitions
  • Loading branch information
harlow committed Oct 15, 2012
1 parent 0cc57b7 commit 337ba1b
Show file tree
Hide file tree
Showing 28 changed files with 304 additions and 118 deletions.
5 changes: 1 addition & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ PATH
specs:
clearance (1.0.0.rc2)
bcrypt-ruby
diesel (= 0.1.5)
rails (>= 3.0)

GEM
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 0 additions & 1 deletion clearance.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
7 changes: 7 additions & 0 deletions features/step_definitions/gem_file_steps.rb
Original file line number Diff line number Diff line change
@@ -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
26 changes: 8 additions & 18 deletions features/support/env.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 1 addition & 4 deletions gemfiles/3.0.17.gemfile.lock
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions gemfiles/3.1.8.gemfile.lock
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions gemfiles/3.2.8.gemfile.lock
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
46 changes: 46 additions & 0 deletions lib/clearance/testing/application.rb
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions lib/clearance/testing/config/database.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions lib/clearance/testing/config/routes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Rails.application.routes.draw do
root :to => "application#show"
end
5 changes: 5 additions & 0 deletions lib/generators/clearance/features/USAGE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Description:
Generate Cucumber features and step definitions

Examples:
rails generate clearance:cucumber_features
13 changes: 11 additions & 2 deletions lib/generators/clearance/features/features_generator.rb
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FactoryGirl.define do
sequence :email do |n|
"user#{n}@example.com"
end

factory :user do
email
password "password"
end
end
Loading

0 comments on commit 337ba1b

Please sign in to comment.