Skip to content

Commit c6e220a

Browse files
committed
[FEATURE] Add spec directory scaffolding to app generator
1 parent 1d4e302 commit c6e220a

File tree

5 files changed

+31
-1
lines changed

5 files changed

+31
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# [develop](https://github.com/adhearsion/adhearsion)
22
* Feature: `Call#execute_controller` now takes a post-execution callback (proc)
3+
* Feature: App generator now includes directory scaffolding for call controller specs and a sample `spec_helper.rb`
34
* Bugfix: Calls should be hung up when router executed controllers complete, not after everything executed by `Call#execute_controller`
45
* Bugfix: Deal with race conditions raising exceptions when hanging up calls after a controller executes
56

features/app_generator.feature

+5
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@ Feature: Adhearsion App Generator
1010
| lib |
1111
| config |
1212
| script |
13+
| spec |
14+
| spec/call_controllers |
15+
| spec/support |
1316

1417
And the following files should exist:
1518
| .gitignore |
19+
| .rspec |
1620
| config/adhearsion.rb |
1721
| config/environment.rb |
1822
| Gemfile |
1923
| lib/simon_game.rb |
2024
| script/ahn |
25+
| spec/spec_helper.rb |
2126
| README.md |
2227
| Rakefile |
2328
| Procfile |

lib/adhearsion/generators/app/app_generator.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ module Adhearsion
44
module Generators
55
class AppGenerator < Generator
66

7-
BASEDIRS = %w( config lib script )
7+
BASEDIRS = %w( config lib script spec )
8+
EMPTYDIRS = %w( spec/call_controllers spec/support )
89

910
def setup_project
1011
self.destination_root = @generator_name
1112
BASEDIRS.each { |dir| directory dir }
13+
EMPTYDIRS.each { |dir| empty_directory dir }
1214
template "Gemfile.erb", "Gemfile"
1315
copy_file "gitignore", ".gitignore"
16+
copy_file "rspec", ".rspec"
1417
copy_file "Procfile"
1518
copy_file "Rakefile"
1619
copy_file "README.md"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--colour
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
ENV["AHN_ENV"] ||= 'test'
2+
require File.expand_path("../../config/environment", __FILE__)
3+
require 'rspec/autorun'
4+
5+
# Requires supporting ruby files with custom matchers and macros, etc,
6+
# in spec/support/ and its subdirectories.
7+
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each { |f| require f }
8+
9+
RSpec.configure do |config|
10+
# ## Mock Framework
11+
#
12+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
13+
#
14+
# config.mock_with :mocha
15+
# config.mock_with :flexmock
16+
# config.mock_with :rr
17+
18+
config.filter_run :focus => true
19+
config.run_all_when_everything_filtered = true
20+
end

0 commit comments

Comments
 (0)