小编Dmi*_*yev的帖子

ActionView::Template::Error: 785: '' 处的意外标记

在运行rails test. 失败的测试可以是任何文件中的任何测试。

此错误通常发生在 CI/CD 过程中的测试环境中。在当地,这种情况很少发生。

这是一个完整的堆栈跟踪:

Error:
SitePositionsControllerTest#test_should_create_position_link:
ActionView::Template::Error: 785: unexpected token at ''
    app/views/layouts/site/application.html.erb:10
    test/controllers/site_positions_controller_test.rb:28:in `block (2 levels) in <class:SitePositionsControllerTest>'
    test/controllers/site_positions_controller_test.rb:27:in `block in <class:SitePositionsControllerTest>'
    test/test_helper.rb:64:in `block (3 levels) in run'
    test/test_helper.rb:63:in `block (2 levels) in run'
    test/test_helper.rb:62:in `block in run'
    test/test_helper.rb:54:in `run'

rails test test/controllers/site_positions_controller_test.rb:18
Run Code Online (Sandbox Code Playgroud)

ruby continuous-integration ruby-on-rails webpacker ruby-on-rails-6

10
推荐指数
1
解决办法
747
查看次数

Clojure中`def`语句中使用的环境变量

我有这段代码:

(def heavy_computation (f1 (env :var1)))
Run Code Online (Sandbox Code Playgroud)

在哪里(env :var1)获取指向目录位置的环境变量VAR1(在environ的帮助下)并且f1是Java函数的包装器.稍后在函数中使用它,我只想计算一次计算量很大.

我希望能够VAR1在生产中缺少自定义和打印错误消息.

如果我在lein uberjar没有环境变量的情况下编译此代码,则会NullPointerException在此行引发错误.

我可以用环境变量编译它,稍后如果我适当地设置它们,它将起作用.为了在错误消息的情况下打印我的错误消息,我必须在def语句之前放置检查它的代码,否则它会抛出空指针异常.

我能以更干净的方式做到吗?我不想设置环境变量来编译它,我想-main在启动服务器之前放置在函数中执行检查的代码.

clojure environment-variables leiningen

4
推荐指数
1
解决办法
227
查看次数