Sha256: e67bd6b831e0616531364eb7612d257fc9d45ddcd9d2d2afe78e2ac9e55febed

Contents?: true

Size: 851 Bytes

Versions: 62

Compression:

Stored size: 851 Bytes

Contents

require 'test_helper'

module Workarea
  module Admin
    module Dashboards
      class MarketingViewModelTest < TestCase
        def test_email_signups
          create_email_signup(created_at: Time.zone.local(2018, 12, 31))
          create_email_signup(created_at: Time.zone.local(2019, 1, 3))
          create_email_signup(created_at: Time.zone.local(2019, 1, 9))
          create_email_signup(created_at: Time.zone.local(2019, 1, 10))
          travel_to Time.zone.local(2019, 1, 10)

          view_model = MarketingViewModel.new
          assert_equal(2, view_model.email_signups)
          assert_equal(100, view_model.email_signups_percent_change)
          assert_equal(
            { Date.new(2019, 1, 3) => 1, Date.new(2019, 1, 9) => 1 },
            view_model.email_signups_graph_data
          )
        end
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.5.26 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.45 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.5.25 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.5.23 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.44 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.5.22 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.43 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.5.21 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.42 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.5.20 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.41 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.5.19 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.40 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.5.18 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.39 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.5.17 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.38 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.5.16 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.37 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb