RSpec shared examples with template methods
It’s pretty common to have multiple tests that are nearly the same.
In one app, we support bidding on both online and hammer auctions (auctions with people physically present). They’re separate controllers but with a lot of shared code and behavior.
We want to test both, but we’d rather not write two almost identical tests if we can help it.
So we’ve been using RSpec shared examples, with the template method patternto account for the differences, and we like it.
Here’s a simplified example:
spec/request/online_bidding_spec.rb
1 |
|
spec/request/hammer_bidding_spec.rb
1 |
|
spec/support/shared_examples/bidding.rb
1 |
|
The only template method here is auction_path . The shared example makes sure, by raising, that it’s overridden in your concrete specs.
RSpec shared examples with template methods的更多相关文章
- Vue学习笔记 template methods,filters,ChromeDriver,安装sass
ChromeDriver installation failed Error with http(s) request: Error: connect ETIMEDOUT 172.217.160.80 ...
- HeadFirst设计模式之模板方法模式
一. 1.The Template Method defines the steps of an algorithm and allows subclasses to provide the impl ...
- Quality in the Test Automation Review Process and Design Review Template
About this document Prerequisite knowledge/experience: Software Testing, Test Automation Applicable ...
- ruby Methods, Procs, Lambdas, and Closures
define simple method定义简单方法 关键字def用于方法定义,在其后是方法名和可选的参数名列表,参数名列表会用一对圆括号括住.构成方法主体的代码放在参数列表之后,end用于结束方法定 ...
- 【转】ruby rake执行rspec
RSpec 是Ruby的一个行为驱动开发(BDD)工具,当前的版本是 2.10.根据其入门文档,安装好之后,可以使用 rspec 命令来运行“测试”.但在某些情况下,如果参数较多,使用该命令并不方便: ...
- ES8新特性——ES8 was Released and here are its Main New Features
原文: https://hackernoon.com/es8-was-released-and-here-are-its-main-new-features-ee9c394adf66 -------- ...
- SWIG 3 中文手册——6. SWIG 和 C++
目录 6 SWIG 和 C++ 6.1 关于包装 C++ 6.2 方法 6.3 支持的 C++ 功能 6.4 命令行选项与编译 6.5.1 代理类的构造 6.5.2 代理类中的资源管理 6.5.3 语 ...
- Java Synchronized Blocks
From http://tutorials.jenkov.com/java-concurrency/synchronized.html By Jakob Jenkov A Java synchro ...
- Sharepoint CAML 增删改查 List
Lists.UpdateListItems 方法 (websvcLists) Windows SharePoint Services 3 Adds, deletes, or updates the ...
随机推荐
- 微软ASP.NET技术“乱谈”
微软ASP.NET技术“乱谈” 2014新年了,顺手写的一点文字,主要谈谈我对当前微软ASP.NET技术的看法,比较随意,大伙儿随便看看吧. 1 当前微软Web平台技术全貌 从2002年发布.NET ...
- php+mysql
本文整理一下使用php和mysql向前端推送数据的过程. 数据库部分: 1.首先安装服务器,我选择xampp,安装可以选择任意地址.安装完成,打开xampp-control.exe . 选择开启Apa ...
- css 隐藏超长的文本!!!
overflow:hidden; text-overflow:ellipsis;white-space: nowrap; 一起使用!
- 使用UltraISO制作U盘启动盘——转载
现在流行用U盘来安装系统,但要用U盘来安装系统的前提条件下是如何将镜像文件写入到U盘里,UltraISO能很好的满足你的需求. 步骤/方法 鼠标右键“以管理员身份运行”UltraISO图标 打 ...
- java规范(二)
常量命名 不允许使用任何魔法值(未定义的常量)直接出现在代码中 反例: String key="Id#taobao_"+tradeId: cache.put(key, value) ...
- window.print() 去掉页眉页脚及打印链接【转载】
页面中添加样式: <style media="print"> @page { size: auto; /* auto is the initial value */ m ...
- CentOS6.5中配置Rabbitmq3.6.6集群方案
一.安装Erlang环境 1.下载erlang源代码 wget http://erlang.org/download/otp_src_19.1.tar.gz 2.安装依赖相关库文件 yum insta ...
- 设置Headers
import urllib import urllib2 url = 'http://www.server.com/login'user_agent = 'Mozilla/4.0 (compatibl ...
- 关于git中git pull --rebase中的一些坑
在公司里面,每次我更改完代码,准备pull最新代码时,总是会遇到各种各样的问题.,因为对应的问题不同,解决方法很多.但是比较通用的办法还是有的: git pull --rebase //报错时 g ...
- 在table中进行内容搜索
$("tbody td").filter(":contains('" + x + "')").css('color','red').pare ...