Sha256: cf7b9e6e330f9d22f55522f484249a59e091a3bc7bf70bf48930a839bdb96658
Contents?: true
Size: 1.1 KB
Versions: 4
Compression:
Stored size: 1.1 KB
Contents
require 'spec_helper' describe "PaperclipDatabase" do describe "Single table inheritance" do before(:example) do create_model_tables :users, :avatars build_model 'User', nil, :avatar, {} Object.const_set('SuperUser', Class.new(User)) @model = SuperUser.new file = File.open(fixture_file('5k.png')) @model.avatar = file @model.save end after(:example) do reset_activerecord reset_database :users, :avatars Object.send(:remove_const, 'SuperUser') end it "has correct association name" do expect(@model.avatar.instance_variable_get(:@paperclip_files_association_name)).to eq 'user_avatar_paperclip_files' end it "has correct model constant" do expect(@model.avatar.instance_variable_get(:@paperclip_file_model).to_s).to eq 'User::UserAvatarPaperclipFile' end it "has correct table name" do expect(@model.avatar.instance_variable_get(:@database_table)).to eq 'avatars' end it "has association" do expect(@model.methods.include?(:user_avatar_paperclip_files)).to be_truthy end end end
Version data entries
4 entries across 4 versions & 1 rubygems