rails-uploader 0.5.8 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -3
  3. data/lib/generators/uploader/install/templates/20130905144515_create_assets.rb +1 -1
  4. data/lib/uploader/fileupload_glue.rb +22 -0
  5. data/lib/uploader/fileuploads.rb +2 -1
  6. data/lib/uploader/helpers/field_tag.rb +3 -13
  7. data/lib/uploader/version.rb +1 -1
  8. data/spec/dummy/Rakefile +2 -3
  9. data/spec/dummy/app/assets/config/manifest.js +1 -1
  10. data/spec/dummy/app/assets/stylesheets/application.css +7 -5
  11. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  12. data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
  13. data/spec/dummy/app/controllers/application_controller.rb +2 -1
  14. data/spec/dummy/app/jobs/application_job.rb +7 -0
  15. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  16. data/spec/dummy/app/models/application_record.rb +3 -0
  17. data/spec/dummy/app/models/article.rb +1 -1
  18. data/spec/dummy/app/models/asset.rb +1 -1
  19. data/spec/dummy/app/views/layouts/application.html.erb +18 -9
  20. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  21. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  22. data/spec/dummy/app/views/pwa/manifest.json.erb +22 -0
  23. data/spec/dummy/app/views/pwa/service-worker.js +26 -0
  24. data/spec/dummy/bin/rails +4 -0
  25. data/spec/dummy/bin/rake +4 -0
  26. data/spec/dummy/bin/setup +37 -0
  27. data/spec/dummy/config/application.rb +39 -47
  28. data/spec/dummy/config/boot.rb +4 -9
  29. data/spec/dummy/config/cable.yml +10 -0
  30. data/spec/dummy/config/database.yml +20 -13
  31. data/spec/dummy/config/environment.rb +4 -4
  32. data/spec/dummy/config/environments/development.rb +64 -22
  33. data/spec/dummy/config/environments/production.rb +74 -41
  34. data/spec/dummy/config/environments/test.rb +51 -20
  35. data/spec/dummy/config/initializers/assets.rb +12 -0
  36. data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
  37. data/spec/dummy/config/initializers/filter_parameter_logging.rb +8 -0
  38. data/spec/dummy/config/initializers/inflections.rb +10 -9
  39. data/spec/dummy/config/initializers/permissions_policy.rb +13 -0
  40. data/spec/dummy/config/locales/en.yml +28 -2
  41. data/spec/dummy/config/puma.rb +34 -0
  42. data/spec/dummy/config/storage.yml +34 -0
  43. data/spec/dummy/config.ru +4 -2
  44. data/spec/dummy/db/migrate/20120508093830_create_articles.rb +1 -1
  45. data/spec/dummy/db/migrate/20130905144515_create_assets.rb +34 -0
  46. data/spec/dummy/log/test.log +1677 -0
  47. data/spec/dummy/public/404.html +55 -14
  48. data/spec/dummy/public/406-unsupported-browser.html +66 -0
  49. data/spec/dummy/public/422.html +55 -14
  50. data/spec/dummy/public/500.html +54 -13
  51. data/spec/dummy/public/icon.png +0 -0
  52. data/spec/dummy/public/icon.svg +3 -0
  53. data/spec/dummy/public/uploads/picture/data/1/rails.png +0 -0
  54. data/spec/dummy/public/uploads/picture/data/1/thumb_rails.png +0 -0
  55. data/spec/dummy/storage/test.sqlite3 +0 -0
  56. data/spec/dummy/tmp/local_secret.txt +1 -0
  57. data/spec/factories/factories.rb +16 -0
  58. data/spec/fileuploads_spec.rb +20 -22
  59. data/spec/mongoid_spec.rb +2 -2
  60. data/spec/rails_helper.rb +80 -0
  61. data/spec/requests/attachments_controller_spec.rb +4 -4
  62. data/spec/spec_helper.rb +84 -47
  63. metadata +88 -91
  64. data/spec/dummy/README.rdoc +0 -261
  65. data/spec/dummy/app/assets/javascripts/application.js +0 -15
  66. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  67. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  68. data/spec/dummy/config/initializers/secret_token.rb +0 -7
  69. data/spec/dummy/config/initializers/session_store.rb +0 -8
  70. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  71. data/spec/dummy/script/rails +0 -6
  72. data/spec/factories/articles.rb +0 -9
  73. data/spec/factories/assets.rb +0 -11
  74. /data/spec/dummy/{public/favicon.ico → log/development.log} +0 -0
