Skip to content

Instantly share code, notes, and snippets.

@frankpinto
Last active September 3, 2015 22:42
Show Gist options
  • Save frankpinto/652d358a0721af2fa42d to your computer and use it in GitHub Desktop.
Save frankpinto/652d358a0721af2fa42d to your computer and use it in GitHub Desktop.
Failing test case w/ environment other than 'test'
require 'test_helper'
class CompanyTest < ActiveSupport::TestCase
def test_save_logo
fixtures_folder = Rails.root + 'test/fixtures/'
test_image_path = File.expand_path 'test-image.png', fixtures_folder
@test_image = File.open test_image_path, 'rb'
company = Company.new(name: 'Logo test')
company.logo = @test_image
#company.save
retrieved = Company.where(name: 'Logo test').first
assert_not_nil retrieved.logo
assert_equal 'test-image.png', retrieved.logo.original_filename
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment