Sha256: 631fd014b18e52bcd99ef1e6ec558b76bdc0fb526e5c18a4a1873943fe3f3568

Contents?: true

Size: 1.29 KB

Versions: 22

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'

module Spree
  class Test
  end
  module Submodule
    class Test
    end
  end
end

module Spree
  module Admin
    describe Resource, type: :model do
      let(:resource_base) { Resource.new('spree/admin/test', 'test', 'widget') }
      let(:resource_submodule) { Resource.new('spree/admin/submodule/test', 'test', 'widget') }
      let(:resource_object_name) { Resource.new('spree/admin/test', 'test', 'gadget', 'widget') }

      it "can get base model class" do
        expect(resource_base.model_class).to eq(Spree::Test)
      end

      it "can get submodule class" do
        expect(resource_submodule.model_class).to eq(Spree::Submodule::Test)
      end

      it "can get base model name (only used for parent)" do
        expect(resource_base.model_name).to eq('widget')
      end

      it "can get submodule model name (only used for parent)" do
        expect(resource_submodule.model_name).to eq('widget')
      end

      it "can get base object name" do
        expect(resource_base.object_name).to eq('test')
      end

      it "can get submodule object name" do
        expect(resource_submodule.object_name).to eq('submodule_test')
      end

      it "can get overridden object name" do
        expect(resource_object_name.object_name).to eq('widget')
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
spree_backend-3.3.0.rc1 spec/models/spree/resource_spec.rb
spree_backend-3.1.5 spec/models/spree/resource_spec.rb
spree_backend-3.2.1 spec/models/spree/resource_spec.rb
spree_backend-3.2.0 spec/models/spree/resource_spec.rb
spree_backend-3.1.4 spec/models/spree/resource_spec.rb
spree_backend-3.2.0.rc3 spec/models/spree/resource_spec.rb
spree_backend-3.2.0.rc2 spec/models/spree/resource_spec.rb
spree_backend-3.2.0.rc1 spec/models/spree/resource_spec.rb
spree_backend-3.1.3 spec/models/spree/resource_spec.rb
spree_backend-3.1.2 spec/models/spree/resource_spec.rb
spree_backend-3.0.10 spec/models/spree/resource_spec.rb
spree_backend-3.1.1 spec/models/spree/resource_spec.rb
spree_backend-3.1.0 spec/models/spree/resource_spec.rb
spree_backend-3.1.0.rc4 spec/models/spree/resource_spec.rb
spree_backend-3.0.9 spec/models/spree/resource_spec.rb
spree_backend-3.1.0.rc3 spec/models/spree/resource_spec.rb
spree_backend-3.1.0.rc2 spec/models/spree/resource_spec.rb
spree_backend-3.1.0.rc1 spec/models/spree/resource_spec.rb
spree_backend-3.0.8 spec/models/spree/resource_spec.rb
spree_backend-3.0.7 spec/models/spree/resource_spec.rb