@@ -11,34 +11,41 @@ bundle remove actionmailer || true
1111bundle remove rails || true
1212bundle add rails --skip-install ${RAILSOPTS:- }
1313bundle install --prefer-local
14+ bundle exec rails -v
1415
1516# do our work a directory with spaces in the name (#176, #184)
1617rm -rf " My Workspace"
1718mkdir " My Workspace"
1819pushd " My Workspace"
1920
20- # create a rails app
21- bundle exec rails -v
21+ function prepare_deps {
22+ # make sure to use the same version of rails (e.g., install from git source if necessary)
23+ bundle remove rails --skip-install
24+ bundle add rails --skip-install ${RAILSOPTS:- }
25+
26+ # use the tailwindcss-rails under test
27+ bundle add tailwindcss-rails --skip-install --path=" ../.."
28+ bundle add tailwindcss-ruby --skip-install ${TAILWINDCSSOPTS:- }
29+ bundle install --prefer-local
30+ bundle show --paths | fgrep tailwind
31+ bundle binstubs --all
32+ }
33+
34+ function install_tailwindcss {
35+ # install tailwindcss
36+ bin/rails tailwindcss:install
37+
38+ # TEST: tailwind was installed correctly
39+ grep -q " <main class=\" container" app/views/layouts/application.html.erb
40+ test -a app/assets/tailwind/application.css
41+ }
42+
43+ # Application variation #1 ----------------------------------------
2244bundle exec rails new test-install --skip-bundle
2345pushd test-install
2446
25- # make sure to use the same version of rails (e.g., install from git source if necessary)
26- bundle remove rails --skip-install
27- bundle add rails --skip-install ${RAILSOPTS:- }
28-
29- # use the tailwindcss-rails under test
30- bundle add tailwindcss-rails --skip-install --path=" ../.."
31- bundle add tailwindcss-ruby --skip-install ${TAILWINDCSSOPTS:- }
32- bundle install --prefer-local
33- bundle show --paths | fgrep tailwind
34- bundle binstubs --all
35-
36- # install tailwindcss
37- bin/rails tailwindcss:install
38-
39- # TEST: tailwind was installed correctly
40- grep -q " <main class=\" container" app/views/layouts/application.html.erb
41- test -a app/assets/tailwind/application.css
47+ prepare_deps
48+ install_tailwindcss
4249
4350# TEST: rake tasks don't exec (#188)
4451cat << EOF >> Rakefile
@@ -73,4 +80,17 @@ grep -q "py-2" app/assets/builds/tailwind.css
7380# TEST: contents include application.css directives
7481grep -q " #abc12399" app/assets/builds/tailwind.css
7582
83+ # Application variation #2 ----------------------------------------
84+ popd
85+ bundle exec rails new test-install2 --skip-bundle --skip-system-test
86+ pushd test-install2
87+
88+ prepare_deps
89+ install_tailwindcss
90+
91+ # TEST: presence of the generated file
92+ # TEST: nothing blew up without system tests, https://github.com/rails/tailwindcss-rails/issues/559
93+ bin/rails generate scaffold post title:string body:text published:boolean
94+ grep -q " Show" app/views/posts/index.html.erb
95+
7696echo " OK"
0 commit comments