Skip to content

Commit

Permalink
Fix the fixture issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-burns committed Oct 28, 2011
1 parent 093a14a commit af689b4
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 63 deletions.
28 changes: 14 additions & 14 deletions gemfiles/rails2.gemfile
Expand Up @@ -2,24 +2,24 @@

source "http://rubygems.org"

gem "sqlite3", "~>1.3.4"
gem "fakeweb", :require=>false
gem "rails", "~> 2.3.14"
gem "activerecord", :require=>"active_record"
gem "appraisal"
gem "aruba"
gem "aws-s3", :require=>"aws/s3"
gem "bundler"
gem "pry"
gem "cocaine", "~>0.2"
gem "fog"
gem "jruby-openssl", :platform=>:jruby
gem "rake"
gem "shoulda"
gem "mime-types"
gem "aruba"
gem "jruby-openssl", :platform=>:jruby
gem "paperclip", :path=>"../"
gem "mocha"
gem "rake"
gem "bundler"
gem "fog"
gem "cucumber", "~> 1.0.0"
gem "appraisal"
gem "aws-s3", :require=>"aws/s3"
gem "rdoc", :require=>false
gem "capybara"
gem "cucumber", "~> 1.0.0"
gem "shoulda"
gem "sqlite3", "~>1.3.4"
gem "fakeweb", :require=>false
gem "pry"
gem "rails", "~> 2.3.14"
gem "paperclip", :path=>"../"

28 changes: 14 additions & 14 deletions gemfiles/rails3.gemfile
Expand Up @@ -2,24 +2,24 @@

source "http://rubygems.org"

gem "sqlite3", "~>1.3.4"
gem "fakeweb", :require=>false
gem "rails", "~> 3.0.10"
gem "activerecord", :require=>"active_record"
gem "appraisal"
gem "aruba"
gem "aws-s3", :require=>"aws/s3"
gem "bundler"
gem "pry"
gem "cocaine", "~>0.2"
gem "fog"
gem "jruby-openssl", :platform=>:jruby
gem "rake"
gem "shoulda"
gem "mime-types"
gem "aruba"
gem "jruby-openssl", :platform=>:jruby
gem "paperclip", :path=>"../"
gem "mocha"
gem "rake"
gem "bundler"
gem "fog"
gem "cucumber", "~> 1.0.0"
gem "appraisal"
gem "aws-s3", :require=>"aws/s3"
gem "rdoc", :require=>false
gem "capybara"
gem "cucumber", "~> 1.0.0"
gem "shoulda"
gem "sqlite3", "~>1.3.4"
gem "fakeweb", :require=>false
gem "pry"
gem "rails", "~> 3.0.10"
gem "paperclip", :path=>"../"

28 changes: 14 additions & 14 deletions gemfiles/rails3_1.gemfile
Expand Up @@ -2,24 +2,24 @@

source "http://rubygems.org"

gem "sqlite3", "~>1.3.4"
gem "fakeweb", :require=>false
gem "rails", "~> 3.1.0"
gem "activerecord", :require=>"active_record"
gem "appraisal"
gem "aruba"
gem "aws-s3", :require=>"aws/s3"
gem "bundler"
gem "pry"
gem "cocaine", "~>0.2"
gem "fog"
gem "jruby-openssl", :platform=>:jruby
gem "rake"
gem "shoulda"
gem "mime-types"
gem "aruba"
gem "jruby-openssl", :platform=>:jruby
gem "paperclip", :path=>"../"
gem "mocha"
gem "rake"
gem "bundler"
gem "fog"
gem "cucumber", "~> 1.0.0"
gem "appraisal"
gem "aws-s3", :require=>"aws/s3"
gem "rdoc", :require=>false
gem "capybara"
gem "cucumber", "~> 1.0.0"
gem "shoulda"
gem "sqlite3", "~>1.3.4"
gem "fakeweb", :require=>false
gem "pry"
gem "rails", "~> 3.1.0"
gem "paperclip", :path=>"../"

4 changes: 4 additions & 0 deletions test/helper.rb
Expand Up @@ -152,3 +152,7 @@ def with_exitstatus_returning(code)
`ruby -e 'exit #{saved_exitstatus.to_i}'`
end
end

def fixture_file(filename)
File.join(File.dirname(__FILE__), 'fixtures', filename)
end
4 changes: 2 additions & 2 deletions test/storage/filesystem_test.rb
Expand Up @@ -6,7 +6,7 @@ class FileSystemTest < Test::Unit::TestCase
rebuild_model :styles => { :thumbnail => "25x25#" }
@dummy = Dummy.create!

@dummy.avatar = File.open(File.join(File.dirname(__FILE__), "..", "fixtures", "5k.png"))
@dummy.avatar = File.open(fixture_file('5k.png'))
end

should "allow file assignment" do
Expand Down Expand Up @@ -36,7 +36,7 @@ class FileSystemTest < Test::Unit::TestCase
rebuild_model :styles => { :thumbnail => "25x25#" }
@dummy = Dummy.create!

@dummy.avatar = File.open(File.join(File.dirname(__FILE__), "..", "fixtures", "spaced file.png"))
@dummy.avatar = File.open(fixture_file('spaced file.png'))
@dummy.save
end

Expand Down
14 changes: 7 additions & 7 deletions test/storage/fog_test.rb
Expand Up @@ -12,9 +12,9 @@ class FogTest < Test::Unit::TestCase
:storage => :fog,
:url => '/:attachment/:filename',
:fog_directory => "paperclip",
:fog_credentials => File.join(File.dirname(__FILE__), 'fixtures', 'fog.yml')
:fog_credentials => fixture_file('fog.yml')
@dummy = Dummy.new
@dummy.avatar = File.new(File.join(File.dirname(__FILE__), 'fixtures', '5k.png'), 'rb')
@dummy.avatar = File.new(fixture_file('5k.png'), 'rb')
end

should "have the proper information loading credentials from a file" do
Expand All @@ -28,9 +28,9 @@ class FogTest < Test::Unit::TestCase
:storage => :fog,
:url => '/:attachment/:filename',
:fog_directory => "paperclip",
:fog_credentials => File.open(File.join(File.dirname(__FILE__), 'fixtures', 'fog.yml'))
:fog_credentials => File.open(fixture_file('fog.yml'))
@dummy = Dummy.new
@dummy.avatar = File.new(File.join(File.dirname(__FILE__), 'fixtures', '5k.png'), 'rb')
@dummy.avatar = File.new(fixture_file('5k.png'), 'rb')
end

should "have the proper information loading credentials from a file" do
Expand All @@ -50,10 +50,10 @@ class FogTest < Test::Unit::TestCase
:aws_secret_access_key => 'AWS_SECRET'
}
@dummy = Dummy.new
@dummy.avatar = File.new(File.join(File.dirname(__FILE__), 'fixtures', '5k.png'), 'rb')
@dummy.avatar = File.new(fixture_file('5k.png'), 'rb')
end
should "be able to interpolate the path without blowing up" do
assert_equal File.expand_path(File.join(File.dirname(__FILE__), "../public/avatars/5k.png")),
assert_equal File.expand_path(File.join(File.dirname(__FILE__), "../../public/avatars/5k.png")),
@dummy.avatar.path
end

Expand Down Expand Up @@ -98,7 +98,7 @@ class FogTest < Test::Unit::TestCase

context "when assigned" do
setup do
@file = File.new(File.join(File.dirname(__FILE__), 'fixtures', '5k.png'), 'rb')
@file = File.new(fixture_file('5k.png'), 'rb')
@dummy = Dummy.new
@dummy.avatar = @file
end
Expand Down
4 changes: 2 additions & 2 deletions test/storage/s3_live_test.rb
Expand Up @@ -21,7 +21,7 @@ class S3LiveTest < Test::Unit::TestCase

context "when assigned" do
setup do
@file = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', '5k.png'), 'rb')
@file = File.new(fixture_file('5k.png'), 'rb')
@dummy.avatar = @file
end

