|
11 | 11 | end |
12 | 12 |
|
13 | 13 | it 'adds success flash message to @flash_array regarding updating custom logo image with a .png file' do |
14 | | - file = 'app/assets/images/layout/login-screen-logo.png' |
15 | | - controller.params = {:upload => {:logo => ActionDispatch::Http::UploadedFile.new(:tempfile => File.open(file), :filename => 'login-screen-logo.png', :type => 'image/png')}} |
| 14 | + controller.params = {:upload => {:logo => fixture_file_upload('spec/fixtures/image.png', 'image/png')}} |
16 | 15 | controller.send(:upload_logo) |
17 | | - expect(controller.instance_variable_get(:@flash_array)).to include(:message => 'Custom logo image "login-screen-logo.png" uploaded', :level => :success) |
| 16 | + expect(controller.instance_variable_get(:@flash_array)).to include(:message => 'Custom logo image "image.png" uploaded', :level => :success) |
18 | 17 | end |
19 | 18 |
|
20 | 19 | it 'adds error flash message to @flash_array regarding updating custom logo image with a non-png file' do |
21 | | - file = File.join(__dir__, '/data/test.txt.png') |
22 | | - controller.params = {:upload => {:logo => ActionDispatch::Http::UploadedFile.new(:tempfile => File.open(file), :filename => 'test.txt.png', :type => 'image/png')}} |
| 20 | + controller.params = {:upload => {:logo => fixture_file_upload('spec/fixtures/test.txt.png', 'image/png')}} |
23 | 21 | controller.send(:upload_logo) |
24 | 22 | expect(controller.instance_variable_get(:@flash_array)).to include(:message => 'Custom logo image must be a .png file', :level => :error) |
25 | 23 |
|
26 | | - file = 'app/assets/images/favicon.ico' |
27 | | - controller.params = {:upload => {:logo => ActionDispatch::Http::UploadedFile.new(:tempfile => File.open(file), :filename => 'favicon.ico', :type => 'image/png')}} |
| 24 | + controller.params = {:upload => {:logo => fixture_file_upload('spec/fixtures/favicon.ico', 'image/png')}} |
28 | 25 | controller.send(:upload_logo) |
29 | 26 | expect(controller.instance_variable_get(:@flash_array)).to include(:message => 'Custom logo image must be a .png file', :level => :error) |
30 | 27 | end |
31 | 28 |
|
32 | 29 | it 'adds success flash message to @flash_array regarding updating custom login and about screen background image with a .png file' do |
33 | | - file = 'app/assets/images/layout/login-screen-logo.png' |
34 | | - controller.params = {:login => {:logo => ActionDispatch::Http::UploadedFile.new(:tempfile => File.open(file), :filename => 'login-screen-logo.png', :type => 'image/png')}} |
| 30 | + controller.params = {:login => {:logo => fixture_file_upload('spec/fixtures/image.png', 'image/png')}} |
35 | 31 | controller.send(:upload_login_logo) |
36 | | - expect(controller.instance_variable_get(:@flash_array)).to include(:message => 'Custom login image "login-screen-logo.png" uploaded', :level => :success) |
| 32 | + expect(controller.instance_variable_get(:@flash_array)).to include(:message => 'Custom login image "image.png" uploaded', :level => :success) |
37 | 33 | end |
38 | 34 |
|
39 | 35 | it 'adds error flash message to @flash_array regarding updating custom login and about screen background image with a non .png file' do |
40 | | - file = File.join(__dir__, '/data/test.txt.png') |
41 | | - controller.params = {:login => {:logo => ActionDispatch::Http::UploadedFile.new(:tempfile => File.open(file), :filename => 'test.txt.png', :type => 'image/png')}} |
| 36 | + controller.params = {:login => {:logo => fixture_file_upload('spec/fixtures/test.txt.png', 'image/png')}} |
42 | 37 | controller.send(:upload_login_logo) |
43 | 38 | expect(controller.instance_variable_get(:@flash_array)).to include(:message => 'Custom login image must be a .png file', :level => :error) |
44 | 39 |
|
45 | | - file = 'app/assets/images/favicon.ico' |
46 | | - controller.params = {:login => {:logo => ActionDispatch::Http::UploadedFile.new(:tempfile => File.open(file), :filename => 'favicon.ico', :type => 'image/png')}} |
| 40 | + controller.params = {:login => {:logo => fixture_file_upload('spec/fixtures/favicon.ico', 'image/png')}} |
47 | 41 | controller.send(:upload_login_logo) |
48 | 42 | expect(controller.instance_variable_get(:@flash_array)).to include(:message => 'Custom login image must be a .png file', :level => :error) |
49 | 43 | end |
50 | 44 |
|
51 | 45 | it 'adds success flash message to @flash_array regarding updating custom brand image with a .png file' do |
52 | | - file = 'app/assets/images/layout/login-screen-logo.png' |
53 | | - controller.params = {:brand => {:logo => ActionDispatch::Http::UploadedFile.new(:tempfile => File.open(file), :filename => 'login-screen-logo.png', :type => 'image/png')}} |
| 46 | + controller.params = {:brand => {:logo => fixture_file_upload('spec/fixtures/image.png', 'image/png')}} |
54 | 47 | controller.send(:upload_login_brand) |
55 | | - expect(controller.instance_variable_get(:@flash_array)).to include(:message => 'Custom brand "login-screen-logo.png" uploaded', :level => :success) |
| 48 | + expect(controller.instance_variable_get(:@flash_array)).to include(:message => 'Custom brand "image.png" uploaded', :level => :success) |
56 | 49 | end |
57 | 50 |
|
58 | 51 | it 'adds error flash message to @flash_array regarding updating custom brand image with a non .png file' do |
59 | | - file = File.join(__dir__, '/data/test.txt.png') |
60 | | - controller.params = {:brand => {:logo => ActionDispatch::Http::UploadedFile.new(:tempfile => File.open(file), :filename => 'test.txt.png', :type => 'image/png')}} |
| 52 | + controller.params = {:brand => {:logo => fixture_file_upload('spec/fixtures/test.txt.png', 'image/png')}} |
61 | 53 | controller.send(:upload_login_brand) |
62 | 54 | expect(controller.instance_variable_get(:@flash_array)).to include(:message => 'Custom brand must be a .png file', :level => :error) |
63 | 55 |
|
64 | | - file = 'app/assets/images/favicon.ico' |
65 | | - controller.params = {:brand => {:logo => ActionDispatch::Http::UploadedFile.new(:tempfile => File.open(file), :filename => 'favicon.ico', :type => 'image/png')}} |
| 56 | + controller.params = {:brand => {:logo => fixture_file_upload('spec/fixtures/favicon.ico', 'image/png')}} |
66 | 57 | controller.send(:upload_login_brand) |
67 | 58 | expect(controller.instance_variable_get(:@flash_array)).to include(:message => 'Custom brand must be a .png file', :level => :error) |
68 | 59 | end |
|
76 | 67 | end |
77 | 68 |
|
78 | 69 | it 'adds success flash message to @flash_array regarding updating custom favicon with an .ico file' do |
79 | | - file = 'app/assets/images/favicon.ico' |
80 | | - controller.params = {:favicon => {:logo => ActionDispatch::Http::UploadedFile.new(:tempfile => File.open(file), :filename => 'favicon.ico', :type => 'image/vnd.microsoft.icon')}} |
| 70 | + controller.params = {:favicon => {:logo => fixture_file_upload('spec/fixtures/favicon.ico', 'image/vnd.microsoft.icon')}} |
81 | 71 | controller.send(:upload_favicon) |
82 | 72 | expect(controller.instance_variable_get(:@flash_array)).to include(:message => 'Custom favicon "favicon.ico" uploaded', :level => :success) |
83 | 73 | end |
84 | 74 |
|
85 | 75 | it 'adds error flash message to @flash_array regarding updating custom favicon with a non .ico file' do |
86 | | - file = File.join(__dir__, '/data/test.txt.ico') |
87 | | - controller.params = {:favicon => {:logo => ActionDispatch::Http::UploadedFile.new(:tempfile => File.open(file), :filename => 'test.txt.ico', :type => 'image/png')}} |
| 76 | + controller.params = {:favicon => {:logo => fixture_file_upload('spec/fixtures/test.txt.ico', 'image/vnd.microsoft.icon')}} |
88 | 77 | controller.send(:upload_favicon) |
89 | 78 | expect(controller.instance_variable_get(:@flash_array)).to include(:message => 'Custom favicon must be a .ico file', :level => :error) |
90 | 79 |
|
91 | | - file = 'app/assets/images/layout/login-screen-logo.png' |
92 | | - controller.params = {:favicon => {:logo => ActionDispatch::Http::UploadedFile.new(:tempfile => File.open(file), :filename => 'test.ico', :type => 'image/vnd.microsoft.icon')}} |
| 80 | + controller.params = {:favicon => {:logo => fixture_file_upload('spec/fixtures/favicon.png.ico', 'image/vnd.microsoft.icon')}} |
93 | 81 | controller.send(:upload_favicon) |
94 | 82 | expect(controller.instance_variable_get(:@flash_array)).to include(:message => 'Custom favicon must be a .ico file', :level => :error) |
95 | 83 | end |
|
0 commit comments