Guest User

Untitled

a guest
Mar 16th, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.72 KB | None | 0 0
  1. def strip_invisible_chars
  2.     Util::Strings.strip_control_chars(params)
  3.   end
  4.  
  5. describe '#strip_invisible_chars' do
  6.     let(:some) { {two: "three"} }
  7.  
  8.     subject { controller.send :strip_invisible_chars }
  9.  
  10.     context 'yes' do
  11.       let(:params) { {one: "two"} }
  12.      
  13.       before { allow(Util::Strings).to receive(:strip_control_chars).with(:params).and_return(:some) }
  14.       it 'returns result' do
  15.         byebug
  16.         expect(response.status).to eq 200
  17.       end
  18.     end
  19.  
  20.     context 'no' do
  21.       let(:params) {}
  22. before { allow(Util::Strings).to receive(:strip_control_chars).with(:params).and_return(false) }
  23.       it 'returns result' do
  24.         expect(response.status).to eq 400
  25.       end
  26.     end
  27.   end
Advertisement
Add Comment
Please, Sign In to add comment