Fix production assets compiling in Dockerfile (#215)

This commit is contained in:
Riccardo Graziosi
2023-05-06 14:34:31 +02:00
committed by GitHub
parent cfa8caa0cc
commit 84c6bd06bd
3 changed files with 61 additions and 65 deletions

View File

@@ -35,7 +35,7 @@ COPY . ${APP_ROOT}/
# Compile assets if production # Compile assets if production
# SECRET_KEY_BASE=1 is a workaround (see https://github.com/rails/rails/issues/32947) # SECRET_KEY_BASE=1 is a workaround (see https://github.com/rails/rails/issues/32947)
RUN if [ "$ENVIRONMENT" = "production" ]; then SECRET_KEY_BASE=1 RAILS_ENV=production bundle exec rake assets:precompile; fi RUN if [ "$ENVIRONMENT" = "production" ]; then RAILS_ENV=development bundle exec rake webpacker:compile; fi
### ###
### Dev stage ### ### Dev stage ###

View File

@@ -25,81 +25,76 @@ feature 'likes', type: :system, js: true do
post2 post2
end end
# NOTE context 'in post list of Board component' do
# For some weird reason, all these tests fails when it 'renders correctly for each post' do
# runned on GitHub Actions runners. They pass locally, visit board_path(board)
# but I'll leave them commented out for now.
# context 'in post list of Board component' do within board_container do
# it 'renders correctly for each post' do expect(page).to have_css(like_button_container_selector, count: 2)
# visit board_path(board) expect(page).to have_css(like_button_selector, count: 2)
# expect(page).to have_css(likes_count_label_selector, count: 2)
end
end
# within board_container do it 'redirects when user not logged in' do
# expect(page).to have_css(like_button_container_selector, count: 2) visit board_path(board)
# expect(page).to have_css(like_button_selector, count: 2)
# # expect(page).to have_css(likes_count_label_selector, count: 2)
# end
# end
# it 'redirects when user not logged in' do within board_container do
# visit board_path(board) find(like_button_selector, match: :first).click
expect(page.current_path).to eq(new_user_session_path)
end
end
# within board_container do it 'likes and unlikes' do
# find(like_button_selector, match: :first).click user.confirm
# expect(page.current_path).to eq(new_user_session_path) sign_in user
# end visit board_path(board)
# end
# it 'likes and unlikes' do within board_container do
# user.confirm first_like_button = find(like_button_selector, match: :first)
# sign_in user like_container = find(like_button_container_selector, match: :first)
# visit board_path(board)
# within board_container do # starts at zero likes
# first_like_button = find(like_button_selector, match: :first) expect(like_container).to have_content(0)
# like_container = find(like_button_container_selector, match: :first)
# # starts at zero likes # like
# expect(like_container).to have_content(0) first_like_button.click
expect(like_container).to have_content(1)
# # like # unlike
# first_like_button.click first_like_button.click
# expect(like_container).to have_content(1) expect(like_container).to have_content(0)
end
end
end
# # unlike context 'in Post component' do
# first_like_button.click it 'renders correctly' do
# expect(like_container).to have_content(0) visit post_path(post1)
# end
# end
# end
# context 'in Post component' do expect(page).to have_css(like_button_container_selector)
# it 'renders correctly' do expect(page).to have_css(like_button_selector)
# visit post_path(post1) # expect(page).to have_css(likes_count_label_selector)
end
# expect(page).to have_css(like_button_container_selector) # Don't know why it doesn't work...
# expect(page).to have_css(like_button_selector) # it 'likes and unlikes' do
# # expect(page).to have_css(likes_count_label_selector) # user.confirm
# end # sign_in user
# visit post_path(post1)
# # Don't know why it doesn't work... # within like_button_container_selector do
# # it 'likes and unlikes' do # # starts at zero likes
# # user.confirm # expect(page).to have_content(0)
# # sign_in user
# # visit post_path(post1)
# # within like_button_container_selector do # # like
# # # starts at zero likes # find(like_button_selector).click
# # expect(page).to have_content(0) # expect(page).to have_content(1)
# # # like # # unlike
# # find(like_button_selector).click # find(like_button_selector).click
# # expect(page).to have_content(1) # expect(page).to have_content(0)
# end
# # # unlike # end
# # find(like_button_selector).click end
# # expect(page).to have_content(0)
# # end
# # end
# end
end end

View File

@@ -86,6 +86,7 @@ feature 'post', type: :system, js: true do
visit post_path(post) visit post_path(post)
post_count = Post.count post_count = Post.count
post_board = post.board
within post_container_selector do within post_container_selector do
find('.deleteAction').click find('.deleteAction').click
@@ -95,7 +96,7 @@ feature 'post', type: :system, js: true do
alert.accept alert.accept
end end
expect(page).to have_current_path(board_path(post.board)) expect(page).to have_current_path(board_path(post_board))
expect(Post.count).to eq(post_count - 1) expect(Post.count).to eq(post_count - 1)
end end
end end