Sha256: 391875ccf42e7e3e13fa5a0d4698e552e885e613a548e0f5903e383422a99f39

Contents?: true

Size: 694 Bytes

Versions: 8

Compression:

Stored size: 694 Bytes

Contents

require 'spec_helper'
require 'thoth/rails/railtie'

DummyUser = Struct.new(:id)
class ControllerWithThothContextController < ActionController::Base
  include Thoth::Rails::ControllerContext

  def show
    @context = Thoth.context
    head 200
  end

  def current_user
    DummyUser.new(1)
  end
end

describe ControllerWithThothContextController, type: :controller do
  before do
    routes.draw { get "show" => "controller_with_thoth_context#show" }
  end

  context "on any action" do
    it "stores params in the Thoth.context" do
      get :show
      expect(assigns(:context)).to eq({"controller"=>"controller_with_thoth_context", "action"=>"show", "current_user"=>1})
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
thoth-1.0.2 spec/thoth/rails/controller_context_spec.rb
thoth-1.0.1 spec/thoth/rails/controller_context_spec.rb
thoth-1.0.0 spec/thoth/rails/controller_context_spec.rb
thoth-0.0.7 spec/thoth/rails/controller_context_spec.rb
thoth-0.0.6 spec/thoth/rails/controller_context_spec.rb
thoth-0.0.5 spec/thoth/rails/controller_context_spec.rb
thoth-0.0.3 spec/thoth/rails/controller_context_spec.rb
thoth-0.0.2 spec/thoth/rails/controller_context_spec.rb