ruby - 无法在 Linux 中构建 .NET Core 控制台应用程序

标签 ruby ubuntu rspec .net-core aruba

我有这个规范文件,它试图运行一个将运行 dotnet cli 程序的脚本:

require 'spec_helper'

RSpec.describe 'Integration test', type: :aruba do
  let(:command) { run "dotnet-test" }

  it "test" do
    command.write("test\n")
    stop_all_commands
    expect(command.output).to end_with("success\n")
  end
end
dotnet-test脚本:
dotnet run --project ../SomeProject/src/SomeProject.Console/SomeProject.Console.csproj -- $1

但我得到错误:
Failure/Error: expect(command.output).to end_with("success\n")
       expected "MSBUILD : error MSB1009: Project file does not exist.\nSwitch: ../SomeProject/src/SomeProject.Console/SomeProject.Console.csproj\n\nThe build failed. Please fix the build errors and run again.\n" to end with "success\n"

但是,如果我从该目录运行脚本,则程序运行良好。无法弄清楚两者之间可能有什么区别。非常感谢您的帮助。

最佳答案

听起来您尝试运行的脚本依赖于正确执行的相对路径。在这种情况下,您可能需要 cd在您的规范范围内。

https://relishapp.com/cucumber/aruba/docs/filesystem/change-current-working-directory

尝试使用文件的绝对路径而不是

../SomeProject/src/SomeProject.Console/SomeProject.Console.csproj

你能把完整的路径,比如:
/Users/yourusername/pathtosomeproject/SomeProject/src/SomeProject.Console/SomeProject.Console.csproj

显然你需要替换 pathtosomeproject到它实际所在的位置。

关于ruby - 无法在 Linux 中构建 .NET Core 控制台应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53238950/

相关文章:

ruby-on-rails - 在 Ruby 中初始化具有高索引的空数组是否昂贵?

linux - .vimrc 和 .gvimrc 的区别

ruby - Rspec:弃用警告

ruby-on-rails - railstutorial.org,第 6 章。未知属性 : password

mysql - 为什么这个二级预加载不起作用?

ruby - Ruby 中的数组对象无法初始化为数组

ruby - 在每个值都是数组的哈希中,如何使用数组项查找键?

c++ - Eclipse CDT 中未识别 Linux CLOCK_PROCESS_CPUTIME_ID

php - 如何限制对 phpMyAdmin 中特定数据库用户帐户的访问?

ruby-on-rails - Rspec 测试失败,当用户应该被授予访问他拥有的交易的权限时,用户被重定向