Expand Down Expand Up @@ -60,7 +60,7 @@ class S3LiveTest < Test::Unit::TestCase

Dummy.delete_all
@dummy = Dummy.new
@dummy.avatar = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', 'spaced file.png'), 'rb')
@dummy.avatar = File.new(fixture_file('spaced file.png'), 'rb')
@dummy.save
end

Expand Down
20 changes: 10 additions & 10 deletions test/storage/s3_test.rb
Expand Up @@ -98,7 +98,7 @@ def rails_env(env)
}

@dummy = Dummy.new
@dummy.avatar = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', '5k.png'), 'rb')
@dummy.avatar = File.new(fixture_file('5k.png'), 'rb')
end

should "return a url containing the correct original file mime type" do
Expand All @@ -122,7 +122,7 @@ def rails_env(env)
}

@dummy = Dummy.new
@dummy.avatar = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', 'spaced file.png'), 'rb')
@dummy.avatar = File.new(fixture_file('spaced file.png'), 'rb')
end

should "return an unescaped version for path" do
Expand Down Expand Up @@ -346,7 +346,7 @@ def counter

context "when assigned" do
setup do
@file = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', '5k.png'), 'rb')
@file = File.new(fixture_file('5k.png'), 'rb')
@dummy = Dummy.new
@dummy.avatar = @file
end
Expand Down Expand Up @@ -437,7 +437,7 @@ class AWS::S3::NoSuchBucket < AWS::S3::ResponseError

context "when assigned" do
setup do
@file = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', '5k.png'), 'rb')
@file = File.new(fixture_file('5k.png'), 'rb')
@dummy = Dummy.new
@dummy.avatar = @file
end
Expand Down Expand Up @@ -472,7 +472,7 @@ class AWS::S3::NoSuchBucket < AWS::S3::ResponseError
rails_env('test')

rebuild_model :storage => :s3,
:s3_credentials => Pathname.new(File.join(File.dirname(__FILE__))).join("../fixtures/s3.yml")
:s3_credentials => Pathname.new(fixture_file('s3.yml'))

Dummy.delete_all
@dummy = Dummy.new
Expand All @@ -495,7 +495,7 @@ class AWS::S3::NoSuchBucket < AWS::S3::ResponseError
rails_env('test')

rebuild_model :storage => :s3,
:s3_credentials => File.new(File.join(File.dirname(__FILE__), "../fixtures/s3.yml"))
:s3_credentials => File.new(fixture_file('s3.yml'))

Dummy.delete_all

Expand Down Expand Up @@ -524,7 +524,7 @@ class AWS::S3::NoSuchBucket < AWS::S3::ResponseError

context "when assigned" do
setup do
@file = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', '5k.png'), 'rb')
@file = File.new(fixture_file('5k.png'), 'rb')
@dummy = Dummy.new
@dummy.avatar = @file
end
Expand Down Expand Up @@ -563,7 +563,7 @@ class AWS::S3::NoSuchBucket < AWS::S3::ResponseError

context "when assigned" do
setup do
@file = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', '5k.png'), 'rb')
@file = File.new(fixture_file('5k.png'), 'rb')
@dummy = Dummy.new
@dummy.avatar = @file
end
Expand Down Expand Up @@ -608,7 +608,7 @@ class AWS::S3::NoSuchBucket < AWS::S3::ResponseError

context "when assigned" do
setup do
@file = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', '5k.png'), 'rb')
@file = File.new(fixture_file('5k.png'), 'rb')
@dummy = Dummy.new
@dummy.avatar = @file
end
Expand Down Expand Up @@ -656,7 +656,7 @@ class AWS::S3::NoSuchBucket < AWS::S3::ResponseError

context "when assigned" do
setup do
@file = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', '5k.png'), 'rb')
@file = File.new(fixture_file('5k.png'), 'rb')
@dummy = Dummy.new
@dummy.stubs(:private_attachment? => true)
@dummy.avatar = @file
Expand Down

0 comments on commit af689b4

Please sign in to comment.