rails-footnotes 4.1.5 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ci.yml +25 -0
  3. data/.gitignore +4 -3
  4. data/CHANGELOG +8 -0
  5. data/Gemfile +8 -1
  6. data/Gemfile.lock +187 -0
  7. data/README.rdoc +8 -54
  8. data/Rakefile +1 -6
  9. data/bin/rake +29 -0
  10. data/bin/rspec +29 -0
  11. data/gemfiles/{Gemfile.rails-3.2.x → Gemfile.rails-3.2.22} +1 -1
  12. data/lib/generators/templates/rails_footnotes.rb +4 -5
  13. data/lib/rails-footnotes.rb +9 -9
  14. data/lib/rails-footnotes/extension.rb +8 -11
  15. data/lib/rails-footnotes/filter.rb +13 -4
  16. data/lib/rails-footnotes/notes/assigns_note.rb +2 -2
  17. data/lib/rails-footnotes/notes/files_note.rb +12 -23
  18. data/lib/rails-footnotes/notes/log_note.rb +1 -1
  19. data/lib/rails-footnotes/notes/params_note.rb +5 -1
  20. data/lib/rails-footnotes/notes/queries_note.rb +9 -10
  21. data/lib/rails-footnotes/notes/view_note.rb +16 -7
  22. data/lib/rails-footnotes/version.rb +1 -1
  23. data/lib/rails6-footnotes.rb +1 -0
  24. data/rails-footnotes.gemspec +5 -10
  25. data/spec/abstract_note_spec.rb +17 -13
  26. data/spec/app/assets/config/manifest.js +2 -0
  27. data/spec/app/assets/javascripts/foobar.js +1 -0
  28. data/spec/app/assets/stylesheets/foobar.css +0 -0
  29. data/spec/app/views/files/index.html.erb +1 -0
  30. data/spec/app/views/layouts/application.html.erb +12 -0
  31. data/spec/{views → app/views}/partials/_foo.html.erb +0 -0
  32. data/spec/{views → app/views}/partials/index.html.erb +0 -0
  33. data/spec/controllers/files_note_controller_spec.rb +38 -0
  34. data/spec/controllers/footnotes_controller_spec.rb +49 -34
  35. data/spec/controllers/log_note_controller_spec.rb +4 -8
  36. data/spec/controllers/partials_note_controller_spec.rb +2 -3
  37. data/spec/env_note_spec.rb +4 -4
  38. data/spec/footnotes_spec.rb +38 -54
  39. data/spec/notes/assigns_note_spec.rb +13 -9
  40. data/spec/notes/controller_note_spec.rb +2 -2
  41. data/spec/notes/files_note_spec.rb +12 -3
  42. data/spec/notes/javascripts_note_spec.rb +1 -1
  43. data/spec/notes/stylesheets_note_spec.rb +1 -1
  44. data/spec/notes/view_note_spec.rb +18 -0
  45. data/spec/spec_helper.rb +35 -3
  46. metadata +38 -48
  47. data/.travis.yml +0 -14
@@ -0,0 +1,2 @@
1
+ //= link_directory ../javascripts .js
2
+ //= link_directory ../stylesheets .css
@@ -0,0 +1 @@
1
+ // Foobar
File without changes
@@ -0,0 +1 @@
1
+ FILES INDEX
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <%= javascript_include_tag 'foobar' %>
5
+ <%= javascript_include_tag 'http://google.com/whatever.js' %>
6
+ <%= stylesheet_link_tag 'foobar' %>
7
+ <%= stylesheet_link_tag 'http://google.com/whatever.css' %>
8
+ </head>
9
+ <body>
10
+ <%= yield %>
11
+ </body>
12
+ </html>
File without changes
File without changes
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ class FilesController < ApplicationController
4
+ def index
5
+ end
6
+ end
7
+
8
+ describe FilesController, type: :controller do
9
+ render_views
10
+
11
+ before :all do
12
+ Footnotes.enabled = true
13
+ end
14
+
15
+ after :all do
16
+ Footnotes.enabled = false
17
+ end
18
+
19
+ it 'includes stylesheets assets in the response' do
20
+ get :index
21
+ expect(response.body).to include("FILES INDEX")
22
+ js_debug = first('fieldset#javascripts_debug_info div', visible: false)
23
+ expect(js_debug).to have_selector('li a', visible: false, count: 1)
24
+ expect(js_debug).to have_selector('li a', text: /foobar\.js/, visible: false)
25
+ link = js_debug.first('a', visible: false)
26
+ expect(link['href']).to eq("txmt://open?url=file://#{Rails.root.join('app', 'assets', 'javascripts', 'foobar.js')}&line=1&column=1")
27
+ end
28
+
29
+ it 'includes css assets in the response' do
30
+ get :index
31
+ css_debug = first('fieldset#stylesheets_debug_info div', visible: false)
32
+ expect(css_debug).to have_selector('li a', visible: false, count: 1)
33
+ expect(css_debug).to have_selector('li a', text: /foobar\.css/, visible: false)
34
+ link = css_debug.first('a', visible: false)
35
+ expect(link['href']).to eq("txmt://open?url=file://#{Rails.root.join('app', 'assets', 'stylesheets', 'foobar.css')}&line=1&column=1")
36
+ end
37
+
38
+ end
@@ -3,45 +3,41 @@ require 'spec_helper'
3
3
  class FootnotesController < ActionController::Base
