forked from rspec/rspec-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rspec.rb
44 lines (40 loc) · 1 KB
/
rspec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
require 'rails/generators/named_base'
require 'rspec/rails/feature_check'
# Weirdly named generators namespace (should be `RSpec`) for compatability with
# rails loading.
module Rspec
# @private
module Generators
# @private
class Base < ::Rails::Generators::NamedBase
include RSpec::Rails::FeatureCheck
def self.source_root(path = nil)
if path
@_rspec_source_root = path
else
@_rspec_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'rspec', generator_name, 'templates'))
end
end
if ::Rails::VERSION::STRING < '3.1'
def module_namespacing
yield if block_given?
end
end
end
end
end
# @private
module Rails
module Generators
# @private
class GeneratedAttribute
def input_type
@input_type ||= if type == :text
"textarea"
else
"input"
end
end
end
end
end