Sha256: f6d39444abe45da7fed231b1ca7966fa517e45cb2fcbf17af7fe53893d0d03a2
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
require 'spec_helper' describe Partisan::Helper do describe :ClassMethods do describe :parent_class_name do let(:parent_class_name) { Partisan::Helper.send(:parent_class_name, object) } before do run_migration { create_table 'articles' } end context 'with regular record object' do let(:object) { spawn_model('Article', ActiveRecord::Base).new } it { expect(parent_class_name).to eql 'Article' } end context 'with STI-model record object' do let(:object) do spawn_model('Article', ActiveRecord::Base) spawn_model('BlogPost', Article).new end it { expect(parent_class_name).to eql 'Article' } end context 'with a presented record object' do let(:presenter_class) do Class.new(::SimpleDelegator) do alias_method :object, :__getobj__ end end let(:object) do spawn_model('Article', ActiveRecord::Base) presenter_class.new(Article.new) end it { expect(parent_class_name).to eql 'Article' } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
partisan-0.4.2 | spec/partisan/helper_spec.rb |
partisan-0.4.1 | spec/partisan/helper_spec.rb |