4
4
 
5
5
  def foo
6
- render :text => HTML_DOCUMENT, :content_type => 'text/html'
6
+ render inline: HTML_DOCUMENT, content_type: 'text/html'
7
7
  end
8
8
 
9
9
  def foo_holder
10
- render :text => '<html><body><div id="footnotes_holder"></div></body></html>'
10
+ render inline: '<html><body><div id="footnotes_holder"></div></body></html>'
11
11
  end
12
12
 
13
13
  def foo_js
14
- render :text => '<script></script>', :content_type => 'text/javascript'
14
+ render inline: '<script></script>', content_type: 'text/javascript'
15
15
  end
16
16
 
17
17
  def foo_download
18
- send_file Rails.root.join('spec', 'fixtures', 'html_download.html'), :disposition => 'attachment'
18
+ send_file Rails.root.join('fixtures', 'html_download.html'), :disposition => 'attachment'
19
19
  end
20
20
 
21
21
  end
22
22
 
23
- describe FootnotesController do
24
-
25
- def page
26
- Capybara::Node::Simple.new(response.body)
27
- end
23
+ describe FootnotesController, type: :controller do
28
24
 
29
25
  shared_examples 'has_footnotes' do
30
26
  it 'includes footnotes' do
31
27
  get :foo
32
- response.body.should have_selector('#footnotes_debug')
28
+ expect(response.body).to have_selector('#footnotes_debug')
33
29
  end
34
30
  end
35
31
 
36
32
  shared_examples 'has_no_footnotes' do
37
33
  it 'does not include footnotes' do
38
- response.body.should_not have_selector('#footnotes_debug')
34
+ expect(response.body).not_to have_selector('#footnotes_debug')
39
35
  end
40
36
  end
41
37
 
42
38
  it 'does not alter the page by default' do
43
39
  get :foo
44
- response.body.should == HTML_DOCUMENT
40
+ expect(response.body).to eq(HTML_DOCUMENT)
45
41
  end
46
42
 
47
43
  context 'with footnotes' do
@@ -62,24 +58,24 @@ describe FootnotesController do
62
58
  end
63
59
 
64
60
  it 'includes footnotes in the last div in body' do
65
- all('body > :last-child')[0][:id].should == 'footnotes_debug'
61
+ expect(all('body > :last-child')[0][:id]).to eq('footnotes_debug')
66
62
  end
67
63
 
68
64
  it 'includes footnotes in the footnoted_holder div if present' do
69
65
  get :foo_holder
70
- response.body.should have_selector('#footnotes_holder > #footnotes_debug')
66
+ expect(response.body).to have_selector('#footnotes_holder > #footnotes_debug')
71
67
  end
72
68
 
73
69
  it 'does not alter a html file download' do
74
70
  get :foo_download
75
- response.body.should == File.open(Rails.root.join('spec', 'fixtures', 'html_download.html')).read
71
+ expect(response.body).to eq(File.open(Rails.root.join('fixtures', 'html_download.html')).read)
76
72
  end
77
73
  end
78
74
 
79
75
  describe 'when request is xhr' do
80
76
  include_context 'has_no_footnotes'
81
77
  before do
82
- xhr :get, :foo
78
+ get :foo, xhr: true
83
79
  end
