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
# 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 ###

View File

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

View File

@@ -86,6 +86,7 @@ feature 'post', type: :system, js: true do
visit post_path(post)
post_count = Post.count
post_board = post.board
within post_container_selector do
find('.deleteAction').click
@@ -95,7 +96,7 @@ feature 'post', type: :system, js: true do
alert.accept
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)
end
end