Sha256: 924aa8e9681fd9c522dec7992e5553fdf4326fcbcdd891d8bc7af8fc6b575e98

Contents?: true

Size: 1.3 KB

Versions: 35

Compression:

Stored size: 1.3 KB

Contents

require "rails_helper"

describe ::Dorsale::CustomerVault::EventsController, type: :controller do
  routes { Dorsale::Engine.routes }

  let(:user) { create(:user) }

  before(:each) { sign_in(user) }

  describe "#filters" do
    before do
      @event1 = create(:customer_vault_event, action: "create")
      @event2 = create(:customer_vault_event, action: "update")
    end

    it "should filter by event_action" do
      cookies[:filters] = {event_action: "create"}.to_json
      get :index
      expect(assigns(:events)).to eq [@event1]
    end

    it "should filter by multiple event_action" do
      cookies[:filters] = {event_action: "create update"}.to_json
      get :index
      expect(assigns(:events)).to contain_exactly(@event1, @event2)
    end
  end # describe "#filters"

  describe "#index" do
    before do
      @corporation1 = create(:customer_vault_corporation)
      @corporation2 = create(:customer_vault_corporation)
      @event1       = create(:customer_vault_event, person: @corporation1, created_at: "2012-02-15")
      @event2       = create(:customer_vault_event, person: @corporation2, created_at: "2012-03-15")
    end

    it "should assigns all events ordered by created_at DESC" do
      get :index
      expect(assigns(:events)).to eq [@event2, @event1]
    end
  end # describe "#index"
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
dorsale-4.0.0 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.20.0 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.19.1 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.19.0 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.18.0 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.17.0 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.16.0 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.15.0 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.14.11 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.14.10 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.14.9 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.14.8 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.14.7 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.14.6 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.14.5 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.14.3 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.14.2 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.14.1 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.14.0 spec/controllers/dorsale/customer_vault/events_controller_spec.rb
dorsale-3.13.0 spec/controllers/dorsale/customer_vault/events_controller_spec.rb