84
80
  end
85
81
 
@@ -90,24 +86,43 @@ describe FootnotesController do
90
86
  end
91
87
  end
92
88
 
93
- end
89
+ describe 'when footnotes is disabled' do
90
+ include_context 'has_no_footnotes'
91
+ before do
92
+ Footnotes.enabled = false
93
+ get :foo
94
+ end
95
+ end
94
96
 
95
- end
97
+ describe 'with a proc' do
98
+
99
+ it 'yields the controller' do
100
+ c = nil
101
+ Footnotes.enabled = lambda { |controller| c = controller}
102
+ get :foo
103
+ expect(c).to be_kind_of(ActionController::Base)
104
+ end
105
+
106
+ context 'returning true' do
107
+ include_context 'has_footnotes'
108
+
109
+ before do
110
+ Footnotes.enabled = lambda { true }
111
+ get :foo
112
+ end
113
+ end
114
+
115
+ context 'returning false' do
116
+ include_context 'has_no_footnotes'
96
117
 
118
+ before do
119
+ Footnotes.enabled = lambda { false }
120
+ get :foo
121
+ end
122
+ end
97
123
 
98
- HTML_DOCUMENT = <<EOF
99
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
100
- <html>
101
- <head>
102
- <title>HTML to XHTML Example: HTML page</title>
103
- <link rel="Stylesheet" href="htmltohxhtml.css" type="text/css" media="screen">
104
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
105
- </head>
106
- <body>
107
- <p>This is the HTML page. It works and is encoded just like any HTML page you
108
- have previously done. View <a href="htmltoxhtml2.htm">the XHTML version</a> of
109
- this page to view the difference between HTML and XHTML.</p>
110
- <p>You will be glad to know that no changes need to be made to any of your CSS files.</p>
111
- </body>
112
- </html>
113
- EOF
124
+ end
125
+
126
+ end
127
+
128
+ end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'stringio'
3
3
 
4
- describe 'log note' do
4
+ describe 'log note', type: :controller do
5
5
 
6
6
  class ApplicationController < ActionController::Base
7
7
  end
@@ -10,14 +10,10 @@ describe 'log note' do
10
10
  def index
11
11
  Rails.logger.error 'foo'
12
12
  Rails.logger.warn 'bar'
13
- render :text => '<html><head></head><body></body></html>', :content_type => 'text/html'
13
+ render inline: '<html><head></head><body></body></html>', content_type: 'text/html'
14
14
  end
15
15
  end
16
16
 
17
- def page
18
- Capybara::Node::Simple.new(response.body)
19
- end
20
-
21
17
  before :all do
22
18
  Footnotes.enabled = true
23
19
  end
@@ -29,8 +25,8 @@ describe 'log note' do
29
25
  it 'Includes the log in the response' do
30
26
  get :index
31
27
  log_debug = first('fieldset#log_debug_info div', :visible => false)
32
- log_debug.should have_content('foo')
33
- log_debug.should have_content('bar')
28
+ expect(log_debug).to have_content('foo')
29
+ expect(log_debug).to have_content('bar')
34
30
  end
35
31
 
36
32
  end
@@ -3,12 +3,11 @@ require 'spec_helper'
3
3
  class PartialsController < ActionController::Base
4
4
 
5
5
  def index
6
- prepend_view_path "#{Rails.root.join('spec', 'views')}"
7
6
  end
8
7
 
9
8
  end
10
9
 
11
- describe PartialsController do
10
+ describe PartialsController, type: :controller do
12
11
 
13
12
  render_views
14
13
 
@@ -22,7 +21,7 @@ describe PartialsController do
22
21
 
23
22
  it 'lists the rendered partials' do
24
23
  get :index
25
- response.body.should have_selector('#footnotes_debug #partials_debug_info table tr', :visible => false, :count => 2)
24
+ expect(response.body).to have_selector('#footnotes_debug #partials_debug_info table tr', :visible => false, :count => 2)
26
25
  end
27
26
 
28
27
 
@@ -9,11 +9,11 @@ end
9
9
  describe Footnotes::Notes::EnvNote do
