Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Down to one failure

  • Loading branch information...
commit f5be97af6359ae213d2ff007ba63bdedee197652 1 parent 18191cb
@mike-burns mike-burns authored jyurek committed
View
26 features/regenerating_styles.feature
@@ -25,29 +25,3 @@ Feature: Regenerating styles
Then I see the large avatar on the user show page
When I run the down database migration
Then I see a missing large avatar on the user show page
-
- Scenario: Changing an existing style
- Given I generate a new rails application
- And I have made the following avatar style on the user model:
- """
- thumbnail: '32x32'
- """
- And I upload an avatar to the user model
- When I change the avatar style on the user model to:
- """
- thumbnail: '16x16'
- """
- Then I see a "32x32" thumbnail avatar on the user show page
- When I generate the "change_user_avatar_thumbnail_size" migration
- And the "up" migration for "change_user_avatar_thumbnail_size" is:
- """
- change_style :users, :avatar, thumbnail: '16x16'
- """
- And the "down" migration for "change_user_avatar_thumbnail_size" is:
- """
- change_style :users, :avatar, thumbnail: '32x32'
- """
- And I run the up database migration
- Then I see a "16x16" thumbnail avatar on the user show page
- When I run the down database migration
- Then I see a "32x32" thumbnail avatar on the user show page
View
4 features/step_definitions/rails_steps.rb
@@ -1,4 +1,8 @@
Given /^I generate a new rails application$/ do
+ in_current_dir do
+ FileUtils.rm_rf(APP_NAME)
+ end
+
steps %{
When I run `bundle exec #{new_application_command} #{APP_NAME} --skip-bundle`
And I cd to "#{APP_NAME}"
View
2  lib/paperclip/style_migration.rb
@@ -11,7 +11,7 @@ def initialize(model_class, attachment_name)
@attachment_name = attachment_name
end
- private
+ protected
def self.model_class(table_name)
model_class_name = table_name.to_s.singularize.camelize
View
1  test/schema_test.rb
@@ -8,6 +8,7 @@ class SchemaTest < Test::Unit::TestCase
def setup
super
rebuild_class
+ register_recording_processor
end
def teardown
View
2  test/style_adder_test.rb
@@ -3,6 +3,8 @@
class StyleAdderTest < Test::Unit::TestCase
should 'process the specific style' do
+ register_recording_processor
+
Dummy = rebuild_model styles: { thumbnail: '24x24' }, processors: [:recording]
dummy = Dummy.new
dummy.avatar = File.new(fixture_file("50x50.png"), 'rb')
View
2  test/style_remover_test.rb
@@ -3,6 +3,8 @@
class StyleRemoverTest < Test::Unit::TestCase
should 'process the specific style' do
+ register_recording_processor
+
Dummy = rebuild_model styles: { large: '24x24' }, processors: [:recording]
dummy = Dummy.new
dummy.avatar = File.new(fixture_file("50x50.png"), 'rb')
View
6 test/support/recording_processor.rb
@@ -17,6 +17,8 @@ def self.has_processed?(expected_style_hash)
end
end
-Paperclip.configure do |c|
- c.register_processor :recording, RecordingProcessor
+def register_recording_processor
+ Paperclip.configure do |c|
+ c.register_processor :recording, RecordingProcessor
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.