lib/rspec/scaffold/generator.rb in rspec-scaffold-0.2.0 vs lib/rspec/scaffold/generator.rb in rspec-scaffold-0.2.1
- old
+ new
@@ -17,11 +17,11 @@
end
def perform
indent = (' ' * 2)
second_indent = indent * 2
- lines = [%Q(require "spec_helper"), %Q(), %Q(describe #{const} do)]
+ lines = [%Q(require "#{helper_file}"), %Q(), %Q(describe #{const} do)]
if class?
initialization_args.each do |arg|
lines << %Q(#{indent}let(:#{arg.to_s.sub(/^[&*]/, '')}) {})
end
lines << %Q()
@@ -41,9 +41,17 @@
end
lines << %Q(#{indent}end) << %Q()
end
lines << %Q(end) << %Q()
lines
+ end
+
+ def helper_file
+ if defined?(::Rails)
+ 'rails_helper'
+ else
+ 'spec_helper'
+ end
end
end
end
end