10
10
  let(:controller) {
11
11
  FootnotesEnvController.new.tap { |c|
12
- c.template = Object.new
13
- c.request = ActionController::TestRequest.new
14
- c.response = ActionController::TestResponse.new
12
+ c.template = Object.new
13
+ c.request = ActionDispatch::TestRequest.create
14
+ c.response = ActionDispatch::TestResponse.new
15
15
  c.response_body = %Q(<html><body></body></html>)
16
- c.params = {}
16
+ c.params = {}
17
17
  }
18
18
  }
19
19
 
@@ -30,8 +30,8 @@ describe "Footnotes" do
30
30
  before do
31
31
  @controller = FootnotesController.new
32
32
  @controller.template = Object.new
33
- @controller.request = ActionController::TestRequest.new
34
- @controller.response = ActionController::TestResponse.new
33
+ @controller.request = ActionDispatch::TestRequest.create
34
+ @controller.response = ActionDispatch::TestResponse.new
35
35
  @controller.response_body = HTML_DOCUMENT.dup
36
36
  @controller.params = {}
37
37
 
@@ -42,12 +42,13 @@ describe "Footnotes" do
42
42
 
43
43
  it "footnotes_controller" do
44
44
  index = @controller.response.body.index(/This is the HTML page/)
45
- index.should eql 334
45
+ expect(index).to eql 334
46
46
  end
47
47
 
48
48
  context "response_body is file" do
49
49
  before do
50
50
  @file = Tempfile.new("test")
51
+ def @file.body; read; end
51
52
  @file.write "foobarbaz"
52
53
  @file.rewind
53
54
  end
@@ -66,62 +67,62 @@ describe "Footnotes" do
66
67
 
67
68
  it "foonotes_included" do
68
69
  footnotes_perform!
69
- @controller.response_body.should_not == HTML_DOCUMENT
70
+ expect(@controller.response_body).not_to eq(HTML_DOCUMENT)
70
71
  end
71
72
 
72
73
  it "should escape links with special chars" do
73
74
  note_with_link = Footnotes::Notes::FileURINote.new
74
75
  link = Footnotes::Filter.prefix(note_with_link.link, 1, 1, 1)
75
- link.should eql "txmt://open?url=file:///example/local%20file%20path/with-special-chars/%C3%B6%C3%A4%C3%BC/file&amp;line=1&amp;column=1"
76
+ expect(link).to eql "txmt://open?url=file:///example/local%20file%20path/with-special-chars/%C3%B6%C3%A4%C3%BC/file&amp;line=1&amp;column=1"
76
77
  end
77
78
 
78
79
  specify "footnotes_not_included_when_request_is_xhr" do
79
80
  @controller.request.env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'
80
81
  @controller.request.env['HTTP_ACCEPT'] = 'text/javascript, text/html, application/xml, text/xml, */*'
81
82
  footnotes_perform!
82
- @controller.response.body.should eql HTML_DOCUMENT
83
+ expect(@controller.response.body).to eql HTML_DOCUMENT
83
84
  end
84
85
 
85
86
  specify "footnotes_not_included_when_content_type_is_javascript" do
86
87
  @controller.response.content_type = 'text/javascript'
87
88
  footnotes_perform!
88
- @controller.response.body.should eql HTML_DOCUMENT
89
+ expect(@controller.response.body).to eql HTML_DOCUMENT
89
90
  end
90
91
 
91
92
  specify "footnotes_included_when_content_type_is_html" do
92
- @controller.response.content_type = 'text/html'
93
+ @controller.response.content_type = 'text/html; charset=utf-8'
93
94
  footnotes_perform!
94
- @controller.response.body.should_not eql HTML_DOCUMENT
95
+ expect(@controller.response.body).not_to eql HTML_DOCUMENT
95
96
  end
96
97
 
97
98
  specify "footnotes_included_when_content_type_is_nil" do
98
99
  footnotes_perform!
99
- @controller.response.body.should_not eql HTML_DOCUMENT
100
+ expect(@controller.response.body).not_to eql HTML_DOCUMENT
100
101
  end
101
102
 
102
103
  specify "not_included_when_body_is_not_a_string" do
103
- @controller.response.stub(:body).and_return(Time.now)# = Proc.new { Time.now }
104
- Footnotes::Filter.new(@controller).send(:valid?).should_not be
105
- @controller.response.body.should_not =~ /<!-- Footnotes/
104
+ allow(@controller.response).to receive(:body).and_return(Time.now)# = Proc.new { Time.now }
105
+ expect(Footnotes::Filter.new(@controller).send(:valid?)).not_to be
106
+ expect(@controller.response.body).not_to match(/<!-- Footnotes/)
106
107
  end
