andorchen / everydayrailsrspec-cn Goto Github PK
View Code? Open in Web Editor NEW《使用 RSpec 测试 Rails 程序》电子书问题反馈
Home Page: https://leanpub.com/everydayrailsrspec-cn
《使用 RSpec 测试 Rails 程序》电子书问题反馈
Home Page: https://leanpub.com/everydayrailsrspec-cn
第 103 页
虽然像邮件发送、文件上传、时间处理、Web 服务以及 Rake 任务这些功能不是程序的中头绪
“中头绪” 可能想表达的是 “重头戏”
第 111 页
修正这个错误最简单的方法是在试图中加入一些代码
"试图" 可能应该是 ”视图“
63 页的代码中对于 update 操作使用的 http method 为 PUT,但 53 页开始已经提到:
从 Rails 4.0 开始 update 动作响应的是 PATCH 请求。
所以还是前后保持一致都使用 PATCH 代替 PUT 好些,估计是英文版本身的问题。
describe 'PUT #update' do
it "requires login" do
put :update, id: create(:contact),
contact: attributes_for(:contact)
expect(response).to redirect_to login_url
end
end
page 79
spec/support/shared_db_connection.db -> spec/support/shared_db_connection.rb
可能是我一直以来几乎都不写测试的缘故, 在leanpub入手的这本, 读下来感觉比早前硬啃的 The RSpec Book 接地气得多.
不过翻看的过程中, 感觉有几个地方稍微有点不够通畅
看一下 description 块后的 before 块。
感觉应该是describe
而是转向专门创建的 denied_pat ,
denied_path
我们不能忽略对测试的管理,也不同无视保证测试简洁而有条理的责任。
Capybara 的 DSL 很容易理解,及时不是程序员也能顺畅阅读功能测试
新建一个程序,比如博客或者待办事项程序,编写一些功能练习 TDD。不过测试技术如何,想想如何决定实现哪些功能?想要提高编写邮件发送功能测试的能力?
当然了,Cucumber 也有很多狂热支持者,很多开发团队会大量使用。所以,可能最终你还是要数量使用这个框架。
“可能最终你还是要数量使用这个框架”,这句中的“数量”可能是多余的
如果要使用 Cuucmber,切记小心 2011 年 12 月之前的教程。
Cuucmber 拼写有误
第 2 章,我们在 Gemfile 的 test 组中加入了 Capybara39、DatabaseCleaner40 和 Launchy41。如果你之前加入,现在请加上,我们终于要使用这些依赖库了。
“如果你之前加入,现在请加上”,应该是要表达“如果之前没加入,现在请加上”
第49页最后一段 array_match 应该为 match_array 吧。
我们再次调用了 assigns() 方法,使用 RSpec 提供的
array_match 匹配器检测数据集合(被赋值给 @contacts 变量)是否和期望值一致。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.