-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrspec_generator.rb
37 lines (33 loc) · 1.3 KB
/
rspec_generator.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
require_relative '../../../bundler_helpers'
module Rolemodel
module Testing
class RspecGenerator < Rails::Generators::Base
include Rolemodel::BundlerHelpers
source_root File.expand_path('templates', __dir__)
def install_rspec
gem_group :development, :test do
gem 'rspec-rails'
end
run_bundle
gem_group :test do
gem 'capybara'
gem 'webdrivers'
end
run_bundle
end
def add_spec_files
template 'rails_helper.rb', 'spec/rails_helper.rb'
template 'spec_helper.rb', 'spec/spec_helper.rb'
template '.rspec', '.rspec'
template 'support/capybara_drivers.rb', 'spec/support/capybara_drivers.rb'
template 'support/capybara_testid.rb', 'spec/support/capybara_testid.rb'
template 'support/helpers/action_cable_helper.rb', 'spec/support/helpers/action_cable_helper.rb'
template 'support/helpers/select_helper.rb', 'spec/support/helpers/select_helper.rb'
template 'support/helpers/test_element_helper.rb', 'spec/support/helpers/test_element_helper.rb'
template 'support/helpers.rb', 'spec/support/helpers.rb'
template 'support/webpacker.rb', 'spec/support/webpacker.rb'
append_file '.gitignore', 'spec/examples.txt'
end
end
end
end