107
108
 
108
109
  specify "notes_are_initialized" do
109
110
  footnotes_perform!
110
111
  test_note = @footnotes.instance_variable_get('@notes').first
111
- test_note.class.name.should eql 'Footnotes::Notes::TestNote'
112
- test_note.to_sym.should eql :test
112
+ expect(test_note.class.name).to eql 'Footnotes::Notes::TestNote'
113
+ expect(test_note.to_sym).to eql :test
113
114
  end
114
115
 
115
116
  specify "notes_links" do
116
117
  note = Footnotes::Notes::TestNote.new
117
- note.should_receive(:row).twice
118
+ expect(note).to receive(:row).twice
118
119
  @footnotes.instance_variable_set(:@notes, [note])
119
120
  footnotes_perform!
120
121
  end
121
122
 
122
123
  specify "notes_fieldset" do
123
124
  note = Footnotes::Notes::TestNote.new
124
- note.should_receive(:has_fieldset?).exactly(3).times
125
+ expect(note).to receive(:has_fieldset?).exactly(3).times
125
126
  @footnotes.instance_variable_set(:@notes, [note])
126
127
  footnotes_perform!
127
128
  end
@@ -129,70 +130,70 @@ describe "Footnotes" do
129
130
  specify "multiple_notes" do
130
131
  Footnotes::Filter.multiple_notes = true
131
132
  note = Footnotes::Notes::TestNote.new
132
- note.should_receive(:has_fieldset?).twice
133
+ expect(note).to receive(:has_fieldset?).twice
133
134
  @footnotes.instance_variable_set(:@notes, [note])
134
135
  footnotes_perform!
135
136
  end
136
137
 
137
138
  specify "notes_are_reset" do
138
139
  note = Footnotes::Notes::TestNote.new
139
- note.class.should_receive(:close!)
140
+ expect(note.class).to receive(:close!)
140
141
  @footnotes.instance_variable_set(:@notes, [note])
141
142
  @footnotes.send(:close!, @controller)
142
143
  end
143
144
 
144
145
  specify "links_helper" do
145
146
  note = Footnotes::Notes::TestNote.new
146
- @footnotes.send(:link_helper, note).should eql '<a href="#" onclick="">Test</a>'
147
+ expect(@footnotes.send(:link_helper, note)).to eql '<a href="#" onclick="">Test</a>'
147
148
 
148
- note.should_receive(:link).once.and_return(:link)
149
- @footnotes.send(:link_helper, note).should eql '<a href="link" onclick="">Test</a>'
149
+ expect(note).to receive(:link).once.and_return(:link)
150
+ expect(@footnotes.send(:link_helper, note)).to eql '<a href="link" onclick="">Test</a>'
150
151
  end
151
152
 
152
153
  specify "links_helper_has_fieldset?" do
153
154
  note = Footnotes::Notes::TestNote.new
154
- note.should_receive(:has_fieldset?).once.and_return(true)
155
- @footnotes.send(:link_helper, note).should eql '<a href="#" onclick="Footnotes.hideAllAndToggle(\'test_debug_info\');return false;">Test</a>'
155
+ expect(note).to receive(:has_fieldset?).once.and_return(true)
156
+ expect(@footnotes.send(:link_helper, note)).to eql '<a href="#" onclick="Footnotes.hideAllAndToggle(\'test_debug_info\');return false;">Test</a>'
156
157
  end
157
158
 
158
159
  specify "links_helper_onclick" do
159
160
  note = Footnotes::Notes::TestNote.new
160
- note.should_receive(:onclick).twice.and_return(:onclick)
161
- @footnotes.send(:link_helper, note).should eql '<a href="#" onclick="onclick">Test</a>'
161
+ expect(note).to receive(:onclick).twice.and_return(:onclick)
162
+ expect(@footnotes.send(:link_helper, note)).to eql '<a href="#" onclick="onclick">Test</a>'
162
163
 
163
- note.should_receive(:has_fieldset?).once.and_return(true)
164
- @footnotes.send(:link_helper, note).should eql '<a href="#" onclick="onclick">Test</a>'
164
+ expect(note).to receive(:has_fieldset?).once.and_return(true)
165
+ expect(@footnotes.send(:link_helper, note)).to eql '<a href="#" onclick="onclick">Test</a>'
165
166
  end
