diff --git a/spec/integration/solved_spec.rb b/spec/integration/solved_spec.rb index 9a65f76..a6769a2 100644 --- a/spec/integration/solved_spec.rb +++ b/spec/integration/solved_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" RSpec.describe "Managing Posts solved status" do - let(:topic) { Fabricate(:topic) } + let(:topic) { Fabricate(:topic_with_op) } fab!(:user) { Fabricate(:trust_level_4) } let(:p1) { Fabricate(:post, topic: topic) } @@ -238,7 +238,7 @@ RSpec.describe "Managing Posts solved status" do it "gives priority to category's solved_topics_auto_close_hours setting" do freeze_time custom_auto_close_category = Fabricate(:category) - topic_2 = Fabricate(:topic, category: custom_auto_close_category) + topic_2 = Fabricate(:topic_with_op, category: custom_auto_close_category) post_2 = Fabricate(:post, topic: topic_2) custom_auto_close_category.custom_fields["solved_topics_auto_close_hours"] = 4 custom_auto_close_category.save_custom_fields diff --git a/spec/lib/guardian_extensions_spec.rb b/spec/lib/guardian_extensions_spec.rb index a3354b5..1ac6f99 100644 --- a/spec/lib/guardian_extensions_spec.rb +++ b/spec/lib/guardian_extensions_spec.rb @@ -5,7 +5,7 @@ require "rails_helper" describe DiscourseSolved::GuardianExtensions do fab!(:user) { Fabricate(:user, refresh_auto_groups: true) } fab!(:other_user) { Fabricate(:user, refresh_auto_groups: true) } - fab!(:topic) + fab!(:topic) { Fabricate(:topic_with_op) } fab!(:post) { Fabricate(:post, topic: topic, user: other_user) } let(:guardian) { user.guardian } @@ -17,9 +17,10 @@ describe DiscourseSolved::GuardianExtensions do expect(Guardian.new.can_accept_answer?(topic, post)).to eq(false) end - it "returns false if the topic is nil, the post is nil, or for whispers" do + it "returns false if the topic is nil, the post is nil, for the first post or for whispers" do expect(guardian.can_accept_answer?(nil, post)).to eq(false) expect(guardian.can_accept_answer?(topic, nil)).to eq(false) + expect(guardian.can_accept_answer?(topic, topic.first_post)).to eq(false) post.update!(post_type: Post.types[:whisper]) expect(guardian.can_accept_answer?(topic, post)).to eq(false)