Skip to content

Commit be3ae66

Browse files
authored
Merge pull request #2190 from rspec/remove-older-rails
Remove older rails support
2 parents 803849b + 534333b commit be3ae66

File tree

19 files changed

+72
-252
lines changed

19 files changed

+72
-252
lines changed

Gemfile-rails-dependencies

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ when /master/
55
gem "arel", :git => "https://github.com/rails/arel.git"
66
gem "journey", :git => "https://github.com/rails/journey.git"
77
gem "activerecord-deprecated_finders", :git => "https://github.com/rails/activerecord-deprecated_finders.git"
8-
gem "rails-observers", :git => "https://github.com/rails/rails-observers"
98
gem "web-console", :git => "https://github.com/rails/web-console", :group => :development
109
gem 'coffee-rails', :git => "https://github.com/rails/coffee-rails.git"
1110
gem 'rack', :git => 'https://github.com/rack/rack.git'

example_app_generator/generate_action_mailer_specs.rb

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,10 @@ def comment_lines(path, flag, *args)
1515
initializer 'action_mailer.rb', <<-CODE
1616
require "action_view/base"
1717
if ENV['DEFAULT_URL']
18-
if ::Rails::VERSION::STRING < '4.1'
19-
ExampleApp::Application.configure do
20-
config.action_mailer.default_url_options = { :host => ENV['DEFAULT_URL'] }
21-
end
22-
else
23-
Rails.application.configure do
24-
config.action_mailer.default_url_options = { :host => ENV['DEFAULT_URL'] }
25-
end
18+
ExampleApp::Application.configure do
19+
config.action_mailer.default_url_options = { :host => ENV['DEFAULT_URL'] }
2620
end
2721
end
28-
29-
if defined?(ActionMailer) && Rails::VERSION::MAJOR < 4
30-
# This will force the loading of ActionMailer settings
31-
ActionMailer::Base.smtp_settings
32-
end
3322
CODE
3423
gsub_file 'config/initializers/action_mailer.rb',
3524
/ExampleApp/,

example_app_generator/generate_stuff.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ def final_tasks
1919
copy_file 'spec/verify_custom_renderers_spec.rb'
2020
copy_file 'spec/verify_fixture_warning_spec.rb'
2121
run('bin/rake db:migrate')
22-
if ::Rails::VERSION::STRING.to_f < 4.1
23-
run('bin/rake db:migrate RAILS_ENV=test')
24-
end
2522
end
2623

2724
def skip_active_record?
@@ -93,7 +90,6 @@ def using_source_path(path)
9390
generate('model thing name:string')
9491
generate('helper things')
9592
generate('scaffold widget name:string category:string instock:boolean foo_id:integer bar_id:integer --force')
96-
generate('observer widget') if ::Rails::VERSION::STRING.to_f < 4.0
9793
generate('scaffold gadget') # scaffold with no attributes
9894
generate('scaffold ticket original_price:float discounted_price:float')
9995
generate('scaffold admin/account name:string') # scaffold with nested resource

example_app_generator/spec/support/default_preview_path

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,11 @@ require_file_stub 'config/environment' do
2929

3030
# Require the gems listed in Gemfile, including any gems
3131
# you've limited to :test, :development, or :production.
32-
if Rails::VERSION::STRING.to_f < 3.1
33-
Bundler.require(:default, Rails.env)
34-
else
35-
Bundler.require(*Rails.groups)
36-
end
32+
Bundler.require(*Rails.groups)
3733

3834
module ExampleApp
3935
class Application < Rails::Application
4036
config.eager_load = false
41-
config.eager_load_paths.clear if Rails::VERSION::MAJOR < 4
4237

4338
# Don't care if the mailer can't send.
4439
config.action_mailer.raise_delivery_errors = false unless ENV['NO_ACTION_MAILER']

features/matchers/relation_match_array.feature

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ Feature: ActiveRecord::Relation match array
1212
RSpec.describe Widget do
1313
let!(:widgets) { Array.new(3) { Widget.create } }
1414
15-
if ::Rails::VERSION::STRING >= '4'
16-
subject { Widget.all }
17-
else
18-
subject { Widget.scoped }
19-
end
15+
subject { Widget.all }
2016
2117
it "returns all widgets in any order" do
2218
expect(subject).to match_array(widgets)

lib/generators/rspec.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ def self.source_root(path = nil)
1818
@_rspec_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'rspec', generator_name, 'templates'))
1919
end
2020
end
21-
22-
if ::Rails::VERSION::STRING < '3.1'
23-
def module_namespacing
24-
yield if block_given?
25-
end
26-
end
2721
end
2822
end
2923
end

lib/generators/rspec/observer/observer_generator.rb

Lines changed: 0 additions & 13 deletions
This file was deleted.

lib/generators/rspec/observer/templates/observer_spec.rb

Lines changed: 0 additions & 7 deletions
This file was deleted.

lib/generators/rspec/scaffold/templates/routing_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,10 @@
3434
expect(:put => "/<%= ns_table_name %>/1").to route_to("<%= ns_table_name %>#update", :id => "1")
3535
end
3636
37-
<% if Rails::VERSION::STRING > '4' -%>
3837
it "routes to #update via PATCH" do
3938
expect(:patch => "/<%= ns_table_name %>/1").to route_to("<%= ns_table_name %>#update", :id => "1")
4039
end
4140
42-
<% end -%>
4341
it "routes to #destroy" do
4442
expect(:delete => "/<%= ns_table_name %>/1").to route_to("<%= ns_table_name %>#destroy", :id => "1")
4543
end

lib/rspec-rails.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ def setup_preview_path(app)
4747
def config_preview_path?(options)
4848
# We cannot use `respond_to?(:show_previews)` here as it will always
4949
# return `true`.
50-
if ::Rails::VERSION::STRING < '4.2'
51-
::Rails.env.development?
52-
elsif options.show_previews.nil?
50+
if options.show_previews.nil?
5351
options.show_previews = ::Rails.env.development?
5452
else
5553
options.show_previews
@@ -74,7 +72,7 @@ def supports_action_mailer_previews?(config)
7472
# not respond to the method. However, we cannot use
7573
# `config.action_mailer.respond_to?(:preview_path)` here as it will
7674
# always return `true`.
77-
config.respond_to?(:action_mailer) && ::Rails::VERSION::STRING > '4.1'
75+
config.respond_to?(:action_mailer)
7876
end
7977
end
8078
end

0 commit comments

Comments
 (0)