Sha256: d77c5c98528618e71cea44fbf73c16b6a1c4b24dbe364915022cb50baed5a61b
Contents?: true
Size: 991 Bytes
Versions: 5
Compression:
Stored size: 991 Bytes
Contents
require 'spec_helper' describe 'rails autoloader' do # can't figure out how to get rails to dump class cache between tests so # we define two different class policy pairs... context "when using const_set" do it 'will find the policy class file if available' do stub_const "AutoLoaderTestClassa", Class.new expect(HyperMesh::AutoConnect.channels(0, nil)).to eq(["AutoLoaderTestClassa"]) end it 'will raise a load error if file does not define the class' do expect { stub_const "AutoLoaderTestClassc", Class.new }.to raise_error(LoadError) end end context "when defining a new class" do it 'will find the policy class if available' do class AutoLoaderTestClassb end expect(HyperMesh::AutoConnect.channels(0, nil)).to eq(["AutoLoaderTestClassb"]) end it 'will raise a load error if file does not define the class' do expect { class AutoLoaderTestClassd; end }.to raise_error(LoadError) end end end
Version data entries
5 entries across 5 versions & 1 rubygems