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 ...
随机推荐
- C# Mysql You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ????
有几年没用过MySql数据了,今天在使用C#访问MySql数据库时出现了一个小插曲. 错误提示: You have an error in your SQL syntax; check the man ...
- delphi判断文件类型
function getFileType(inputFile:string):string;const JPEG_FLAG_BEGIN = $D8FF; JPEG_FLAG_END = $D9FF; ...
- MySQL 第二篇
一.MySQL多实例介绍 mysql多实例,共用一套mysql安装程序,使用不同的配置文件(my.cnf).启动程序.和数据文件,即在一台服务器上同时开启多个不同的服务器端口(3306,3307),同 ...
- ios UINaviBar 去除分割线
//For a custom shadow image to be shown, custom background image must also be set with the setBackgr ...
- Debug模式下编译溢出问题
问题: 代码在Debug模式下编译报出内存溢出的错误,而Release模式下则没有. 由于Debug模式下包含调试信息,并且不作任何优化.而Release模式进行了各种优化,内存检测等操作均省去,使得 ...
- ASP.NET之Cookie(坑爹的Response.Cookies.Remove)(转)
在web开发中Cookie是必不可少的 .NET自然也有一个强大的Cookie操作类,我们用起来也非常方便,不过在使用中我们会发现一个坑爹的事情Response.Cookies.Remove删除不 ...
- hdu1540 Tunnel Warfare
Tunnel Warfare Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)To ...
- 什么时候该用NoSQL?
: 杂谈 NoSQL这两年越来越热,尤其是大型互联网公司非常热衷这门技术.根据笔者的经验,并不是任何场景,NoSQL都要优于关系型数据库.下面我们来具体聊聊,什么时候使用NoSQL比较给力: 1) ...
- MYBATIS 文档
http://www.mybatis.org/mybatis-3/zh/index.html
- Java中Map集合的四种访问方式(转)
最近学习Java发现集合类型真是很多,访问方式也很灵活,在网上找的方法,先放下备用 public static void main(String[] args) { Map<String, St ...