Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Runner fix

  • Loading branch information...
commit 3c7cc885504d5a1ed2fd8050097549f7d4a79bcd 1 parent af40086
@txus authored
Showing with 41 additions and 1 deletion.
  1. +33 −0 features/cli.feature
  2. +8 −1 lib/stendhal/autorun.rb
View
33 features/cli.feature
@@ -36,6 +36,39 @@ Feature: Command line interpreter
Then the exit status should be 0
And the output should contain "3 examples, 0 failures"
+ Scenario: with a directory
+ Given a directory named "stendhal_project"
+ And I cd to "stendhal_project"
+ And a directory named "spec"
+ And a directory named "spec/nested"
+ Given a file named "spec/sample_spec.rb" with:
+ """
+ describe "something" do
+ it "does something" do
+ # put your code here
+ end
+ end
+ """
+ And a file named "spec/another_sample_spec.rb" with:
+ """
+ describe "something" do
+ it "does something" do
+ # put your code here
+ end
+ end
+ """
+ And a file named "spec/nested/a_nested_spec.rb" with:
+ """
+ describe "something" do
+ it "does something" do
+ # put your code here
+ end
+ end
+ """
+ When I run "stendhal spec"
+ And the output should contain "3 examples, 0 failures"
+ Then the exit status should be 0
+
Scenario: specifying files to be run
Given a directory named "stendhal_project"
And I cd to "stendhal_project"
View
9 lib/stendhal/autorun.rb
@@ -1,8 +1,15 @@
+
unless ARGV.empty?
ARGV.each do |file|
- require File.join('.',file)
+ if Dir["#{file}/*"].empty?
+ require File.join('.',file)
+ else
+ Dir["#{file}/**/*_spec.rb"].entries.each do |entry|
+ require File.join('.', entry)
+ end
+ end
end
else
Dir['spec/**/*_spec.rb'].entries.each do |entry|
Please sign in to comment.
Something went wrong with that request. Please try again.