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.
- checksums.yaml +5 -5
- data/.github/workflows/ci.yml +25 -0
- data/.gitignore +4 -3
- data/CHANGELOG +8 -0
- data/Gemfile +8 -1
- data/Gemfile.lock +187 -0
- data/README.rdoc +8 -54
- data/Rakefile +1 -6
- data/bin/rake +29 -0
- data/bin/rspec +29 -0
- data/gemfiles/{Gemfile.rails-3.2.x → Gemfile.rails-3.2.22} +1 -1
- data/lib/generators/templates/rails_footnotes.rb +4 -5
- data/lib/rails-footnotes.rb +9 -9
- data/lib/rails-footnotes/extension.rb +8 -11
- data/lib/rails-footnotes/filter.rb +13 -4
- data/lib/rails-footnotes/notes/assigns_note.rb +2 -2
- data/lib/rails-footnotes/notes/files_note.rb +12 -23
- data/lib/rails-footnotes/notes/log_note.rb +1 -1
- data/lib/rails-footnotes/notes/params_note.rb +5 -1
- data/lib/rails-footnotes/notes/queries_note.rb +9 -10
- data/lib/rails-footnotes/notes/view_note.rb +16 -7
- data/lib/rails-footnotes/version.rb +1 -1
- data/lib/rails6-footnotes.rb +1 -0
- data/rails-footnotes.gemspec +5 -10
- data/spec/abstract_note_spec.rb +17 -13
- data/spec/app/assets/config/manifest.js +2 -0
- data/spec/app/assets/javascripts/foobar.js +1 -0
- data/spec/app/assets/stylesheets/foobar.css +0 -0
- data/spec/app/views/files/index.html.erb +1 -0
- data/spec/app/views/layouts/application.html.erb +12 -0
- data/spec/{views → app/views}/partials/_foo.html.erb +0 -0
- data/spec/{views → app/views}/partials/index.html.erb +0 -0
- data/spec/controllers/files_note_controller_spec.rb +38 -0
- data/spec/controllers/footnotes_controller_spec.rb +49 -34
- data/spec/controllers/log_note_controller_spec.rb +4 -8
- data/spec/controllers/partials_note_controller_spec.rb +2 -3
- data/spec/env_note_spec.rb +4 -4
- data/spec/footnotes_spec.rb +38 -54
- data/spec/notes/assigns_note_spec.rb +13 -9
- data/spec/notes/controller_note_spec.rb +2 -2
- data/spec/notes/files_note_spec.rb +12 -3
- data/spec/notes/javascripts_note_spec.rb +1 -1
- data/spec/notes/stylesheets_note_spec.rb +1 -1
- data/spec/notes/view_note_spec.rb +18 -0
- data/spec/spec_helper.rb +35 -3
- metadata +38 -48
- data/.travis.yml +0 -14
@@ -5,7 +5,7 @@ require "rails-footnotes/notes/assigns_note"
|
|
5
5
|
describe Footnotes::Notes::AssignsNote do
|
6
6
|
let(:note) do
|
7
7
|
@controller = double
|
8
|
-
@controller.
|
8
|
+
allow(@controller).to receive(:instance_variables).and_return([:@action_has_layout, :@status])
|
9
9
|
@controller.instance_variable_set(:@action_has_layout, true)
|
10
10
|
@controller.instance_variable_set(:@status, 200)
|
11
11
|
Footnotes::Notes::AssignsNote.new(@controller)
|
@@ -15,31 +15,35 @@ describe Footnotes::Notes::AssignsNote do
|
|
15
15
|
before(:each) {Footnotes::Notes::AssignsNote.ignored_assigns = []}
|
16
16
|
|
17
17
|
it {should be_valid}
|
18
|
-
its(:title) {should eql 'Assigns (2)'}
|
19
18
|
|
20
|
-
|
21
|
-
|
19
|
+
describe '#title' do
|
20
|
+
subject { super().title }
|
21
|
+
it {should eql 'Assigns (2)'}
|
22
|
+
end
|
23
|
+
|
24
|
+
specify {expect(note.send(:assigns)).to eql [:@action_has_layout, :@status]}
|
25
|
+
specify {expect(note.send(:to_table)).to eql [
|
22
26
|
["Name", "Value"],
|
23
27
|
["<strong>@action_has_layout</strong><br /><em>TrueClass</em>", "true"],
|
24
|
-
["<strong>@status</strong><br /><em>
|
28
|
+
["<strong>@status</strong><br /><em>Integer</em>", "200"]
|
25
29
|
]}
|
26
30
|
|
27
31
|
describe "Ignored Assigns" do
|
28
32
|
before(:each) {Footnotes::Notes::AssignsNote.ignored_assigns = [:@status]}
|
29
|
-
it {note.send(:assigns).
|
33
|
+
it {expect(note.send(:assigns)).not_to include :@status}
|
30
34
|
end
|
31
35
|
|
32
36
|
describe "Ignored Assigns by regexp" do
|
33
37
|
before(:each) {Footnotes::Notes::AssignsNote.ignored_assigns_pattern = /^@status$/}
|
34
|
-
it {note.send(:assigns).
|
38
|
+
it {expect(note.send(:assigns)).not_to include :@status}
|
35
39
|
end
|
36
40
|
|
37
41
|
it "should call #mount_table method with correct params" do
|
38
|
-
note.
|
42
|
+
expect(note).to receive(:mount_table).with(
|
39
43
|
[
|
40
44
|
["Name", "Value"],
|
41
45
|
["<strong>@action_has_layout</strong><br /><em>TrueClass</em>", "true"],
|
42
|
-
["<strong>@status</strong><br /><em>
|
46
|
+
["<strong>@status</strong><br /><em>Integer</em>", "200"]
|
43
47
|
], {:summary=>"Debug information for Assigns (2)"})
|
44
48
|
note.content
|
45
49
|
end
|
@@ -5,8 +5,8 @@ describe Footnotes::Notes::ControllerNote do
|
|
5
5
|
# Issue #60
|
6
6
|
it "should not be valid if conftroller file not exist" do
|
7
7
|
note = Footnotes::Notes::ControllerNote.new(double)
|
8
|
-
note.
|
8
|
+
allow(note).to receive(:controller_filename).and_return(nil)
|
9
9
|
|
10
|
-
note.
|
10
|
+
expect(note).not_to be_valid
|
11
11
|
end
|
12
12
|
end
|
@@ -2,16 +2,25 @@ require 'spec_helper'
|
|
2
2
|
require 'action_controller'
|
3
3
|
require "rails-footnotes/notes/files_note"
|
4
4
|
|
5
|
+
class ConcreteFilesNote < Footnotes::Notes::FilesNote
|
6
|
+
def scan_text(text)
|
7
|
+
[]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
5
11
|
describe Footnotes::Notes::FilesNote do
|
6
12
|
|
7
13
|
let(:note) do
|
8
|
-
|
9
|
-
Footnotes::Notes::FilesNote.new(double('controller', :response => double('', :body => '')))
|
14
|
+
ConcreteFilesNote.new(double('controller', :response => double('', :body => '')))
|
10
15
|
end
|
11
16
|
|
12
17
|
subject { note }
|
13
18
|
|
14
19
|
it { should be_valid }
|
15
|
-
|
20
|
+
|
21
|
+
describe '#row' do
|
22
|
+
subject { super().row }
|
23
|
+
it { should eql :edit }
|
24
|
+
end
|
16
25
|
|
17
26
|
end
|
@@ -8,7 +8,7 @@ describe Footnotes::Notes::JavascriptsNote do
|
|
8
8
|
it {should be_valid}
|
9
9
|
|
10
10
|
it "should return js links from html after #scan_text mehtod call" do
|
11
|
-
subject.send(:scan_text, HTML_WITH_JS).
|
11
|
+
expect(subject.send(:scan_text, HTML_WITH_JS)).to eql ['/javascripts/all.js', '/javascripts/jquery.js']
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -9,7 +9,7 @@ describe Footnotes::Notes::StylesheetsNote do
|
|
9
9
|
it {should be_valid}
|
10
10
|
|
11
11
|
it "should return css link from html text after #scan_text call" do
|
12
|
-
subject.send(:scan_text, HTML_WITH_CSS).
|
12
|
+
expect(subject.send(:scan_text, HTML_WITH_CSS)).to eql ['/stylesheets/compiled/print.css', '/stylesheets/compiled/print.css']
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "rails-footnotes/notes/view_note"
|
3
|
+
|
4
|
+
describe Footnotes::Notes::ViewNote do
|
5
|
+
it "should not be valid if view file not exist" do
|
6
|
+
note = Footnotes::Notes::ViewNote.new(double)
|
7
|
+
allow(note).to receive(:filename).and_return(nil)
|
8
|
+
|
9
|
+
expect(note).not_to be_valid
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should not explode if template is nil" do
|
13
|
+
Footnotes::Notes::ViewNote.template = nil
|
14
|
+
|
15
|
+
note = Footnotes::Notes::ViewNote.new(double)
|
16
|
+
expect(note).to_not be_valid
|
17
|
+
end
|
18
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -4,12 +4,15 @@ begin
|
|
4
4
|
rescue LoadError
|
5
5
|
end
|
6
6
|
ENV["RAILS_ENV"] ||= 'test'
|
7
|
+
require "sprockets/railtie"
|
7
8
|
require "rails-footnotes"
|
9
|
+
require 'capybara/rspec'
|
8
10
|
|
9
11
|
module FooBar
|
10
12
|
class Application < Rails::Application
|
11
13
|
config.secret_key_base = 'foobar'
|
12
|
-
config.root = Dir.new('
|
14
|
+
config.root = Dir.new('./spec')
|
15
|
+
config.eager_load = false
|
13
16
|
end
|
14
17
|
end
|
15
18
|
|
@@ -17,20 +20,49 @@ ActionController::Base.class_eval do
|
|
17
20
|
include Rails.application.routes.url_helpers
|
18
21
|
end
|
19
22
|
|
23
|
+
class ApplicationController < ActionController::Base
|
24
|
+
end
|
25
|
+
|
26
|
+
module Helpers
|
27
|
+
def page
|
28
|
+
Capybara::Node::Simple.new(response.body)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
20
32
|
RSpec.configure do |config|
|
21
33
|
|
22
34
|
Rails.application.initialize!
|
23
35
|
|
36
|
+
config.include Capybara::DSL
|
37
|
+
config.include Helpers
|
38
|
+
config.example_status_persistence_file_path = ".rspec_results"
|
39
|
+
|
24
40
|
Rails.application.routes.draw do
|
25
41
|
get 'footnotes/foo'
|
26
42
|
get 'footnotes/foo_holder'
|
27
43
|
get 'footnotes/foo_js'
|
28
44
|
get 'footnotes/foo_download'
|
29
45
|
get 'partials/index'
|
46
|
+
get 'files/index'
|
30
47
|
end
|
31
|
-
|
32
48
|
end
|
33
49
|
|
34
50
|
require 'rspec/rails'
|
35
|
-
require 'capybara/rspec'
|
36
51
|
require 'capybara/rails'
|
52
|
+
|
53
|
+
HTML_DOCUMENT = <<EOF
|
54
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
55
|
+
<html>
|
56
|
+
<head>
|
57
|
+
<title>HTML to XHTML Example: HTML page</title>
|
58
|
+
<link rel="Stylesheet" href="htmltohxhtml.css" type="text/css" media="screen">
|
59
|
+
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
60
|
+
</head>
|
61
|
+
<body>
|
62
|
+
<p>This is the HTML page. It works and is encoded just like any HTML page you
|
63
|
+
have previously done. View <a href="htmltoxhtml2.htm">the XHTML version</a> of
|
64
|
+
this page to view the difference between HTML and XHTML.</p>
|
65
|
+
<p>You will be glad to know that no changes need to be made to any of your CSS files.</p>
|
66
|
+
</body>
|
67
|
+
</html>
|
68
|
+
EOF
|
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
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman V. Babenko
|
@@ -9,70 +9,46 @@ authors:
|
|
9
9
|
- Keenan Brock
|
10
10
|
- Duane Johnson
|
11
11
|
- Adrien Siami
|
12
|
-
|
12
|
+
- André Arko
|
13
|
+
autorequire:
|
13
14
|
bindir: bin
|
14
15
|
cert_chain: []
|
15
|
-
date:
|
16
|
+
date: 2021-08-23 00:00:00.000000000 Z
|
16
17
|
dependencies:
|
17
18
|
- !ruby/object:Gem::Dependency
|
18
19
|
name: rails
|
19
|
-
requirement: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: '3.2'
|
24
|
-
type: :runtime
|
25
|
-
prerelease: false
|
26
|
-
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
requirements:
|
28
|
-
- - ">="
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: '3.2'
|
31
|
-
- !ruby/object:Gem::Dependency
|
32
|
-
name: rspec-rails
|
33
20
|
requirement: !ruby/object:Gem::Requirement
|
34
21
|
requirements:
|
35
22
|
- - "~>"
|
36
23
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
38
|
-
type: :
|
24
|
+
version: '6.0'
|
25
|
+
type: :runtime
|
39
26
|
prerelease: false
|
40
27
|
version_requirements: !ruby/object:Gem::Requirement
|
41
28
|
requirements:
|
42
29
|
- - "~>"
|
43
30
|
- !ruby/object:Gem::Version
|
44
|
-
version:
|
45
|
-
- !ruby/object:Gem::Dependency
|
46
|
-
name: capybara
|
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'
|
31
|
+
version: '6.0'
|
59
32
|
description: Every Rails page has footnotes that gives information about your application
|
60
33
|
and links back to your editor.
|
61
34
|
email:
|
62
|
-
-
|
35
|
+
- andre@arko.net
|
63
36
|
executables: []
|
64
37
|
extensions: []
|
65
38
|
extra_rdoc_files: []
|
66
39
|
files:
|
40
|
+
- ".github/workflows/ci.yml"
|
67
41
|
- ".gitignore"
|
68
42
|
- ".rspec.example"
|
69
|
-
- ".travis.yml"
|
70
43
|
- CHANGELOG
|
71
44
|
- Gemfile
|
45
|
+
- Gemfile.lock
|
72
46
|
- MIT-LICENSE
|
73
47
|
- README.rdoc
|
74
48
|
- Rakefile
|
75
|
-
-
|
49
|
+
- bin/rake
|
50
|
+
- bin/rspec
|
51
|
+
- gemfiles/Gemfile.rails-3.2.22
|
76
52
|
- gemfiles/Gemfile.rails-4.0.x
|
77
53
|
- gemfiles/Gemfile.rails-4.1.x
|
78
54
|
- gemfiles/Gemfile.rails-4.2.x
|
@@ -103,8 +79,17 @@ files:
|
|
103
79
|
- lib/rails-footnotes/notes/stylesheets_note.rb
|
104
80
|
- lib/rails-footnotes/notes/view_note.rb
|
105
81
|
- lib/rails-footnotes/version.rb
|
82
|
+
- lib/rails6-footnotes.rb
|
106
83
|
- rails-footnotes.gemspec
|
107
84
|
- spec/abstract_note_spec.rb
|
85
|
+
- spec/app/assets/config/manifest.js
|
86
|
+
- spec/app/assets/javascripts/foobar.js
|
87
|
+
- spec/app/assets/stylesheets/foobar.css
|
88
|
+
- spec/app/views/files/index.html.erb
|
89
|
+
- spec/app/views/layouts/application.html.erb
|
90
|
+
- spec/app/views/partials/_foo.html.erb
|
91
|
+
- spec/app/views/partials/index.html.erb
|
92
|
+
- spec/controllers/files_note_controller_spec.rb
|
108
93
|
- spec/controllers/footnotes_controller_spec.rb
|
109
94
|
- spec/controllers/log_note_controller_spec.rb
|
110
95
|
- spec/controllers/partials_note_controller_spec.rb
|
@@ -116,35 +101,41 @@ files:
|
|
116
101
|
- spec/notes/files_note_spec.rb
|
117
102
|
- spec/notes/javascripts_note_spec.rb
|
118
103
|
- spec/notes/stylesheets_note_spec.rb
|
104
|
+
- spec/notes/view_note_spec.rb
|
119
105
|
- spec/spec_helper.rb
|
120
|
-
|
121
|
-
- spec/views/partials/index.html.erb
|
122
|
-
homepage: http://github.com/josevalim/rails-footnotes
|
106
|
+
homepage: http://github.com/indirect/rails-footnotes
|
123
107
|
licenses: []
|
124
108
|
metadata: {}
|
125
|
-
post_install_message:
|
109
|
+
post_install_message:
|
126
110
|
rdoc_options: []
|
127
111
|
require_paths:
|
128
112
|
- lib
|
129
113
|
required_ruby_version: !ruby/object:Gem::Requirement
|
130
114
|
requirements:
|
131
|
-
- - "
|
115
|
+
- - "~>"
|
132
116
|
- !ruby/object:Gem::Version
|
133
|
-
version: '0'
|
117
|
+
version: '3.0'
|
134
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
119
|
requirements:
|
136
120
|
- - ">="
|
137
121
|
- !ruby/object:Gem::Version
|
138
122
|
version: '0'
|
139
123
|
requirements: []
|
140
|
-
|
141
|
-
|
142
|
-
signing_key:
|
124
|
+
rubygems_version: 3.2.23
|
125
|
+
signing_key:
|
143
126
|
specification_version: 4
|
144
127
|
summary: Every Rails page has footnotes that gives information about your application
|
145
128
|
and links back to your editor.
|
146
129
|
test_files:
|
147
130
|
- spec/abstract_note_spec.rb
|
131
|
+
- spec/app/assets/config/manifest.js
|
132
|
+
- spec/app/assets/javascripts/foobar.js
|
133
|
+
- spec/app/assets/stylesheets/foobar.css
|
134
|
+
- spec/app/views/files/index.html.erb
|
135
|
+
- spec/app/views/layouts/application.html.erb
|
136
|
+
- spec/app/views/partials/_foo.html.erb
|
137
|
+
- spec/app/views/partials/index.html.erb
|
138
|
+
- spec/controllers/files_note_controller_spec.rb
|
148
139
|
- spec/controllers/footnotes_controller_spec.rb
|
149
140
|
- spec/controllers/log_note_controller_spec.rb
|
150
141
|
- spec/controllers/partials_note_controller_spec.rb
|
@@ -156,6 +147,5 @@ test_files:
|
|
156
147
|
- spec/notes/files_note_spec.rb
|
157
148
|
- spec/notes/javascripts_note_spec.rb
|
158
149
|
- spec/notes/stylesheets_note_spec.rb
|
150
|
+
- spec/notes/view_note_spec.rb
|
159
151
|
- spec/spec_helper.rb
|
160
|
-
- spec/views/partials/_foo.html.erb
|
161
|
-
- spec/views/partials/index.html.erb
|
data/.travis.yml
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
script: "bundle exec rake spec"
|
2
|
-
rvm:
|
3
|
-
- 1.9.3
|
4
|
-
- 2.0.0
|
5
|
-
- 2.1.1
|
6
|
-
gemfile:
|
7
|
-
- gemfiles/Gemfile.rails-3.2.x
|
8
|
-
- gemfiles/Gemfile.rails-4.0.x
|
9
|
-
- gemfiles/Gemfile.rails-4.1.x
|
10
|
-
- gemfiles/Gemfile.rails-4.2.x
|
11
|
-
- gemfiles/Gemfile.rails-edge
|
12
|
-
matrix:
|
13
|
-
allow_failures:
|
14
|
-
- gemfile: gemfiles/Gemfile.rails-edge
|