From 0950dde8d03e00331c2a5382a4f5beec387ba5e3 Mon Sep 17 00:00:00 2001 From: Vikhyat Korrapati Date: Tue, 11 Mar 2014 16:54:12 +0530 Subject: [PATCH] Add a test to make sure the poll prefix translation can be a regex. --- plugins/poll/spec/poll_plugin/poll_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/poll/spec/poll_plugin/poll_spec.rb b/plugins/poll/spec/poll_plugin/poll_spec.rb index 9df558f3b..de4333352 100644 --- a/plugins/poll/spec/poll_plugin/poll_spec.rb +++ b/plugins/poll/spec/poll_plugin/poll_spec.rb @@ -14,6 +14,14 @@ describe PollPlugin::Poll do expect(poll.is_poll?).to be_false end + it "allows the prefix translation to contain regular expressions" do + topic.title = "Poll : This might be a poll" + topic.save + expect(PollPlugin::Poll.new(post).is_poll?).to be_false + I18n.expects(:t).with('poll.prefix').returns("Poll\\s?:") + expect(PollPlugin::Poll.new(post).is_poll?).to be_true + end + it "should get options correctly" do expect(poll.options).to eq(["Chitoge", "Onodera"]) end