Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Prevents the generator from emptying spec/acceptance when running 'ra…

…ils destroy steak:spec'.
  • Loading branch information...
commit 7ae73db162d0726448aa0656d01aaf0c7cb8fe6e 1 parent 10a5108
@jcxplorer jcxplorer authored
View
5 lib/rspec-2/rails/generators/spec_generator.rb
@@ -18,7 +18,10 @@ class SpecGenerator < Rails::Generators::NamedBase
DESC
def manifest
- empty_directory File.join('spec/acceptance', class_path)
+ if behavior == :invoke
+ empty_directory File.join('spec/acceptance', class_path)
+ end
+
file_name.gsub!(/_spec$/, "")
@feature_name = file_name.titleize
View
14 spec/acceptance/rspec-2/steak_spec_generator_spec.rb
@@ -60,4 +60,18 @@
File.exist?(file_path).should be_true
File.read(file_path).should include("/../acceptance_helper")
end
+
+ scenario "Removing an acceptance spec" do
+ Dir.chdir @rails_app do
+ run "rails generate steak:spec document_creation"
+ run "rails destroy steak:spec document_creation"
+ end
+
+ spec_dir = @rails_app + "/spec/acceptance/"
+
+ File.exist?(spec_dir + "document_creation_spec.rb").should be_false
+ File.exist?(spec_dir + "acceptance_helper.rb").should be_true
+ File.exist?(spec_dir + "support/helpers.rb").should be_true
+ File.exist?(spec_dir + "support/paths.rb").should be_true
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.