-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
job_generator_spec.rb
30 lines (23 loc) · 1013 Bytes
/
job_generator_spec.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
# Generators are not automatically loaded by Rails
require 'generators/rspec/job/job_generator'
require 'support/generators'
RSpec.describe Rspec::Generators::JobGenerator, type: :generator, skip: !RSpec::Rails::FeatureCheck.has_active_job? do
setup_default_destination
describe 'the generated files' do
before { run_generator [file_name] }
context 'with file_name without job as suffix' do
let(:file_name) { 'user' }
subject { file('spec/jobs/user_job_spec.rb') }
it { is_expected.to exist }
it { is_expected.to contain(/require 'rails_helper'/) }
it { is_expected.to contain(/describe UserJob, #{type_metatag(:job)}/) }
end
context 'with file_name with job as suffix' do
let(:file_name) { 'user_job' }
subject { file('spec/jobs/user_job_spec.rb') }
it { is_expected.to exist }
it { is_expected.to contain(/require 'rails_helper'/) }
it { is_expected.to contain(/describe UserJob, #{type_metatag(:job)}/) }
end
end
end