Sha256: a9e3f2d1de56eb85ec61be567b614542741b7dd55735421e08b447c14a00ce2e

Contents?: true

Size: 1.25 KB

Versions: 5

Compression:

Stored size: 1.25 KB

Contents

require 'test_helper'

class DiscoApp::ShopTest < ActiveSupport::TestCase

  def setup
    @shop = disco_app_shops(:widget_store)
  end

  def teardown
    @shop = nil
  end

  test 'shops can be extended via concerns' do
    assert_equal 'Australia', @shop.country.name
  end

  test 'can fetch a list of all of a shops subscriptions' do
    assert_equal 2, @shop.subscriptions.size
  end

  test 'can fetch a shops current subscription' do
    assert_equal 1, @shop.subscriptions.active.size
    assert @shop.current_subscription?
    assert_equal disco_app_subscriptions(:current_widget_store_subscription), @shop.current_subscription
  end

  test 'time_zone helper returns correct time zone instance when known timezone defined' do
    assert_equal 'Australia/Melbourne', @shop.time_zone.name
  end

  test 'time_zone helper returns default Rails timezone when no known timezone defined' do
    assert_equal 'UTC', disco_app_shops(:widget_store_dev).time_zone.name
  end

  test 'locale helper returns correct locale when defined on shop model' do
    assert_equal :sv, disco_app_shops(:widget_store_dev).locale
  end

  test 'locale helper returns correct en locale when no known locale defined' do
    assert_equal :en, disco_app_shops(:widget_store).locale
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
disco_app-0.18.2 test/models/disco_app/shop_test.rb
disco_app-0.18.3 test/models/disco_app/shop_test.rb
disco_app-0.18.6 test/models/disco_app/shop_test.rb
disco_app-0.18.4 test/models/disco_app/shop_test.rb
disco_app-0.18.1 test/models/disco_app/shop_test.rb