Skip to content

Commit a3294db

Browse files
committed
Review updates - update! and fake group fabrication
1 parent a5ccdb0 commit a3294db

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

spec/lib/guardian_extension_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
let(:guardian) { Guardian.new(user) }
8686

8787
it "returns false when the post user is not in restrict_translation_by_poster_group" do
88-
SiteSetting.restrict_translation_by_poster_group = "#{group.id + 1}"
88+
SiteSetting.restrict_translation_by_poster_group = "#{Fabricate(:group).id}"
8989

9090
expect(guardian.can_detect_language?(post)).to eq(false)
9191
end
@@ -101,15 +101,15 @@
101101
end
102102

103103
it "returns false when the post is a small action post" do
104-
post.update(post_type: Post.types[:small_action])
104+
post.update!(post_type: Post.types[:small_action])
105105

106106
expect(guardian.can_detect_language?(post)).to eq(false)
107107
end
108108

109109
it "returns false when the post raw is empty" do
110-
post.update(raw: "")
111-
112-
expect(guardian.can_detect_language?(post)).to eq(false)
110+
expect { post.update(raw: "") }.to change { guardian.can_detect_language?(post) }.from(
111+
true,
112+
).to(false)
113113
end
114114
end
115115
end

0 commit comments

Comments
 (0)