问题列表 - 第279836页

Rspec系统测试在单独运行时通过,在使用整个套件运行时失败

当我单独运行时,我有以下测试通过:

require 'rails_helper'

RSpec.describe 'deleting a non-recurring user event', js: true do

  let(:user)       { create(:proofreader_user) }
  let(:date)       { Date.current.strftime('%Y-%m-%d') }
  let(:date_time)  { date + ' 00:00'}

  it 'deletes the event' do
    visit root_path
    click_on "Login"
    fill_in  "Email",    with: user.email
    fill_in  "Password", with: user.password
    click_on "Sign In"
    visit calendar_path
    expect(current_path).to eq(calendar_path)
    expect(page).to have_css("#complete_registration:disabled")
    expect(page).to_not have_css("td.fc-event-container")
    find("td.fc-day[data-date='#{date}']").click
    expect(page).to have_css("div#user-event-modal")
    expect(page).to have_select('user_event[title]', :options => UserEvent.titles.keys)
    expect(find('input', id: 'user_event_starting').value).to eq date_time
    expect(find('input', id: 'user_event_ending').value).to eq date_time
    page.execute_script("$('input#user_event_starting').val('#{date} 09:00')")
    expect(find('input', id: 'user_event_starting').value).to eq date + …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails rspec-rails ruby-on-rails-5

5
推荐指数
1
解决办法
178
查看次数

如何创建一个nonEmpty列表?

我想使用Data.List.NonEmpty,我正在搜索如何使用一个元素定义列表?我只能在列表中使用nonEmpty,但很明显它会返回一个Maybe而我不希望这样......

更新:我找到了这个解决方案

let emptyList = 5 :| []
Run Code Online (Sandbox Code Playgroud)

haskell

2
推荐指数
1
解决办法
145
查看次数

angular 2 ag-grid 无法读取 getSelectedRow() 未定义的属性“api”

我在需要构建一些表格模板来显示员工信息的项目中工作,并且协调员选择了其中一名员工来做某事我在来自 AgGridModule 的称为 API 的东西中遇到了一些问题,但是当我尝试选择行以便它可以显示时它在控制台日志中。但我面临一个问题:

StoreComponent.html:2 错误类型错误:无法读取 StoreComponent.push../src/app/Component/store/store.component.ts.StoreComponent.getSelectedRows 处未定义的属性“api”

有人可以帮我解决吗

这是我的代码:- https://stackblitz.com/edit/angular-yfdcbn?file=src%2Fstyles.css

ag-grid angular6

3
推荐指数
1
解决办法
6395
查看次数

Visual Studio Code 扩展的端到端测试实现

我开发了一个 Visual Studio 代码扩展。我想对我们在 package.json 中配置的每个命令实施端到端测试。这些命令有快速选择等

我不知道如何实施测试

e2e-testing visual-studio-code vscode-extensions

5
推荐指数
1
解决办法
369
查看次数

尝试使用 marshmallow 通过 data_key 加载数据时出现“丢失数据”

我尝试在python 3.7上使用marshmallow 2.18.0来验证数据。我等待 json并使用架构加载它:{'name': 'foo', 'emailAddress': 'x@x.org'}

class FooLoad(Schema):
    name = fields.Str()
    email = fields.Email(data_key='emailAddress', required=True)
Run Code Online (Sandbox Code Playgroud)

我除了加载时的data_key会返回一些类似的信息,但我在错误字段中收到错误:{'name': 'foo', 'email': 'x@x.org'}

schema_load = FooLoad()
after_load = schema_load.load({'name': 'foo', 'emailAddress': 'x@x.org'})
after_load.errors # return {'email': ['Missing data for required field.']}
Run Code Online (Sandbox Code Playgroud)

但根据Marshmallow 文档devDependency或 github问题的示例 after_load必须包含类似{'name': 'foo', 'email': 'x@x.org'}.