@@ -2,25 +2,66 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>The page you were looking for doesn't exist (404)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
16
54
  </style>
17
55
  </head>
18
56
 
19
- <body>
57
+ <body class="rails-default-error-page">
20
58
  <!-- This file lives in public/404.html -->
21
59
  <div class="dialog">
22
- <h1>The page you were looking for doesn't exist.</h1>
23
- <p>You may have mistyped the address or the page may have moved.</p>
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
24
65
  </div>
25
66
  </body>
26
67
  </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Your browser is not supported (406)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/406-unsupported-browser.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>Your browser is not supported.</h1>
62
+ <p>Please upgrade your browser to continue.</p>
63
+ </div>
64
+ </div>
65
+ </body>
66
+ </html>
@@ -2,25 +2,66 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>The change you wanted was rejected (422)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
16
54
  </style>
17
55
  </head>
18
56
 
19
- <body>
57
+ <body class="rails-default-error-page">
20
58
  <!-- This file lives in public/422.html -->
21
59
  <div class="dialog">
22
- <h1>The change you wanted was rejected.</h1>
23
- <p>Maybe you tried to change something you didn't have access to.</p>
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
24
65
  </div>
25
66
  </body>
26
67
  </html>
@@ -2,24 +2,65 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>We're sorry, but something went wrong (500)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
16
54
  </style>
17
55
  </head>
18
56
 
19
- <body>
57
+ <body class="rails-default-error-page">
20
58
  <!-- This file lives in public/500.html -->
21
59
  <div class="dialog">
22
- <h1>We're sorry, but something went wrong.</h1>
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
23
64
  </div>
24
65
  </body>
25
66
  </html>
Binary file
@@ -0,0 +1,3 @@
1
+ <svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="100%" height="100%" fill="red"/>
3
+ </svg>
Binary file
@@ -0,0 +1 @@
1
+ 1f554035419c76fdec75cb5218c7506fce105855df1db50413709e059bf6557109f9a67c9e67aa6458485c230cb82fb877c1779f95e76be36a37592a57674de6
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ FactoryBot.define do
4
+ factory :article, class: Article do
5
+ title { 'MyString' }
6
+ content { 'MyText' }
7
+ end
8
+
9
+ factory :picture, class: Picture do
10
+ data { File.open('spec/factories/files/rails.png') }
11
+ data_content_type { 'image/png' }
12
+ data_file_name { 'rails.png' }
13
+
14
+ association :assetable, factory: :article
15
+ end
16
+ end
@@ -1,54 +1,52 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require 'rails_helper'
4
4
 
5
- describe Uploader::Fileuploads do
6
- before(:all) do
7
- @picture = FactoryGirl.create(:picture, assetable_type: 'Article')
8
- end
5
+ RSpec.describe Uploader::Fileuploads do
6
+ let(:picture) { create(:picture, assetable_type: 'Article') }
9
7
 
10
8
  it 'should be a Module' do
11
- Uploader::Fileuploads.should be_a(Module)
9
+ # raise FactoryBot.find_definitions.inspect
10
+ require "/Users/mario/www/gems/rails-uploader/spec/factories/factories.rb"
11
+ expect(Uploader::Fileuploads).to be_a(Module)
12
12
  end
13
13
 
14
14
  context 'instance methods' do
