Sha256: cbd4a89bd0dc8207e6247045c502f5f5e5a4762f09edbd7bfcf3e709b16ee6b3

Contents?: true

Size: 1.32 KB

Versions: 27

Compression:

Stored size: 1.32 KB

Contents

require 'test_helper'

module Workarea
  module Admin
    class CustomEventsIntegrationTest < Workarea::IntegrationTest
      include Admin::IntegrationTest

      def test_creation
        freeze_time

        assert_difference 'Workarea::Reports::CustomEvent.count', 1 do
          post admin.report_custom_events_path,
            params: {
              custom_event: {
                name: 'Foo',
                occurred_at: 1.week.ago
              }
            }
        end

        custom_event = Workarea::Reports::CustomEvent.first
        assert_equal('Foo', custom_event.name)
        assert_equal(1.week.ago, custom_event.occurred_at)
      end

      def test_updating
        event = Workarea::Reports::CustomEvent.create!(
          name: 'Foo',
          occurred_at: 1.week.ago
        )

        patch admin.report_custom_event_path(id: event.id),
          params: {
            custom_event: {
              name: 'Bar'
            }
          }

        assert_equal('Bar', Workarea::Reports::CustomEvent.first.name)
      end

      def test_deletion
        event = Workarea::Reports::CustomEvent.create!(
          name: 'Foo',
          occurred_at: 1.week.ago
        )

        delete admin.report_custom_event_path(id: event.id)

        assert_equal(0, Workarea::Reports::CustomEvent.count)
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.26 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.25 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.23 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.22 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.21 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.20 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.19 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.18 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.17 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.16 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.15 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.14 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.13 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.12 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.11 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.10 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.9 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.8 test/integration/workarea/admin/custom_events_integration_test.rb
workarea-admin-3.5.7 test/integration/workarea/admin/custom_events_integration_test.rb