Skip to content

Instantly share code, notes, and snippets.

@da3mon
Created November 4, 2016 01:02
Show Gist options
  • Save da3mon/1d1da7effb86e5db634a0aaaf9407740 to your computer and use it in GitHub Desktop.
Save da3mon/1d1da7effb86e5db634a0aaaf9407740 to your computer and use it in GitHub Desktop.
require 'rspec'
describe 'flip flop ragerts' do
it 'matches stuff between the same thing' do
text = %{here's some {code} text that is gross {code} and shouldn't be done}
res = text.split.inject([]) { |a, t| a << t if t =~ /{code}/ ... t =~ /{code}/; a }.join(' ')
expect(res).to eq(%{{code} text that is gross {code}})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment