spec for posts:remap rake task

This commit is contained in:
Arpit Jalan 2017-01-28 00:12:39 +05:30
parent e3670c52fa
commit c36dda70ae
1 changed files with 17 additions and 0 deletions

17
spec/tasks/posts_spec.rb Normal file
View File

@ -0,0 +1,17 @@
require 'rails_helper'
RSpec.describe "Post rake tasks" do
before do
Discourse::Application.load_tasks
end
describe 'remap' do
it 'should remap posts' do
post = Fabricate(:post, raw: "The quick brown fox jumps over the lazy dog")
Rake::Task['posts:remap'].invoke("brown","red")
post.reload
expect(post.raw).to eq('The quick red fox jumps over the lazy dog')
end
end
end