Sha256: 60d76bdf33cd489e4c796a6b16ffa5174708360f491ad406a1f2fce61ed9f709

Contents?: true

Size: 937 Bytes

Versions: 11

Compression:

Stored size: 937 Bytes

Contents

require_relative "../../test_helper"

module RocketJobMissionControl
  class TestController < ApplicationController
    def index
      @time_zone = Time.zone

      render plain: "Time Zoned"
    end
  end

  class ApplicationControllerTest < ActionController::TestCase
    describe TestController do
      describe "#with_time_zone" do
        it "uses correct timezone with session and time_zone set" do
          session["time_zone"] = "America/Los_Angeles"
          get :index
          assert_equal "America/Los_Angeles", assigns(:time_zone).name
        end

        it "uses correct timezone with session, but no time_zone set" do
          session["user_id"] = "42"
          get :index
          assert_equal "UTC", assigns(:time_zone).name
        end

        it "uses correct timezone without a session" do
          get :index
          assert_equal "UTC", assigns(:time_zone).name
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rocketjob_mission_control-6.1.0 test/controllers/rocket_job_mission_control/application_controller_test.rb
rocketjob_mission_control-6.0.7 test/controllers/rocket_job_mission_control/application_controller_test.rb
rocketjob_mission_control-6.0.6 test/controllers/rocket_job_mission_control/application_controller_test.rb
rocketjob_mission_control-6.0.5 test/controllers/rocket_job_mission_control/application_controller_test.rb
rocketjob_mission_control-6.0.4 test/controllers/rocket_job_mission_control/application_controller_test.rb
rocketjob_mission_control-6.0.3 test/controllers/rocket_job_mission_control/application_controller_test.rb
rocketjob_mission_control-6.0.2 test/controllers/rocket_job_mission_control/application_controller_test.rb
rocketjob_mission_control-6.0.1 test/controllers/rocket_job_mission_control/application_controller_test.rb
rocketjob_mission_control-6.0.0 test/controllers/rocket_job_mission_control/application_controller_test.rb
rocketjob_mission_control-6.0.0.beta test/controllers/rocket_job_mission_control/application_controller_test.rb
rocketjob_mission_control-5.0.1 test/controllers/rocket_job_mission_control/application_controller_test.rb