Skip to content
This repository has been archived by the owner on Dec 20, 2019. It is now read-only.
/ fixcha Public archive

Fixture helpers for RSpec/Paperclip/Rails/Rack::Test.

Notifications You must be signed in to change notification settings

tomdalling/fixcha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fixcha

Fixture helpers for RSpec/Paperclip/Rails/Rack::Test.

#
# Rack::Test
#
RSpec.describe '/whatever' do
  it 'does the thing' do
    # NO
    post '/whatever', {
      thing: fixture_file_upload(Rails.root.join('files/spongebob.png'), 'image/png')
    }


    # YES
    post '/whatever', {
      thing: fixcha('files/spongebob.png').to_upload # content type is inferred
    }
  end
end
#
# Paperclip
#

# NO
FactoryBot.create(:my_model,
  paperclip_attr: File.open(Rails.root.join('files/spongebob.png'))
)

# YES
FactoryBot.create(:my_model,
  paperclip_attr: fixcha('files/spongebob.png')
)

About

Fixture helpers for RSpec/Paperclip/Rails/Rack::Test.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages