Skip to content

Commit

Permalink
ensure uploaded image names are removed
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Wood committed Apr 21, 2024
1 parent d1dc661 commit 0917663
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ Development environment variables are loaded from ```config/env/.env``` by docke
Build the development container images, using ```./tasks build```

In order for commands to run inside the application containers scripts are used instead of calling the commands directly. Scripts are run from the [`tasks`](./tasks) file and the following scripts are current provided:
- ```./tasks up``` - start the application
- ```./tasks down``` - stop the application
- ```./tasks start``` - start the application
- ```./tasks stop``` - stop the application
- ```./tasks build``` - build the application containers
- ```./tasks exec``` - run command in application container
- ```./tasks bash``` - enter shell in application container
- ```./tasks sh``` - enter shell in application container
- ```./tasks rspec``` - rspec test suite
- ```./tasks yarn``` - yarn
- ```./tasks rails``` - rails
Expand Down
2 changes: 1 addition & 1 deletion app/models/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def process_and_reattach_image(image_attachment)
processed_image_file = process_image(image_attachment)
image_file.attach(
io: File.open(processed_image_file),
filename: image_attachment.original_filename,
filename: 'image.jpg',
content_type: image_attachment.content_type)
end

Expand Down
6 changes: 3 additions & 3 deletions spec/feature/admin_update_images_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
first('.input-submit-tag').click
expect(page).to have_content('Header image updated!')
visit('/')
expect(page).to have_css("img[src*='sample_image.jpg']")
expect(page).to have_css("img[src*='image.jpg']")
visit('admin/images')
first("input[name='attachment[reset]']", text: '').set(true)
first('.input-submit-tag').click
expect(page).to have_content('Header image reset!')
visit('/')
expect(page).to_not have_css("img[src*='sample_image.jpg']")
expect(page).to_not have_css("img[src*='image.jpg']")
end

scenario 'Update custom image location' do
Expand All @@ -36,4 +36,4 @@
header_image = first('.header-image > img')
expect(header_image[:style]).to match(/object-position: 10% 50%/)
end
end
end
6 changes: 3 additions & 3 deletions tasks
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ function build {
build "$@"
}

function up {
function start {
docker compose \
-p $COMPOSE_PROJECT_NAME \
-f ./.docker/docker-compose/dev.yml \
up "$@"
}

function down {
function stop {
docker compose \
-p $COMPOSE_PROJECT_NAME \
-f ./.docker/docker-compose/dev.yml \
Expand All @@ -46,7 +46,7 @@ function exec {
exec $APP_SERVICE_NAME /bin/bash -c "source ./.docker/scripts/entrypoint-dev && $*"
}

function bash {
function sh {
ensure_app_container_running
docker compose \
-p $COMPOSE_PROJECT_NAME \
Expand Down

0 comments on commit 0917663

Please sign in to comment.