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
within board_container do
first_like_button = find(like_button_selector, match: :first)
like_container = find(like_button_container_selector, match: :first)
# starts at zero likes
expect(like_container).to have_content(0)
# like
first_like_button.click
expect(like_container).to have_content(1)
# unlike
first_like_button.click
expect(like_container).to have_content(0)
end
end
end
context 'in Post component' do
it 'renders correctly' do
visit post_path(post1)
expect(page).to have_css(like_button_container_selector)
expect(page).to have_css(like_button_selector)
# expect(page).to have_css(likes_count_label_selector)
end
# Don't know why it doesn't work...
# it 'likes and unlikes' do # it 'likes and unlikes' do
# user.confirm # user.confirm
# sign_in user # sign_in user
# visit board_path(board)
# within board_container do
# first_like_button = find(like_button_selector, match: :first)
# like_container = find(like_button_container_selector, match: :first)
# # starts at zero likes
# expect(like_container).to have_content(0)
# # like
# first_like_button.click
# expect(like_container).to have_content(1)
# # unlike
# first_like_button.click
# expect(like_container).to have_content(0)
# end
# end
# end
# context 'in Post component' do
# it 'renders correctly' do
# visit post_path(post1) # visit post_path(post1)
# expect(page).to have_css(like_button_container_selector) # within like_button_container_selector do
# expect(page).to have_css(like_button_selector) # # starts at zero likes
# # expect(page).to have_css(likes_count_label_selector) # expect(page).to have_content(0)
# # like
# find(like_button_selector).click
# expect(page).to have_content(1)
# # unlike
# find(like_button_selector).click
# expect(page).to have_content(0)
# end # end
# # Don't know why it doesn't work...
# # it 'likes and unlikes' do
# # user.confirm
# # sign_in user
# # visit post_path(post1)
# # within like_button_container_selector do
# # # starts at zero likes
# # expect(page).to have_content(0)
# # # like
# # find(like_button_selector).click
# # expect(page).to have_content(1)
# # # unlike
# # find(like_button_selector).click
# # expect(page).to have_content(0)
# # end
# # end
# 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