Skip to content

Commit 57d26eb

Browse files
committed
Merge pull request #1379 from rspec/address-yard-issues
Address yard issues
2 parents e692909 + 03d8cbe commit 57d26eb

File tree

8 files changed

+50
-19
lines changed

8 files changed

+50
-19
lines changed

.yardopts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
--no-private
22
--exclude features
33
--exclude lib/generators/([^/]+/)*.*_spec.rb
4+
--exclude lib/generators/([^/]+/)*templates/([^/]+/)*.rb
5+
--exclude lib/generators/([^/]+/)*templates/.+\.rb
46
--markup markdown
57
--template-path yard/template/
68
-

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ gemspec
55
rspec_dependencies_gemfile = File.expand_path("../Gemfile-rspec-dependencies", __FILE__)
66
eval_gemfile rspec_dependencies_gemfile
77

8+
gem 'yard', '~> 0.8.7', :require => false
9+
810
### deps for rdoc.info
911
group :documentation do
10-
gem 'yard', '0.8.7.3', :require => false
1112
gem 'redcarpet', '2.3.0'
1213
gem 'github-markup', '1.0.0'
1314
end

lib/rspec/rails/adapters.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
module RSpec
77
module Rails
8+
# @private
89
def self.disable_testunit_autorun
910
# `Test::Unit::AutoRunner.need_auto_run=` was introduced to the test-unit
1011
# gem in version 2.4.9. Previous to this version `Test::Unit.run=` was

lib/rspec/rails/configuration.rb

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,23 +84,25 @@ def self.initialize_configuration(config)
8484
# but requires this workaround:
8585
config.add_setting :rendering_views, :default => false
8686

87-
def config.render_views=(val)
88-
self.rendering_views = val
89-
end
87+
config.instance_exec do
88+
def render_views=(val)
89+
self.rendering_views = val
90+
end
9091

91-
def config.render_views
92-
self.rendering_views = true
93-
end
92+
def render_views
93+
self.rendering_views = true
94+
end
9495

95-
def config.render_views?
96-
rendering_views
97-
end
96+
def render_views?
97+
rendering_views
98+
end
9899

99-
def config.infer_spec_type_from_file_location!
100-
DIRECTORY_MAPPINGS.each do |type, dir_parts|
101-
escaped_path = Regexp.compile(dir_parts.join('[\\\/]') + '[\\\/]')
102-
define_derived_metadata(:file_path => escaped_path) do |metadata|
103-
metadata[:type] ||= type
100+
def infer_spec_type_from_file_location!
101+
DIRECTORY_MAPPINGS.each do |type, dir_parts|
102+
escaped_path = Regexp.compile(dir_parts.join('[\\\/]') + '[\\\/]')
103+
define_derived_metadata(:file_path => escaped_path) do |metadata|
104+
metadata[:type] ||= type
105+
end
104106
end
105107
end
106108
end

lib/rspec/rails/example/controller_example_group.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
module RSpec
22
module Rails
3+
# @private
4+
ControllerAssertionDelegator = RSpec::Rails::AssertionDelegator.new(
5+
ActionDispatch::Assertions::RoutingAssertions
6+
)
7+
38
# Container module for controller spec functionality.
49
module ControllerExampleGroup
510
extend ActiveSupport::Concern
@@ -9,7 +14,7 @@ module ControllerExampleGroup
914
include RSpec::Rails::Matchers::RedirectTo
1015
include RSpec::Rails::Matchers::RenderTemplate
1116
include RSpec::Rails::Matchers::RoutingMatchers
12-
include RSpec::Rails::AssertionDelegator.new(ActionDispatch::Assertions::RoutingAssertions)
17+
include ControllerAssertionDelegator
1318

1419
# Class-level DSL for controller specs.
1520
module ClassMethods
@@ -117,7 +122,13 @@ def routes
117122
end
118123
end
119124

120-
attr_reader :controller, :routes
125+
# @!attribute [r]
126+
# Returns the controller object instance under test.
127+
attr_reader :controller
128+
129+
# @!attribute [r]
130+
# Returns the Rails routes used for the spec.
131+
attr_reader :routes
121132

122133
# @private
123134
#

lib/rspec/rails/example/routing_example_group.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@
22

33
module RSpec
44
module Rails
5+
# @private
6+
RoutingAssertionDelegator = RSpec::Rails::AssertionDelegator.new(
7+
ActionDispatch::Assertions::RoutingAssertions
8+
)
9+
510
# Container module for routing spec functionality.
611
module RoutingExampleGroup
712
extend ActiveSupport::Concern
813
include RSpec::Rails::RailsExampleGroup
914
include RSpec::Rails::Matchers::RoutingMatchers
1015
include RSpec::Rails::Matchers::RoutingMatchers::RouteHelpers
11-
include RSpec::Rails::AssertionDelegator.new(ActionDispatch::Assertions::RoutingAssertions)
16+
include RSpec::Rails::RoutingAssertionDelegator
1217

1318
# Class-level DSL for route specs.
1419
module ClassMethods
@@ -37,6 +42,8 @@ def routes
3742
end
3843
end
3944

45+
# @!attribute [r]
46+
# @private
4047
attr_reader :routes
4148

4249
# @private

lib/rspec/rails/feature_check.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# @api private
22
module RSpec
33
module Rails
4+
# @private
45
# Disable some cops until https://github.com/bbatsov/rubocop/issues/1310
56
# rubocop:disable Style/IndentationConsistency
67
module FeatureCheck

lib/rspec/rails/view_rendering.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ module Rails
66
module ViewRendering
77
extend ActiveSupport::Concern
88

9-
attr_accessor :controller
9+
# @!attribute [r]
10+
# Returns the controller object instance under test.
11+
attr_reader :controller
12+
13+
# @private
14+
attr_writer :controller
15+
private :controller=
1016

1117
# DSL methods
1218
module ClassMethods

0 commit comments

Comments
 (0)