Add specs to check for upper maximum question length
This commit is contained in:
parent
b7e8187cd4
commit
70f6e581b6
|
@ -36,5 +36,13 @@ describe UseCase::Question::CreateFollowers do
|
|||
it "increments the asked count" do
|
||||
expect { subject }.to change { source_user.reload.asked_count }.by(1)
|
||||
end
|
||||
|
||||
context "content is over 32768 characters long" do
|
||||
let(:content) { "a" * 32769 }
|
||||
|
||||
it "raises an error" do
|
||||
expect { subject }.to raise_error(Errors::QuestionTooLong)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -75,6 +75,27 @@ describe UseCase::Question::Create do
|
|||
it_behaves_like "creates the question"
|
||||
end
|
||||
end
|
||||
|
||||
context "content is over 32768 characters long" do
|
||||
let(:content) { "a" * 32769 }
|
||||
|
||||
context "recipient does not allow long questions" do
|
||||
it "raises an error" do
|
||||
expect { subject }.to raise_error(Errors::QuestionTooLong)
|
||||
end
|
||||
end
|
||||
|
||||
context "recipient allows long questions" do
|
||||
before do
|
||||
target_user.profile.allow_long_questions = true
|
||||
target_user.profile.save
|
||||
end
|
||||
|
||||
it "raises an error" do
|
||||
expect { subject }.to raise_error(Errors::QuestionTooLong)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples "filters questions" do
|
||||
|
|
Loading…
Reference in New Issue