sign_in_as 上下文子句中的声明?
sign_in_as declaration in context clause?
这里的"sign_in_as :user"代表什么?
这只是前块的快捷方式吗?
刚刚继承了一个代码库,我找不到它如何工作的文档。
有没有办法将其重构为更有文档记录的格式?
context 'when an User is logged in', sign_in_as: :user do
context 'without the System Administrator role' do
let :user do
create :user
end
it 'redirects to root' do
action
expect(response).to redirect_to root_path
end
end
这是在您的上下文中包含助手的语法。 Here 是此功能的描述和示例。
因此,请检查您的 spec/spec_helper.rb
或 spec/rails_helper.rb
文件。我想你可以在其中找到 sign_in_as
的声明。
这里的"sign_in_as :user"代表什么?
这只是前块的快捷方式吗?
刚刚继承了一个代码库,我找不到它如何工作的文档。
有没有办法将其重构为更有文档记录的格式?
context 'when an User is logged in', sign_in_as: :user do
context 'without the System Administrator role' do
let :user do
create :user
end
it 'redirects to root' do
action
expect(response).to redirect_to root_path
end
end
这是在您的上下文中包含助手的语法。 Here 是此功能的描述和示例。
因此,请检查您的 spec/spec_helper.rb
或 spec/rails_helper.rb
文件。我想你可以在其中找到 sign_in_as
的声明。