capybara3--rspec配置

简介:

rspec配置

我们知道Capybara 只是是一个用来以模拟用户对web应用的操作来测试web应用的工具包,不能真正的称之为测试框架,它需要其他的测试驱动框架来帮助我们完成测试工作。所以我们需要一个测试驱动框架.

RSpec由Steven Baker开发并在2005年发布,全面支持Ruby程序的BDD开发测试方式,并且对于Rails程序有着良好的支持,针对View,Controller和Model每一层都有良好的支持。RSpec目前的最新版本是:3.5。

它在 BDD 流程的开发中被用来写高可读性的测试,引导并验证你开发的应用程序。

minitest与rspec都是ruby和rails比较流行的框架。这里我们选择rspec。

安装rspec很简单,打开command line运行一下操作:

1
gem install rspec

或者将rspec 添加到gemfile里

1
gem 'rspec'

执行bundle install 来安装
如果你的项目采用的时rails,那么rspec-rails 或许更适合你

在gemfile里添加

1
2
3
group :development, :test do
gem 'rspec-rails', '~> 3.4'
end

执行 bundle install

初始化测试目录

1
rails generate rspec:install

这增加了以下文件用于配置:


1
2
3
.rspec
spec/spec_helper.rb

spec/rails_helper.rb




最新内容请见作者的GitHub页:http://qaseven.github.io/

目录
相关文章
|
8月前
|
JavaScript Unix Linux
⨯ cannot execute cause=fork/exec...pnpm\bin\pnpm.cjs: %1 is not a valid Win32 application.
⨯ cannot execute cause=fork/exec...pnpm\bin\pnpm.cjs: %1 is not a valid Win32 application.
653 0
|
8月前
|
Linux iOS开发 MacOS
pnpm全局安装报错:Run “pnpm setup“ to create it automatically, or set the global-bin-dir setting, or the PN
pnpm全局安装报错:Run “pnpm setup“ to create it automatically, or set the global-bin-dir setting, or the PN
2254 0
JavaWeb - No URLs will be polled as dynamic configuration sources
JavaWeb - No URLs will be polled as dynamic configuration sources
705 0
JavaWeb - No URLs will be polled as dynamic configuration sources
node-sass 安装失败 rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libs
检查一下有没有配置python2.7环境变量 npm install -g node-gyp npm install --global --production windows-build-tools(通过管理员打开) npm i -g node-sass
406 1
|
5月前
|
Android开发
[ionic]解决Could not read build file capacitor/build.gradle as it does notexist.
[ionic]解决Could not read build file capacitor/build.gradle as it does notexist.
48 1
|
5月前
【petalinux 2024.01】petalinux-build时module ‘plnx_vars‘ has no attribute ‘CopyDir‘错误
【petalinux 2024.01】petalinux-build时module ‘plnx_vars‘ has no attribute ‘CopyDir‘错误
122 0
|
开发工具 git
编译pluma:configure.ac:229: error: required file ‘pluma/mate-submodules/Makefile.in‘ not found
编译pluma:configure.ac:229: error: required file ‘pluma/mate-submodules/Makefile.in‘ not found
132 0
|
开发工具 git
Can‘t find third_party/gtest. Run git submodule update --init, or disable with CMake -DBUILD_TEST
Can‘t find third_party/gtest. Run git submodule update --init, or disable with CMake -DBUILD_TEST
122 0
That command depends on command in Target 'XXX': script phase “[CP] Copy Pods Resourc 报错解决方法
That command depends on command in Target 'XXX': script phase “[CP] Copy Pods Resourc 报错解决方法
186 0
成功解决eric6-EditorConfig Properties The EditorConfig properties for file h5py\numpy.pxd could not be l
成功解决eric6-EditorConfig Properties The EditorConfig properties for file h5py\numpy.pxd could not be l
成功解决eric6-EditorConfig Properties The EditorConfig properties for file h5py\numpy.pxd could not be l