|
| 1 | +describe "Inspectors", type: :feature do |
| 2 | + |
| 3 | + context "CRUD" do |
| 4 | + |
| 5 | + context "as a system admin" do |
| 6 | + |
| 7 | + let(:user) { create(:user, :with_system_admin_role) } |
| 8 | + |
| 9 | + let(:inspector_config) do |
| 10 | + YAML.load_file( |
| 11 | + PROJECT_DIR.join("inspector", "config.yml") |
| 12 | + ).with_indifferent_access |
| 13 | + end |
| 14 | + |
| 15 | + let(:media_files_dir) do |
| 16 | + PROJECT_DIR.join("spec/support/files") |
| 17 | + end |
| 18 | + |
| 19 | + before {sign_in} |
| 20 | + |
| 21 | + context do |
| 22 | + |
| 23 | + let!(:store) { create(:media_store, :database, :with_users, users: [user]) } |
| 24 | + |
| 25 | + it 'add an Inspector, upload a jpg', pending: true do |
| 26 | + |
| 27 | + # Settings |
| 28 | + visit '/media-service/' |
| 29 | + click_on 'Settings' |
| 30 | + click_on 'Edit' |
| 31 | + fill_in 'upload_max_part_size', with: (100 * 1024) |
| 32 | + fill_in 'upload_min_part_size', with: 1024 |
| 33 | + click_on 'Save' |
| 34 | + |
| 35 | + |
| 36 | + # Inspector |
| 37 | + visit '/media-service/inspectors/' |
| 38 | + click_on 'Create' |
| 39 | + fill_in 'id', with: inspector_config[:id] |
| 40 | + check 'enabled' |
| 41 | + fill_in 'public_key', with: inspector_config[:'internal-key'][:'public-key'] |
| 42 | + click_on 'Save' |
| 43 | + expect(page).to have_content 'Inspectors' |
| 44 | + expect(page).to have_content inspector_config[:id] |
| 45 | + |
| 46 | + |
| 47 | + # Upload |
| 48 | + visit '/media-service/' |
| 49 | + click_on 'Uploads' |
| 50 | + within "#uploads-page .form" do |
| 51 | + attach_file nil, media_files_dir.join('AnonPhoto.jpg') |
| 52 | + end |
| 53 | + |
| 54 | + binding.pry |
| 55 | + |
| 56 | + end |
| 57 | + |
| 58 | + end |
| 59 | + |
| 60 | + end |
| 61 | + end |
| 62 | +end |
0 commit comments