Sha256: 76f21a550fd0128c8fd9aa37123e7b54f8c00956c78582dafa8912d2c6cd7698

Contents?: true

Size: 649 Bytes

Versions: 2

Compression:

Stored size: 649 Bytes

Contents

require 'spec_helper'

describe SampleController do
  describe "GET to :index" do
    controller do
      def index
        render :nothing => true
      end
    end

    it 'calls around filter method' do
      controller.should_receive(:handle_timecop_offset)

      get :index
    end
  end

  describe "#handle_timecop_offset" do
    controller do
      def index
        raise Time.zone.now.to_s
      end
    end

    it 'sets proper time inside action method' do
      frozen_time = 1.year.from_now

      session[TimecopConsole::SESSION_KEY_NAME] = frozen_time

      expect { get :index }.to raise_error(frozen_time.to_s)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
timecop-console-0.3.1 spec/controllers/sample_controller_spec.rb
timecop-console-0.3.0 spec/controllers/sample_controller_spec.rb