Skip to content

Commit

Permalink
chore: test rails 4.0 - 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
TamarinEA committed Sep 23, 2019
1 parent eec174c commit 2054e2a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
appraise 'rails3.2' do
gem 'actionpack', '~> 3.2.0'
gem 'activesupport', '~> 3.2.0'
end

appraise 'rails4.0' do
gem 'actionpack', '~> 4.0.0'
gem 'activesupport', '~> 4.0.0'
end

appraise 'rails4.1' do
gem 'actionpack', '~> 4.1.0'
gem 'activesupport', '~> 4.1.0'
end

appraise 'rails4.2' do
gem 'actionpack', '~> 4.2.0'
gem 'activesupport', '~> 4.2.0'
end
1 change: 1 addition & 0 deletions lib/string_tools/core_ext/string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require 'active_support/version'
require 'action_pack'
require 'string_tools/string'
require 'action_controller'

class String
%w[auto_link excerpt highlight sanitize simple_format word_wrap].each do |method|
Expand Down
19 changes: 19 additions & 0 deletions spec/string_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,23 @@

it { expect { string.remove_nonprintable! }.to change { string }.to('string with weird characters') }
end

describe '#strip_tags' do
{
'some<dev>text</dev>' => 'sometext',
'some<a href="link">text</a>' => 'sometext',
'1 & 2 + 3 < 5 > 6' => '1 & 2 + 3 < 5 > 6',
'<<li>text</li>' => '<text',
'some<!-- comment -->text' => 'sometext',
'some<ul>text' => 'sometext',
'some<script>text</script>' => 'sometext',
'some<!-- comment' => 'some<-- comment',
'<h1 style="coller:red">>text</h1>>' => '>text>',
" <ul>list<li>text</li>\n <li>text2</li> " => " listtext\n text2 "
}.each do |example_string, result|
context "when string '#{example_string}'" do
it { expect(example_string.dup.strip_tags).to eq result }
end
end
end
end

0 comments on commit 2054e2a

Please sign in to comment.