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.4.27 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.5.4 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.26 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.5.3 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.25 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.5.2 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.24 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.5.1 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.23 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.22 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.5.0 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.21 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.5.0.beta.1 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.20 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.19 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.18 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.17 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.16 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.15 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb
workarea-admin-3.4.14 test/view_models/workarea/admin/dashboards/marketing_view_model_test.rb