小编Bil*_*ner的帖子

Factory_Girl + RSpec:创建(:用户)时未定义的方法'create'

无法调用"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: …

ruby rspec ruby-on-rails factory-bot

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

如何在KornShell中自定义显示提示以显示主机名和当前目录?

我在Solaris上使用KornShell(ksh),目前我的PS1 env var是:

PS1="${HOSTNAME}:\${PWD} \$ "

并显示提示: hostname:/full/path/to/current/directory $

但是,我希望它显示: hostname:directory $

换句话说,我怎么能只显示主机名和当前目录,即名称tmp~public_html等等等等?

unix shell customization ksh environment-variables

11
推荐指数
2
解决办法
7万
查看次数

用户或帐户或人或什么?

在Stack Overflow上,你是一个"用户".在43things.com上,你是一个"人".在其他网站上,您是一个"帐户".然后一些网络应用程序跳过这种能指的使用,它只是http://webapp.com/yourusername

你认为这些能指有什么意义吗?你喜欢一个吗?

在构建应用程序时,我经常在此过程中进入此步骤,并偶然发现是否将应用程序的用户称为"用户"或"人员"或"帐户".我确定还有其他例子,但这些是我经常遇到的例子.我很好奇其他人在构建应用程序的用户管理功能时的想法.我认为大多数默认使用"用户",但你是否考虑过为什么?

user-management

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