Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit e86668e

Browse files
committed
Update spec for #expected_status_code_after_store
1 parent 4d24161 commit e86668e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

spec/wordpress/stored_xss_spec.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,17 @@
4242
end
4343
end
4444

45+
describe '#expected_status_code_after_store' do
46+
it 'returns 200 by default' do
47+
expect(subject.expected_status_code_after_store).to eq 200
48+
end
49+
end
50+
4551
describe '#store_script_and_validate' do
46-
it 'returns false if the response has a code !== 200' do
52+
it 'returns false if the response does not match the return value of #expected_status_code_after_store' do
4753
typhoeus_res = Typhoeus::Response.new
4854
allow(typhoeus_res).to receive(:code).and_return(404)
55+
allow(subject).to receive(:expected_status_code_after_store).and_return(200)
4956
allow(subject).to receive(:store_script).and_return(Wpxf::Net::HttpResponse.new(typhoeus_res))
5057
expect(subject.store_script_and_validate).to be false
5158
end
@@ -55,9 +62,10 @@
5562
expect(subject.store_script_and_validate).to be false
5663
end
5764

58-
it 'returns true if the response code is 200' do
65+
it 'returns true if the response code matches the return value of #expected_status_code_after_store' do
5966
typhoeus_res = Typhoeus::Response.new
6067
allow(typhoeus_res).to receive(:code).and_return(200)
68+
allow(subject).to receive(:expected_status_code_after_store).and_return(200)
6169
allow(subject).to receive(:store_script).and_return(Wpxf::Net::HttpResponse.new(typhoeus_res))
6270
expect(subject.store_script_and_validate).to be true
6371
end

0 commit comments

Comments
 (0)