rails-footnotes 4.1.5 → 4.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a41c090b37697dabd6c9f5925e39efe2c63de144
4
- data.tar.gz: c80e75844ceb6eddfcc436b318acf0bf4c49e736
3
+ metadata.gz: c57242b5f541d4d6722be87fcb7aaee885065388
4
+ data.tar.gz: 804664dc9f668fe41bf3cd4c0a3e05a72cf4bb2d
5
5
  SHA512:
6
- metadata.gz: a13390246b039b93557322cccfc8af102fb0fce960ddd63231992757b7de4c6c697576f04d24c50a1d8cad6e32d0cefda2319bd3c7f6a98a9309cb155beb9126
7
- data.tar.gz: c221e2c64876ac31bbd8f9f0c469adfd4c7670445922733fabc5e4a529fa0b4e6e8bf0bc777375a95f41ead43273fc0b37a8aca7ac14b129335edb223decd562
6
+ metadata.gz: 4f6e3da7e078c14fd7d4115d250a871c74e75319a4aa47373ebae0cbc3e0094770c24fac5b7ddac183df83eb5a73bcddd93037c09af387a91cc5d4403a1f5b32
7
+ data.tar.gz: cc4644cb39a8336493649916a3d412f03eb42ff8f8b703f88e29bbd2f6720f0e9a75e6df292a20ce5bddecd4b09a4c7b1a833b4dda4f864b57c5c8e906632510
data/.gitignore CHANGED
@@ -12,3 +12,5 @@ pkg/*
12
12
  tags
13
13
  /doc
14
14
  /myapp
15
+ spec/tmp
16
+ spec/log
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ == Footnotes v4.1.6 ==
2
+ * Fix incorrect handler link to css/js files (#217)*
1
3
  == Footnotes v4.1.5 ==
2
4
  * Remove use of non-existing note in initializer introduced in v4, impacting new installations *
3
5
  == Footnotes v4.1.4 ==
@@ -28,32 +28,20 @@ module Footnotes
28
28
  end
29
29
 
30
30
  def parse_files!
31
- if Rails.version >= '3.1' && Rails.application.config.assets[:enabled]
32
- asset_paths = Rails.application.config.assets.paths
33
- linked_files = []
31
+ asset_paths = Rails.application.config.assets.paths
32
+ linked_files = []
34
33
 
35
- @files.collect do |file|
36
- base_name = File.basename(file)
37
- asset_paths.each do |asset_path|
38
- results = Dir[File.expand_path(base_name, asset_path) + '*']
39
- results.each do |r|
40
- linked_files << %[<a href="#{Footnotes::Filter.prefix(r, 1, 1)}">#{File.basename(r)}</a>]
41
- end
42
- break if results.present?
43
- end
44
- end
45
- @files = linked_files
46
- else
47
- #Original Implementation
48
- @files.collect! do |filename|
49
- if filename =~ %r{^/}
50
- full_filename = File.join(File.expand_path(Rails.root), 'public', filename)
51
- %[<a href="#{Footnotes::Filter.prefix(full_filename, 1, 1)}">#{filename}</a>]
52
- else
53
- %[<a href="#{filename}">#{filename}</a>]
34
+ @files.collect do |file|
35
+ base_name = File.basename(file)
36
+ asset_paths.each do |asset_path|
37
+ results = Dir[File.expand_path(base_name, asset_path) + '*']
38
+ results.each do |r|
39
+ linked_files << %[<a href="#{Footnotes::Filter.prefix(r, 1, 1)}">#{File.basename(r)}</a>]
54
40
  end
41
+ break if results.present?
55
42
  end
56
43
  end
44
+ @files = linked_files
57
45
  end
58
46
  end
59
47
  end
@@ -1,3 +1,3 @@
1
1
  module Footnotes
2
- VERSION = "4.1.5"
2
+ VERSION = "4.1.6"
3
3
  end
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.add_dependency "rails", ">= 3.2"
18
18
 
19
19
  s.add_development_dependency "rspec-rails", '~> 2.14.0'
20
+ s.add_development_dependency "test-unit"
20
21
  s.add_development_dependency "capybara"
21
22
 
22
23
  s.files = `git ls-files`.split("\n")
@@ -0,0 +1 @@
1
+ // Foobar
File without changes
File without changes
@@ -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>
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ class FilesController < ApplicationController
4
+
5
+ def index
6
+ end
7
+ end
8
+
9
+ describe FilesController do
10
+
11
+ render_views
12
+ include Capybara::DSL
13
+
14
+ def page
15
+ Capybara::Node::Simple.new(response.body)
16
+ end
17
+
18
+ before :all do
19
+ Footnotes.enabled = true
20
+ end
21
+
22
+ after :all do
23
+ Footnotes.enabled = false
24
+ end
25
+
26
+ it 'includes stylesheets assets in the response' do
27
+ get :index
28
+ js_debug = first('fieldset#javascripts_debug_info div', visible: false)
29
+ expect(js_debug).to have_selector('li a', visible: false, count: 1)
30
+ expect(js_debug).to have_selector('li a', text: /foobar\.js/, visible: false)
31
+ link = js_debug.first('a', visible: false)
32
+ expect(link['href']).to eq("txmt://open?url=file://#{Rails.root.join('app', 'assets', 'javascripts', 'foobar.js')}&line=1&column=1")
33
+ end
34
+
35
+ it 'includes css assets in the response' do
36
+ get :index
37
+ css_debug = first('fieldset#stylesheets_debug_info div', visible: false)
38
+ expect(css_debug).to have_selector('li a', visible: false, count: 1)
39
+ expect(css_debug).to have_selector('li a', text: /foobar\.css/, visible: false)
40
+ link = css_debug.first('a', visible: false)
41
+ expect(link['href']).to eq("txmt://open?url=file://#{Rails.root.join('app', 'assets', 'stylesheets', 'foobar.css')}&line=1&column=1")
42
+ end
43
+
44
+ end
@@ -15,7 +15,7 @@ class FootnotesController < ActionController::Base
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
@@ -72,7 +72,7 @@ describe FootnotesController do
72
72
 
73
73
  it 'does not alter a html file download' do
74
74
  get :foo_download
75
- response.body.should == File.open(Rails.root.join('spec', 'fixtures', 'html_download.html')).read
75
+ response.body.should == File.open(Rails.root.join('fixtures', 'html_download.html')).read
76
76
  end
77
77
  end
78
78
 
@@ -3,6 +3,10 @@ require 'stringio'
3
3
 
4
4
  describe 'log note' do
5
5
 
6
+ def page
7
+ Capybara::Node::Simple.new(response.body)
8
+ end
9
+
6
10
  class ApplicationController < ActionController::Base
7
11
  end
8
12
 
@@ -14,10 +18,6 @@ describe 'log note' do
14
18
  end
15
19
  end
16
20
 
17
- def page
18
- Capybara::Node::Simple.new(response.body)
19
- end
20
-
21
21
  before :all do
22
22
  Footnotes.enabled = true
23
23
  end
@@ -3,7 +3,6 @@ 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
@@ -5,7 +5,6 @@ require "rails-footnotes/notes/files_note"
5
5
  describe Footnotes::Notes::FilesNote do
6
6
 
7
7
  let(:note) do
8
- Rails.stub(:version).and_return('3.0.12');
9
8
  Footnotes::Notes::FilesNote.new(double('controller', :response => double('', :body => '')))
10
9
  end
11
10
 
@@ -4,12 +4,14 @@ begin
4
4
  rescue LoadError
5
5
  end
6
6
  ENV["RAILS_ENV"] ||= 'test'
7
+ require "sprockets/railtie"
7
8
  require "rails-footnotes"
8
9
 
9
10
  module FooBar
10
11
  class Application < Rails::Application
11
12
  config.secret_key_base = 'foobar'
12
- config.root = Dir.new('.')
13
+ config.root = Dir.new('./spec')
14
+ config.eager_load = false
13
15
  end
14
16
  end
15
17
 
@@ -17,6 +19,9 @@ ActionController::Base.class_eval do
17
19
  include Rails.application.routes.url_helpers
18
20
  end
19
21
 
22
+ class ApplicationController < ActionController::Base
23
+ end
24
+
20
25
  RSpec.configure do |config|
21
26
 
22
27
  Rails.application.initialize!
@@ -27,6 +32,7 @@ RSpec.configure do |config|
27
32
  get 'footnotes/foo_js'
28
33
  get 'footnotes/foo_download'
29
34
  get 'partials/index'
35
+ get 'files/index'
30
36
  end
31
37
 
32
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-footnotes
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.5
4
+ version: 4.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman V. Babenko
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-02-04 00:00:00.000000000 Z
15
+ date: 2015-03-02 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rails
@@ -42,6 +42,20 @@ dependencies:
42
42
  - - "~>"
43
43
  - !ruby/object:Gem::Version
44
44
  version: 2.14.0
45
+ - !ruby/object:Gem::Dependency
46
+ name: test-unit
47
+ requirement: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ type: :development
53
+ prerelease: false
54
+ version_requirements: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
45
59
  - !ruby/object:Gem::Dependency
46
60
  name: capybara
47
61
  requirement: !ruby/object:Gem::Requirement
@@ -105,6 +119,13 @@ files:
105
119
  - lib/rails-footnotes/version.rb
106
120
  - rails-footnotes.gemspec
107
121
  - spec/abstract_note_spec.rb
122
+ - spec/app/assets/javascripts/foobar.js
123
+ - spec/app/assets/stylesheets/foobar.css
124
+ - spec/app/views/files/index.html.erb
125
+ - spec/app/views/layouts/application.html.erb
126
+ - spec/app/views/partials/_foo.html.erb
127
+ - spec/app/views/partials/index.html.erb
128
+ - spec/controllers/files_note_controller_spec.rb
108
129
  - spec/controllers/footnotes_controller_spec.rb
109
130
  - spec/controllers/log_note_controller_spec.rb
110
131
  - spec/controllers/partials_note_controller_spec.rb
@@ -117,8 +138,6 @@ files:
117
138
  - spec/notes/javascripts_note_spec.rb
118
139
  - spec/notes/stylesheets_note_spec.rb
119
140
  - spec/spec_helper.rb
120
- - spec/views/partials/_foo.html.erb
121
- - spec/views/partials/index.html.erb
122
141
  homepage: http://github.com/josevalim/rails-footnotes
123
142
  licenses: []
124
143
  metadata: {}
@@ -145,6 +164,13 @@ summary: Every Rails page has footnotes that gives information about your applic
145
164
  and links back to your editor.
146
165
  test_files:
147
166
  - spec/abstract_note_spec.rb
167
+ - spec/app/assets/javascripts/foobar.js
168
+ - spec/app/assets/stylesheets/foobar.css
169
+ - spec/app/views/files/index.html.erb
170
+ - spec/app/views/layouts/application.html.erb
171
+ - spec/app/views/partials/_foo.html.erb
172
+ - spec/app/views/partials/index.html.erb
173
+ - spec/controllers/files_note_controller_spec.rb
148
174
  - spec/controllers/footnotes_controller_spec.rb
149
175
  - spec/controllers/log_note_controller_spec.rb
150
176
  - spec/controllers/partials_note_controller_spec.rb
@@ -157,5 +183,3 @@ test_files:
157
183
  - spec/notes/javascripts_note_spec.rb
158
184
  - spec/notes/stylesheets_note_spec.rb
159
185
  - spec/spec_helper.rb
160
- - spec/views/partials/_foo.html.erb
161
- - spec/views/partials/index.html.erb