Sha256: babbe194746462ca47375d163c9217ef36c1c935b60c2929c6eda6be920ce5f9

Contents?: true

Size: 694 Bytes

Versions: 2

Compression:

Stored size: 694 Bytes

Contents

require 'abstract_unit'


class ControllerWithBeforeActionAndDefaultUrlOptions < ActionController::Base

  before_action { I18n.locale = params[:locale] }
  after_action { I18n.locale = "en" }

  def target
    render :text => "final response"
  end

  def redirect
    redirect_to :action => "target"
  end

  def default_url_options
    {:locale => "de"}
  end
end

class ControllerWithBeforeActionAndDefaultUrlOptionsTest < ActionController::TestCase

  # This test has its roots in issue #1872
  test "should redirect with correct locale :de" do
    get :redirect, :locale => "de"
    assert_redirected_to "/controller_with_before_action_and_default_url_options/target?locale=de"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activejob-lock-0.0.2 rails/actionpack/test/controller/default_url_options_with_before_action_test.rb
activejob-lock-0.0.1 rails/actionpack/test/controller/default_url_options_with_before_action_test.rb