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 ...
随机推荐
- win10 重装应用商店
管理员模式打开powershell 命令窗口,输入以下重装应用商店的命令.亲测有效,我刚安装回来了. Get-AppXPackage *WindowsStore* -AllUsers | Foreac ...
- Ajax的基本使用
AJAX AJAX即"Asynchronous Javascript And XML"(异步JavaScript和XML),是指一种创建交互式网页应用的网页开发技术. AJAX = ...
- windows程序里新窗体不在任务栏显示,无标题拖动,键盘事件,始终显示在主窗体上面,单实例运行等
不显示在任务栏,Alt+Tab也不显示 protected override CreateParams CreateParams { get { const int WS_EX_APPWINDOW = ...
- iOS 开发 常用的正则验证表达式:电话 、邮箱等等
#pragma mark - 验证手机号 +(BOOL)checkForMobilePhoneNo:(NSString *)mobilePhone{ NSString *regEx = @" ...
- 在做基于LBS应用的一些随笔
公司做了一个基于LBS的APP,在做服务端的时候出现了一些注意事项,还是记录下把. 首先是关于坐标: 弧长公式:L=nπr/180°或l=|α|r.地球半径大致是6400千米.以纬度0.000001为 ...
- Jquery / js 判断数据类型方法(限制文本框类型输入)
当想要判断文本框中的值是否为自己想要的类型时,可以通过一些方法作出判断,这里对于光标离开文本框时判断文本框中输入的是否是数值类型,如果不是,做出提示 $("#WORKYEARS") ...
- wpf 常见死锁方式
Thread tr0 = new Thread(new ParameterizedThreadStart((obj1) => { lock (aaa) { Thread.Sleep(); thi ...
- 使用sbt构建spark 程序
今日在学习scala和spark相关的知识.之前在eclipse下编写了wordcount程序.但是关于导出jar包这块还是很困惑.于是学习sbt构建scala. 关于sbt的介绍网上有很多的资料,这 ...
- 还是要好好研究开源的php
听说facebook是php写的,还是要静下心来好好研究一番的嘛,踏踏实实点点滴滴的做起来!加油
- linux whoami命令
whoami显示的是当前"操作用户"的用户名.