无法调用"dummy = create(:user)"来创建用户.已经来回走了几个小时.
/home/parreirat/backend-clone/Passworks/spec/models/user_spec.rb:15:in `block (2 levels) in <top (required)>': undefined method `create' for #<Class:0xbcdc1d8> (NoMethodError)"
Run Code Online (Sandbox Code Playgroud)
这是工厂,users.rb:
FactoryGirl.define do
factory :user do
email 'heheheheheheh@gmail.com'
password 'chucknorris'
name 'luis mendes'
end
end
Run Code Online (Sandbox Code Playgroud)
这就是我在user_spec.rb中调用FactoryGirl的方式:
require 'spec_helper'
describe 'User system:' do
context 'registration/login:' do
it 'should have no users registered initially.' do
expect(User.count).to eq(0)
end
it 'should not be logged on initially.' do
expect(@current_user).to eq(nil)
end
dummy = create(:user)
it 'should have a single registered user.' do
expect(User.count).to eq(1)
end
end
end
Run Code Online (Sandbox Code Playgroud)
我按照说明将其添加到spec_helper.rb: …
在我当前的代码中,我想将新的DrawObjects插入到我创建的向量中,
std :: vector <DrawObject>对象;
有什么区别:
objects.push_back(DrawObject(name, surfaceFile, xPos, yPos, willMoveVar, animationNumber));
Run Code Online (Sandbox Code Playgroud)
和
objects.push_back(new DrawObject(name, surfaceFile, xPos, yPos, willMoveVar, animationNumber));
Run Code Online (Sandbox Code Playgroud) 我想在一个允许这样的结构中添加几个对象:
插入对象,立即对整个结构进行排序,这样我就有一个int的降序排列;
能够更改对象排序的int(我的意思是:说对象编号为2,现在的int为5,所以它重新排序结构);
结构快速,因为它将完全迭代60次;
能够按位置直接访问对象;
只需要从上到下迭代:更高的INT来降低INT
不需要删除,但以后可能会有用.
关于如何使用该结构的一些迹象会很棒,因为我对C++标准库知之甚少.