小编dem*_*tal的帖子

`spring rspec`只显示spring help ..为什么?

我正试图在Rails 3.2.16项目中使用带有rspec和guard的spring.

安装spring和spring-commands-rspec之后,我创建了binstubs:

> bundle exec spring binstub --all
  * bin/rake: spring inserted
  * bin/rspec: spring inserted
  * bin/rails: spring inserted
Run Code Online (Sandbox Code Playgroud)

现在尝试使用spring运行规范失败(gems路径和项目路径为可读性而设置):

> bin/rspec spec/
Version: 1.1.0

Usage: spring COMMAND [ARGS]

Commands for spring itself:

binstub         Generate spring based binstubs. Use --all to generate a binstub for all known commands.
help            Print available commands.
status          Show current status.
stop            Stop all spring processes for this project.

Commands for your application:

rails           Run a rails command. The following sub commands will …
Run Code Online (Sandbox Code Playgroud)

rspec ruby-on-rails ruby-on-rails-3 spring-gem

25
推荐指数
3
解决办法
6153
查看次数

创建并打开以编辑光标下不存在的文件

我正在使用Ruby on Rails尝试Vim前几个小时,我很喜欢它.

gf命令很棒,但我想念一些东西.如果光标下的文件尚不存在,则gf返回错误.

是否存在实际创建和打开文件的命令(如果该文件不存在)?或者,创建它的最直接的方法是什么?

vim

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

rake spec:推荐的型号VS rspec spec/models

我们找到了两个命令

rake spec:models
Run Code Online (Sandbox Code Playgroud)

rspec spec/models
Run Code Online (Sandbox Code Playgroud)

rake任务首先清理数据库的方式略有不同.我们的测试依赖于一些初始数据(来自db/seeds.rb),因此rake spec:models失败了.

与此同时,我非常确定其中一个命令会在一天或另一天被弃用.

我们应该相信哪一个?

tdd rake rspec ruby-on-rails

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

无法在Heroku上部署Hubot

我在上个月(2月13日)使用hubot 2.4.6在Heroku上部署了一个Hubot实例.

今天我想添加一个新脚本,并在部署回heroku时出现编译错误.在更新之前,我尝试按照wiki说明部署一个全新的hubot导致完全相同的错误,这里是日志:

$ git push heroku master
Counting objects: 23, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (19/19), done.
Writing objects: 100% (23/23), 10.58 KiB, done.
Total 23 (delta 0), reused 0 (delta 0)

-----> Node.js app detected
-----> Resolving engine versions
       Using Node.js version: 0.10.0
       Using npm version: 1.1.65
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
       npm http GET https://registry.npmjs.org/optparse/1.0.3
       npm http GET https://registry.npmjs.org/hubot
       npm http GET …
Run Code Online (Sandbox Code Playgroud)

heroku node.js hubot

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

capybara如何使用href模式测试多个链接

鉴于我有一个包含10个用户列表的页面,如何测试我有10个用户显示链接?

我试过这个:

   Then /^I should see a list of (\d+) users$/ do |num|
     page.should have_selector('a', {:href=>"users/*", :count => num})
   end
Run Code Online (Sandbox Code Playgroud)

还有这个 :

   Then /^I should see a list of (\d+) users$/ do |num|
     page.should have_selector('a', {:href=>/users\/\d+/, :count => num})
   end
Run Code Online (Sandbox Code Playgroud)

但两者都返回预期的css"a"返回一些东西(RSpec :: Expectations :: ExpectationNotMetError)

但是,如果省略:count参数,则测试总是传递:href参数中的任何内容(甚至是错误的模式).

bdd ruby-on-rails cucumber capybara

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