Commit 3b99151b by Jon Yurek

Only run metaclass specs if AS > 4.1 or Ruby < 2.1

parent de693b41
......@@ -10,6 +10,8 @@ gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
gem 'rubysl', :platforms => :rbx
gem 'racc', :platforms => :rbx
gem 'pry'
# Hinting at development dependencies
# Prevents bundler from taking a long-time to resolve
group :development, :test do
......
......@@ -2,27 +2,29 @@ require 'spec_helper'
describe 'Metaclasses' do
context "A meta-class of dummy" do
before do
rebuild_model("Dummy")
reset_class("Dummy")
end
if active_support_version >= "4.1" || ruby_version < "2.1"
before do
rebuild_model("Dummy")
reset_class("Dummy")
end
it "is able to use Paperclip like a normal class" do
@dummy = Dummy.new
it "is able to use Paperclip like a normal class" do
@dummy = Dummy.new
assert_nothing_raised do
rebuild_meta_class_of(@dummy)
assert_nothing_raised do
rebuild_meta_class_of(@dummy)
end
end
end
it "works like any other instance" do
@dummy = Dummy.new
rebuild_meta_class_of(@dummy)
it "works like any other instance" do
@dummy = Dummy.new
rebuild_meta_class_of(@dummy)
assert_nothing_raised do
@dummy.avatar = File.new(fixture_file("5k.png"), 'rb')
assert_nothing_raised do
@dummy.avatar = File.new(fixture_file("5k.png"), 'rb')
end
assert @dummy.save
end
assert @dummy.save
end
end
end
......@@ -10,6 +10,8 @@ require 'ostruct'
ROOT = Pathname(File.expand_path(File.join(File.dirname(__FILE__), '..')))
puts "Testing against version #{ActiveRecord::VERSION::STRING}"
$LOAD_PATH << File.join(ROOT, 'lib')
$LOAD_PATH << File.join(ROOT, 'lib', 'paperclip')
require File.join(ROOT, 'lib', 'paperclip.rb')
......@@ -29,6 +31,7 @@ RSpec.configure do |config|
config.include Assertions
config.include ModelReconstruction
config.include TestData
config.extend VersionHelper
config.extend RailsHelpers::ClassMethods
config.mock_framework = :mocha
config.before(:all) do
......
module VersionHelper
def active_support_version
ActiveSupport::VERSION::STRING
end
def ruby_version
RUBY_VERSION
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment