about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorysksn <bluewhale1982@gmail.com>2019-07-27 17:24:26 +0900
committerEugen Rochko <eugen@zeonfederated.com>2019-07-27 10:24:26 +0200
commitd6ada2eb30a2e73b71d8ef037d3764ff006fb745 (patch)
tree0312893d2c1838e70313ed94d78ab7d94c5d9ea3 /spec
parent8a4674f2c3d89c998eb5438b96b7977dc2be3167 (diff)
Implement pending tests (#11415)
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/spam_check_spec.rb28
-rw-r--r--spec/models/poll_vote_spec.rb10
2 files changed, 36 insertions, 2 deletions
diff --git a/spec/lib/spam_check_spec.rb b/spec/lib/spam_check_spec.rb
index c722dc642..9e0989216 100644
--- a/spec/lib/spam_check_spec.rb
+++ b/spec/lib/spam_check_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe SpamCheck do
@@ -133,7 +135,31 @@ RSpec.describe SpamCheck do
   end
 
   describe '#remember!' do
-    pending
+    let(:status) { status_with_html('@alice') }
+    let(:spam_check) { described_class.new(status) }
+    let(:redis_key) { spam_check.send(:redis_key) }
+
+    it 'remembers' do
+      expect do
+        spam_check.remember!
+      end.to change { Redis.current.exists(redis_key) }.from(false).to(true)
+    end
+  end
+
+  describe '#reset!' do
+    let(:status) { status_with_html('@alice') }
+    let(:spam_check) { described_class.new(status) }
+    let(:redis_key) { spam_check.send(:redis_key) }
+
+    before do
+      spam_check.remember!
+    end
+
+    it 'resets' do
+      expect do
+        spam_check.reset!
+      end.to change { Redis.current.exists(redis_key) }.from(true).to(false)
+    end
   end
 
   describe '#flag!' do
diff --git a/spec/models/poll_vote_spec.rb b/spec/models/poll_vote_spec.rb
index 354afd535..563f34699 100644
--- a/spec/models/poll_vote_spec.rb
+++ b/spec/models/poll_vote_spec.rb
@@ -1,5 +1,13 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe PollVote, type: :model do
-  pending "add some examples to (or delete) #{__FILE__}"
+  describe '#object_type' do
+    let(:poll_vote) { Fabricate.build(:poll_vote) }
+
+    it 'returns :vote' do
+      expect(poll_vote.object_type).to eq :vote
+    end
+  end
 end