我想反序列化传入的日期,其名称与架构属性名称不同(指定 date_key 所需的内容,但尝试时出现错误。我如何使用与架构属性不同的名称反序列化输入数据并在此属性的 data_key 字段中声明?

python python-3.x marshmallow

5
推荐指数
1
解决办法
2709
查看次数

为什么在区域控制器加载时我的 BaseController.User 值 == null?

我正在编写一个 Asp.Net 核心应用程序,并且在获得导航访问权限之前,我让用户通过 Google 进行身份验证。当用户导航到我的“WorldBuilder”区域并点击 WorldController 时,BaseController.User 对象为空。这是迄今为止我设置的唯一区域/控制器。

用户在登录时有效,因为我可以迭代与用户关联的声明。我正在使用默认的 Asp.Net 核心谷歌身份验证,因此用户只会在登录页面上收到一个按钮,指示他们向谷歌进行身份验证。

[Authorize]
[Area("WorldBuilder")]
public class WorldController : Controller
{
    private string _userId;
    private IWorldService _worldService;
    private IUserRepository _userRepository;

    public WorldController(IWorldService worldService, IUserRepository userRepository)
    {
        if (User != null) /* The user object is found to be null here. */
        {
            var userIdNameClaim = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier);
            if (userIdNameClaim != null)
            {
                _userId = userIdNameClaim.Value;
            }
        }
        _userRepository = userRepository;
        _worldService = worldService;
    }
Run Code Online (Sandbox Code Playgroud)

我希望由于这些区域是同一应用程序的一部分,因此经过身份验证的用户信息将在区域之间传递,但情况似乎并非如此。BaseController.User 对象为 null

c# asp.net-core-mvc asp.net-core

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

如何在 React Native 的选择器中显示来自 firebase 的数据

我正在用 React Native 开发一个应用程序,我想在存储在 firebase 中的选择器中显示名称和值。如何在选择器上显示来自 firebase 的数据?

注意:-我是菜鸟。所以,如果可以,请提供一个简单的例子。

android picker firebase react-native

0
推荐指数
1
解决办法
1033
查看次数

Kubectl 命令检查命名空间是否准备就绪

我想知道 kubernetes 中是否有一个命令,如果命名空间中的所有资源都处于就绪状态,则返回 true,否则返回 false。

类似于这个(虚构的)命令的东西:

kubectl get namespace <namespace-name> readiness
Run Code Online (Sandbox Code Playgroud)

如果没有这样的命令,任何指导我如何检索此信息的帮助(如果给定命名空间中的所有资源都已准备就绪),我们将不胜感激。

kubernetes

5
推荐指数
1
解决办法
6984
查看次数

根据计数结果创建动态变量名

我正在尝试将字符串和数字组合到动态生成的变量中。目前是这样试的:

const ElementCount = 2;

for (i = 1, i <= ElementCount, i++) {
    let SampleVariable[i] = "test";
}
Run Code Online (Sandbox Code Playgroud)

ElementCount 稍后将是动态的。

上面函数的结果应该是这样的:

SampleVariable1 = "test"
SampleVariable2 = "test"
Run Code Online (Sandbox Code Playgroud)

我的代码似乎是错误的 - 我需要在这里更改什么?解决方案也可以是原生 JS 或 jQuery。

非常感谢!

javascript variables jquery

2
推荐指数
1
解决办法
912
查看次数

如何在 Rider 中触发文件更改的设计时构建?

我制作了一个NuGet 包,它在设计和构建时从 DSL 文件生成 C# 代码。它在 Visual Studio 中运行良好,但在 Rider 中存在一些问题(我将在下面描述)。

在 Visual Studio 中

该包为 DSL 文件声明自定义项,并为它们分配MSBuild:Compile Generator元数据,每次文件更改时都会触发Visual Studio 中的设计时构建

然后,自定义目标挂钩到构建BeforeTargets="CoreCompile"。它生成 C# 代码并将Compile项目添加到项目中。目标在正常和设计时构建中运行,并支持增量构建以避免不必要的工作。

这是相关的(简化和注释的)MSBuild 代码:

props文件:

<Project>

  <!-- Define the item type with its default metadata -->
  <ItemDefinitionGroup>
    <ZebusMessages>
      <Generator>MSBuild:Compile</Generator>
    </ZebusMessages>
  </ItemDefinitionGroup>

  <!-- Make the item type user-visible in VS -->
  <ItemGroup>
    <AvailableItemName Include="ZebusMessages" />
    <PropertyPageSchema Include="$(MSBuildThisFileDirectory)ZebusMessages.xml" />
  </ItemGroup>

  <!-- Include all .msg …
Run Code Online (Sandbox Code Playgroud)

.net msbuild resharper rider

6
推荐指数
1
解决办法
1240
查看次数