Permalink
Browse files

Runner runs all specs in spec/ by default

  • Loading branch information...
1 parent 4d43184 commit adf3f95e6e3da930e081171419fa6dbe7987b040 @txus committed Nov 13, 2010
Showing with 45 additions and 2 deletions.
  1. +37 −0 features/cli.feature
  2. +8 −2 lib/stendhal/autorun.rb
View
@@ -0,0 +1,37 @@
+Feature: Command line interpreter
+
+ Stendhal runs by default all *_spec.rb files inside a spec/ folder,
+ unless you specify which specs have to be runned.
+
+ Scenario: with no arguments
+ 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"
+ Then the exit status should be 0
+ And the output should contain "3 examples, 0 failures"
View
@@ -1,7 +1,13 @@
-ARGV.each do |file|
- require File.join('.',file)
+unless ARGV.empty?
+ ARGV.each do |file|
+ require File.join('.',file)
+ end
+else
+ Dir['spec/**/*_spec.rb'].entries.each do |entry|
+ require File.join('.', entry)
+ end
end
examples, failures, pending = Stendhal::ExampleGroup.run_all

0 comments on commit adf3f95

Please sign in to comment.