Testing rake tasks with rspec
This blog post is a continuation of this thread. On trying to write a spec for one of the rake tasks, when trying to invoke the same rake tasks within the same @rspec contexts, for different flows, weirdly the tests failed if I ran the whole suite, but would pass if I ran them separately. — Tasdik Rahman (@tasdikrahman) August 12, 2020 So for example # ./lib/tasks/foo_task.rake desc 'Foo task' namespace :task do task :my_task, [:foo, :bar] => [:baz] do |task, args| ... # does my_task ... end end Now if we try writing a spec a for it ...