166
167
 
167
168
  specify "insert_style" do
168
169
  @controller.response.body = "<head></head><split><body></body>"
169
170
  @footnotes = Footnotes::Filter.new(@controller)
170
171
  footnotes_perform!
171
- @controller.response.body.split('<split>').first.include?('<!-- Footnotes Style -->').should be
172
+ expect(@controller.response.body.split('<split>').first.include?('<!-- Footnotes Style -->')).to be
172
173
  end
173
174
 
174
175
  specify "insert_footnotes_inside_body" do
175
176
  @controller.response.body = "<head></head><split><body></body>"
176
177
  @footnotes = Footnotes::Filter.new(@controller)
177
178
  footnotes_perform!
178
- @controller.response.body.split('<split>').last.include?('<!-- End Footnotes -->').should be
179
+ expect(@controller.response.body.split('<split>').last.include?('<!-- End Footnotes -->')).to be
179
180
  end
180
181
 
181
182
  specify "insert_footnotes_inside_holder" do
182
183
  @controller.response.body = "<head></head><split><div id='footnotes_holder'></div>"
183
184
  @footnotes = Footnotes::Filter.new(@controller)
184
185
  footnotes_perform!
185
- @controller.response.body.split('<split>').last.include?('<!-- End Footnotes -->').should be
186
+ expect(@controller.response.body.split('<split>').last.include?('<!-- End Footnotes -->')).to be
186
187
  end
187
188
 
188
189
  specify "insert_text" do
189
190
  @footnotes.send(:insert_text, :after, /<head>/, "Graffiti")
190
191
  after = " <head>Graffiti"
191
- @controller.response.body.split("\n")[2].should eql after
192
+ expect(@controller.response.body.split("\n")[2]).to eql after
192
193
 
193
194
  @footnotes.send(:insert_text, :before, /<\/body>/, "Notes")
194
195
  after = " Notes</body>"
195
- @controller.response.body.split("\n")[12].should eql after
196
+ expect(@controller.response.body.split("\n")[12]).to eql after
196
197
  end
197
198
 
198
199
  describe 'Hooks' do
@@ -201,14 +202,14 @@ describe "Footnotes" do
201
202
  specify do
202
203
  Footnotes.setup {|config| config.before {|controller, filter| filter.notes -= [:note_y] }}
203
204
  Footnotes::Filter.start!(@controller)
204
- Footnotes::Filter.notes.should eql [:note_x, :note_z]
205
+ expect(Footnotes::Filter.notes).to eql [:note_x, :note_z]
205
206
  end
206
207
  end
207
208
  context "after" do
208
209
  specify do
209
210
  Footnotes.setup {|config| config.after {|controller, filter| filter.notes -= [:note_y] }}
210
211
  Footnotes::Filter.start!(@controller)
211
- Footnotes::Filter.notes.should eql [:note_x, :note_z]
212
+ expect(Footnotes::Filter.notes).to eql [:note_x, :note_z]
212
213
  end
213
214
  end
214
215
  end
@@ -224,27 +225,10 @@ describe "Footnotes" do
224
225
 
225
226
  def template_expects(format)
226
227
  if @controller.template.respond_to?(:template_format)
227
- @controller.template.stub(:template_format).and_return(format)
228
+ allow(@controller.template).to receive(:template_format).and_return(format)
228
229
  else
229
- @controller.template.stub(:format).and_return(format)
230
+ allow(@controller.template).to receive(:format).and_return(format)
230
231
  end
231
232
  end
232
233
 
233
- HTML_DOCUMENT = <<EOF
234
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
235
- <html>
236
- <head>
237
- <title>HTML to XHTML Example: HTML page</title>
238
- <link rel="Stylesheet" href="htmltohxhtml.css" type="text/css" media="screen">
239
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
240
- </head>
241
- <body>
242
- <p>This is the HTML page. It works and is encoded just like any HTML page you
243
- have previously done. View <a href="htmltoxhtml2.htm">the XHTML version</a> of
244
- this page to view the difference between HTML and XHTML.</p>
245
- <p>You will be glad to know that no changes need to be made to any of your CSS files.</p>
246
- </body>
247
- </html>
248
- EOF
249
-
250
234
  end