15
- before(:each) do
16
- @article = FactoryGirl.build(:article)
17
- end
15
+ let(:article) { build(:article) }
18
16
 
19
17
  it 'should return asset class' do
20
- @article.fileupload_klass('picture').should == Picture
18
+ expect(article.fileupload_klass('picture')).to eq Picture
21
19
  end
22
20
 
23
21
  it 'should find asset by guid' do
24
- @picture.update_column(:guid, @article.fileupload_guid)
22
+ picture.update_column(:guid, article.fileupload_guid)
25
23
 
26
- asset = @article.fileupload_asset('picture')
27
- asset.should == @picture
24
+ asset = article.fileupload_asset('picture')
25
+ expect(asset).to eq picture
28
26
  end
29
27
 
30
28
  it 'should generate guid' do
31
- @article.fileupload_guid.should_not be_blank
29
+ expect(article.fileupload_guid).not_to be_blank
32
30
  end
33
31
 
34
32
  it 'should change guid' do
35
- @article.fileupload_guid = 'other guid'
36
- @article.fileupload_changed?.should be_truthy
37
- @article.fileupload_guid.should == 'other guid'
33
+ article.fileupload_guid = 'other guid'
34
+ expect(article.fileupload_changed?).to be_truthy
35
+ expect(article.fileupload_guid).to eq 'other guid'
38
36
  end
39
37
 
40
38
  it 'should not multiplay upload' do
41
- @article.fileupload_multiple?('picture').should be_falsey
39
+ expect(article.fileupload_multiple?('picture')).to be_falsey
42
40
  end
43
41
 
44
42
  it 'should find uploaded asset or build new record' do
45
- picture = @article.fileupload_asset(:picture)
46
- picture.should_not be_nil
47
- picture.should be_new_record
43
+ picture = article.fileupload_asset(:picture)
44
+ expect(picture).not_to be_nil
45
+ expect(picture).to be_new_record
48
46
  end
49
47
 
50
48
  it 'must get fileupload params' do
51
- @article.fileupload_params(:picture).should_not be nil
49
+ expect(article.fileupload_params(:picture)).not_to be nil
52
50
  end
53
51
  end
54
52
  end
data/spec/mongoid_spec.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require 'rails_helper'
4
4
  require 'mongoid'
5
5
 
6
6
  Mongoid.load!('spec/mongoid.yml', ENV['RAILS_ENV'])
@@ -23,7 +23,7 @@ class MongoidPicture
23
23
  belongs_to :assetable, polymorphic: true
24
24
  end
25
25
 
26
- describe Uploader::Asset do
26
+ RSpec.describe Uploader::Asset do
27
27
  before do
28
28
  @guid = 'guid'
29
29
  @article = MongoidArticle.new(fileupload_guid: @guid)
