Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[FEATURE] Add spec directory scaffolding to app generator

  • Loading branch information...
commit c6e220a756504c3989ba4907f4e26fb5e27becaa 1 parent 1d4e302
@benlangfeld benlangfeld authored
View
1  CHANGELOG.md
@@ -1,5 +1,6 @@
# [develop](https://github.com/adhearsion/adhearsion)
* Feature: `Call#execute_controller` now takes a post-execution callback (proc)
+ * Feature: App generator now includes directory scaffolding for call controller specs and a sample `spec_helper.rb`
* Bugfix: Calls should be hung up when router executed controllers complete, not after everything executed by `Call#execute_controller`
* Bugfix: Deal with race conditions raising exceptions when hanging up calls after a controller executes
View
5 features/app_generator.feature
@@ -10,14 +10,19 @@ Feature: Adhearsion App Generator
| lib |
| config |
| script |
+ | spec |
+ | spec/call_controllers |
+ | spec/support |
And the following files should exist:
| .gitignore |
+ | .rspec |
| config/adhearsion.rb |
| config/environment.rb |
| Gemfile |
| lib/simon_game.rb |
| script/ahn |
+ | spec/spec_helper.rb |
| README.md |
| Rakefile |
| Procfile |
View
5 lib/adhearsion/generators/app/app_generator.rb
@@ -4,13 +4,16 @@ module Adhearsion
module Generators
class AppGenerator < Generator
- BASEDIRS = %w( config lib script )
+ BASEDIRS = %w( config lib script spec )
+ EMPTYDIRS = %w( spec/call_controllers spec/support )
def setup_project
self.destination_root = @generator_name
BASEDIRS.each { |dir| directory dir }
+ EMPTYDIRS.each { |dir| empty_directory dir }
template "Gemfile.erb", "Gemfile"
copy_file "gitignore", ".gitignore"
+ copy_file "rspec", ".rspec"
copy_file "Procfile"
copy_file "Rakefile"
copy_file "README.md"
View
1  lib/adhearsion/generators/app/templates/rspec
@@ -0,0 +1 @@
+--colour
View
20 lib/adhearsion/generators/app/templates/spec/spec_helper.rb
@@ -0,0 +1,20 @@
+ENV["AHN_ENV"] ||= 'test'
+require File.expand_path("../../config/environment", __FILE__)
+require 'rspec/autorun'
+
+# Requires supporting ruby files with custom matchers and macros, etc,
+# in spec/support/ and its subdirectories.
+Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each { |f| require f }
+
+RSpec.configure do |config|
+ # ## Mock Framework
+ #
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
+ #
+ # config.mock_with :mocha
+ # config.mock_with :flexmock
+ # config.mock_with :rr
+
+ config.filter_run :focus => true
+ config.run_all_when_everything_filtered = true
+end
Please sign in to comment.
Something went wrong with that request. Please try again.