From c36dda70aeb6e97efaf7ad0cb932df18f0281722 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Sat, 28 Jan 2017 00:12:39 +0530 Subject: [PATCH] spec for posts:remap rake task --- spec/tasks/posts_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 spec/tasks/posts_spec.rb diff --git a/spec/tasks/posts_spec.rb b/spec/tasks/posts_spec.rb new file mode 100644 index 00000000000..a1c1dac7b66 --- /dev/null +++ b/spec/tasks/posts_spec.rb @@ -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