@@ -0,0 +1,80 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ require 'spec_helper'
3
+ ENV['RAILS_ENV'] ||= 'test'
4
+ require_relative 'dummy/config/environment'
5
+ # Prevent database truncation if the environment is production
6
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
7
+ # Uncomment the line below in case you have `--require rails_helper` in the `.rspec` file
8
+ # that will avoid rails generators crashing because migrations haven't been run yet
9
+ # return unless Rails.env.test?
10
+ require 'rspec/rails'
11
+ # Add additional requires below this line. Rails is not loaded until this point!
12
+
13
+ # Requires supporting ruby files with custom matchers and macros, etc, in
14
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
15
+ # run as spec files by default. This means that files in spec/support that end
16
+ # in _spec.rb will both be required and run as specs, causing the specs to be
17
+ # run twice. It is recommended that you do not name files matching this glob to
18
+ # end with _spec.rb. You can configure this pattern with the --pattern
19
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
20
+ #
21
+ # The following line is provided for convenience purposes. It has the downside
22
+ # of increasing the boot-up time by auto-requiring all files in the support
23
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
24
+ # require only the support files necessary.
25
+ #
26
+ # Rails.root.glob('spec/support/**/*.rb').sort_by(&:to_s).each { |f| require f }
27
+
28
+ require 'factory_bot_rails'
29
+
30
+ require 'carrierwave'
31
+ CarrierWave.configure do |config|
32
+ config.storage = :file
33
+ config.enable_processing = true
34
+ end
35
+
36
+ # copy gem migrations to ensure we have the *same* in the app
37
+ FileUtils.cp_r 'lib/generators/uploader/install/templates/.', 'spec/dummy/db/migrate/'
38
+
39
+ # Checks for pending migrations and applies them before tests are run.
40
+ # If you are not using ActiveRecord, you can remove these lines.
41
+ begin
42
+ ActiveRecord::Migrator.migrations_paths = [Rails.root.join('db/migrate').to_s]
43
+ ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths).migrate
44
+
45
+ ActiveRecord::Migration.maintain_test_schema!
46
+ rescue ActiveRecord::PendingMigrationError => e
47
+ abort e.to_s.strip
48
+ end
49
+
50
+ RSpec.configure do |config|
51
+ config.include FactoryBot::Syntax::Methods
52
+
53
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
54
+ # examples within a transaction, remove the following line or assign false
55
+ # instead of true.
56
+ config.use_transactional_fixtures = true
57
+
58
+ # You can uncomment this line to turn off ActiveRecord support entirely.
59
+ # config.use_active_record = false
60
+
61
+ # RSpec Rails can automatically mix in different behaviours to your tests
62
+ # based on their file location, for example enabling you to call `get` and
63
+ # `post` in specs under `spec/controllers`.
64
+ #
65
+ # You can disable this behaviour by removing the line below, and instead
66
+ # explicitly tag your specs with their type, e.g.:
67
+ #
68
+ # RSpec.describe UsersController, type: :controller do
69
+ # # ...
70
+ # end
71
+ #
72
+ # The different available types are documented in the features, such as in
73
+ # https://rspec.info/features/7-0/rspec-rails
74
+ config.infer_spec_type_from_file_location!
75
+
76
+ # Filter lines from Rails gems in backtraces.
77
+ config.filter_rails_from_backtrace!
78
+ # arbitrary gems may also be filtered via:
79
+ # config.filter_gems_from_backtrace("gem name")
80
+ end
@@ -13,7 +13,7 @@ describe Uploader::AttachmentsController do
13
13
 
14
14
  it "should create new asset" do
15
15
  file = Rack::Test::UploadedFile.new('spec/factories/files/rails.png', "image/png")
16
- article = FactoryGirl.create(:article)
16
+ article = create(:article)
17
17
  post "/uploader/attachments", {
18
18
  :klass => "Picture",
19
19
  :assetable_id => article.id,
@@ -30,7 +30,7 @@ describe Uploader::AttachmentsController do
30
30
 
31
31
  it "should destroy old asset on new asset for has_one" do
32
32
  file = Rack::Test::UploadedFile.new('spec/factories/files/rails.png', "image/png")
33
- article = FactoryGirl.create(:article)
33
+ article = create(:article)
34
34
  post "/uploader/attachments", {
35
35
  :klass => "Picture",
36
36
  :assetable_id => article.id,
@@ -58,7 +58,7 @@ describe Uploader::AttachmentsController do
58
58
  end
59
59
 
60
60
  it "should destroy asset" do
61
- @asset = FactoryGirl.create(:picture)
61
+ @asset = create(:picture)
62
62
 
63
63
  lambda {
64
64
  delete "/uploader/attachments/#{@asset.id}", {:klass => "Picture"}
@@ -66,7 +66,7 @@ describe Uploader::AttachmentsController do
66
66
  end
67
67
 
68
68
  it "should not destroy asset with not exists guid" do
69
- @asset = FactoryGirl.create(:picture)
69
+ @asset = create(:picture)
70
70
 
71
71
  lambda {
72
72
  delete "/uploader/attachments/wrong", {:klass => "Picture"}