Sha256: 166aa3b0ba1b662d17c7d7a641a047ca77a1e1ad05dc2b505c854575d7469fc8

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe TimecopConsole::MainController do
  before(:each) do
    request.env["HTTP_REFERER"] = "where_i_came_from"
  end

  describe "POST to :update" do
    let(:timecop_param) do
      {
        'current_time(1i)' => 2012,
        'current_time(2i)' => 11,
        'current_time(3i)' => 30,
        'current_time(4i)' => 22,
        'current_time(5i)' => 01
      }
    end

    it 'redirects back' do
      post :update, :timecop => timecop_param, :use_route => :timecop_console

      response.should redirect_to("where_i_came_from")
    end

    context "with backward compatible format" do
      let(:date_params) do
        { year: 2013, month: 8, day: 22, hour: 12, min: 0, sec: 0 }
      end

      it 'redirects back' do
        post :update, date_params.merge(use_route: :timecop_console)

        response.should redirect_to("where_i_came_from")
      end
    end
  end

  describe "GET to :reset" do
    it 'redirects back' do
      get :reset, :use_route => :timecop_console

      response.should redirect_to "where_i_came_from"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
timecop-console-0.3.0 spec/controllers/main_controller_spec.rb