Updated

spec/support / paperclip.rb

A
39 lines of codes
5 methods
1.6 complexity/method
3 churn
8.1 complexity
36 duplications
require 'paperclip/matchers' require 'fileutils' module PaperclipHelpers
  1. PaperclipHelpers has no descriptive comment
def commons_image_fixture_path(filename)
  1. PaperclipHelpers#commons_image_fixture_path doesn't depend on instance state (maybe move it to another class?)
Rails.root.join('spec', 'fixtures', 'images', 'debate_outcome', filename) end def commons_default_image_url
  1. PaperclipHelpers#commons_default_image_url doesn't depend on instance state (maybe move it to another class?)
ActionController::Base.helpers.image_url('graphics/graphic_house-of-commons.jpg') end def commons_image_file commons_image_fixture_path 'commons_image-2x.jpg' end def commons_image_file_too_small commons_image_fixture_path 'commons_image-too-small.jpg' end def commons_image_file_wrong_ratio commons_image_fixture_path 'commons_image-wrong-ratio.jpg' end end RSpec.configure do |config| config.include PaperclipHelpers config.include Paperclip::Shoulda::Matchers config.before(:suite) do
  1. Similar code found in 2 nodes Locations: 0 1
FileUtils.mkdir_p "#{Rails.root}/public/test" Paperclip::Attachment.default_options[:url] = '/test/:class/:attachment/:id_partition/:style/:filename' end config.after(:suite) do
  1. Similar code found in 2 nodes Locations: 0 1
FileUtils.rm_rf "#{Rails.root}/public/test" Paperclip::Attachment.default_options[:url] = '/system/:class/:attachment/:id_partition/:style/:filename' end end