Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip
Commits
3b99151b
Commit
3b99151b
authored
Mar 21, 2014
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only run metaclass specs if AS > 4.1 or Ruby < 2.1
parent
de693b41
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
15 deletions
+31
-15
Gemfile
+2
-0
spec/paperclip/meta_class_spec.rb
+17
-15
spec/spec_helper.rb
+3
-0
spec/support/version_helper.rb
+9
-0
No files found.
Gemfile
View file @
3b99151b
...
...
@@ -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
...
...
spec/paperclip/meta_class_spec.rb
View file @
3b99151b
...
...
@@ -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
spec/spec_helper.rb
View file @
3b99151b
...
...
@@ -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
...
...
spec/support/version_helper.rb
0 → 100644
View file @
3b99151b
module
VersionHelper
def
active_support_version
ActiveSupport
::
VERSION
::
STRING
end
def
ruby_version
RUBY_VERSION
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment