Skip to content

Commit

Permalink
added env.rb items for require_all
Browse files Browse the repository at this point in the history
  • Loading branch information
cheezy committed Oct 27, 2011
1 parent 2f67f39 commit 3d03649
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
10 changes: 9 additions & 1 deletion features/with_lib_option.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@ Feature: Adding the --with-lib flag
Scenario: Adding the require_all gem to Gemfile
Then a file named "sample/Gemfile" should exist
And the file "sample/Gemfile" should contain "gem 'require_all'"
And the file "sample/Gemfile" should contain "require_all 'lib'"

Scenario: Creating the lib directory
Then a directory named "sample/lib" should exist

Scenario: Creating the pages directory in lib
Then a directory named "sample/lib/pages" should exist

Scenario: Adding lib to loadpath in env.rb
Then a file named "sample/features/support/env.rb" should exist
And the file "sample/features/support/env.rb" should contain "$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../../', 'lib'))"

Scenario: Adding require_all stuff to the env.rb
Then a file named "sample/features/support/env.rb" should exist
And the file "sample/features/support/env.rb" should contain "require 'require_all'"
And the file "sample/features/support/env.rb" should contain "require_all 'lib'"

2 changes: 0 additions & 2 deletions lib/testgen/generators/project/Gemfile.tt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@ gem 'page-object'
<% end -%>
<% if with_lib == 'true' -%>
gem 'require_all'

require_all 'lib'
<% end -%>

9 changes: 9 additions & 0 deletions lib/testgen/generators/project/env.rb.tt
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
<% if with_lib == 'true' -%>
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../../', 'lib'))
<% end -%>

require 'rspec-expectations'
<% unless pageobject_driver.downcase == 'none' -%>
require 'page-object'
require 'page-object/page_factory'
<% end %>
<% if with_lib == 'true' -%>
require 'require_all'

require_all 'lib'
<% end -%>


<% unless pageobject_driver.downcase == 'none' -%>
Expand Down

0 comments on commit 3d03649

Please sign in to comment.