sms-htmldiff 0.0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ describe HTMLDiff::Operation do
4
+ describe 'same_tag?' do
5
+ let(:old_words) { HTMLDiff::ListOfWords.new old_tag }
6
+ let(:new_words) { HTMLDiff::ListOfWords.new new_tag }
7
+ let(:operation) { HTMLDiff::Operation.new :equal, old_words, new_words }
8
+
9
+ context 'with identical tags' do
10
+ let(:old_tag) { '<p>' }
11
+ let(:new_tag) { '<p>' }
12
+
13
+ it 'returns true for identical simple tags' do
14
+ expect(operation.same_tag?).to be_true
15
+ end
16
+ end
17
+
18
+ context 'with the same tag that has a new attribute' do
19
+ let(:old_tag) { '<p>' }
20
+ let(:new_tag) { '<p style="margin: 2px;">' }
21
+
22
+ it 'returns true for one simple and one complex tag' do
23
+ expect(operation.same_tag?).to be_true
24
+ end
25
+ end
26
+
27
+ context 'with two different tags' do
28
+ let(:old_tag) { '<p>' }
29
+ let(:new_tag) { '<b>' }
30
+
31
+ it 'returns false for non matching simple tags' do
32
+ expect(operation.same_tag?).to be_false
33
+ end
34
+ end
35
+
36
+ context 'with two identical bits of text' do
37
+ let(:old_tag) { 'blah' }
38
+ let(:new_tag) { 'blah' }
39
+
40
+ it 'should return false for random text' do
41
+ expect(operation.same_tag?).to be_false
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,3 @@
1
+ $LOAD_PATH.push File.join(File.dirname(__FILE__), '..', 'lib')
2
+
3
+ require 'htmldiff'
data/spec/word_spec.rb ADDED
@@ -0,0 +1,31 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe HTMLDiff::Word do
4
+ describe 'opening_tag?' do
5
+ it 'returns true for <p>' do
6
+ expect(described_class.new('<p>').opening_tag?).to be_true
7
+ end
8
+
9
+ it 'returns true for <p> with spaces' do
10
+ expect(described_class.new(' <p> ').opening_tag?).to be_true
11
+ end
12
+
13
+ it 'returns true for a tag with a url' do
14
+ a_tag = '<a href="http://google.com">'
15
+ expect(described_class.new(a_tag).opening_tag?).to be_true
16
+ end
17
+
18
+ it 'returns false for </p>' do
19
+ expect(described_class.new('</p>').opening_tag?).to be_false
20
+ end
21
+
22
+ it 'returns false for </p> with spaces' do
23
+ expect(described_class.new(' </p> ').opening_tag?).to be_false
24
+ end
25
+
26
+ it 'returns false for internal del tags' do
27
+ del_tag = '<del class="diffdel">More</del>'
28
+ expect(described_class.new(del_tag).opening_tag?).to be_false
29
+ end
30
+ end
31
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sms-htmldiff
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Nathan Herald
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2008-11-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nokogiri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.6.5
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.6.5
27
+ description:
28
+ email: nathan@myobie.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files:
32
+ - README.md
33
+ - LICENSE
34
+ files:
35
+ - Gemfile
36
+ - Gemfile.lock
37
+ - LICENSE
38
+ - README.md
39
+ - Rakefile
40
+ - htmldiff.gemspec
41
+ - lib/htmldiff.rb
42
+ - lib/htmldiff/diff_builder.rb
43
+ - lib/htmldiff/list_of_words.rb
44
+ - lib/htmldiff/match.rb
45
+ - lib/htmldiff/match_finder.rb
46
+ - lib/htmldiff/operation.rb
47
+ - lib/htmldiff/word.rb
48
+ - spec/diffing_output/block_tag_spec.rb
49
+ - spec/diffing_output/iframes_spec.rb
50
+ - spec/diffing_output/img_tags_spec.rb
51
+ - spec/diffing_output/paragraph_tags_spec.rb
52
+ - spec/diffing_output/tables_spec.rb
53
+ - spec/diffing_output/text_spec.rb
54
+ - spec/list_of_words_spec.rb
55
+ - spec/operation_spec.rb
56
+ - spec/spec_helper.rb
57
+ - spec/word_spec.rb
58
+ homepage: http://github.com/stackmystack/htmldiff
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options:
64
+ - "--main"
65
+ - README.md
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubygems_version: 3.3.7
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: HTML diffs of text (borrowed from a wiki software I no longer remember)
83
+ test_files:
84
+ - spec/diffing_output/block_tag_spec.rb
85
+ - spec/diffing_output/iframes_spec.rb
86
+ - spec/diffing_output/img_tags_spec.rb
87
+ - spec/diffing_output/paragraph_tags_spec.rb
88
+ - spec/diffing_output/tables_spec.rb
89
+ - spec/diffing_output/text_spec.rb
90
+ - spec/list_of_words_spec.rb
91
+ - spec/operation_spec.rb
92
+ - spec/spec_helper.rb
93
+ - spec/word_spec.rb