Last active
June 5, 2020 12:02
-
-
Save sergio-fry/6e06d88907d00957fa420b124eb1c1d3 to your computer and use it in GitHub Desktop.
RSpec rake support module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| APP_RAKEFILE = Rails.root.join('Rakefile') | |
| module Support | |
| module RakeHelpers | |
| extend ActiveSupport::Concern | |
| def rake(task) | |
| Rake::Task[task].reenable | |
| Rake.application.invoke_task(task) | |
| end | |
| included do | |
| RSpec.configure do |config| | |
| config.before type: :rake do | |
| require 'rake' | |
| load 'rails/tasks/engine.rake' | |
| end | |
| end | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RSpec.describe 'My task', type: :rake do | |
| it 'works' do | |
| rake 'app:my:task' | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment