上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 44 下一页
摘要: 总文档连接: RSpec.info/documentation/ 如何使用TDD 和 自动化测试来建立一个Rails app。 TDD让你用测试来探索代码的设计。你将学习可利用的工具,并学习用什么工具最好使。Tools comes and tools go, 工具是不断进化的,所以作者希望读者用最少 阅读全文
posted @ 2018-05-22 22:53 Mr-chen 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 10.测试文件上传 作者推荐的Paperclip,官方维护组已经不推荐使用deprecated。 推荐使用rails自带的 ActiveStorage. Active Storage: 推进文件上传到云存储,并附加这些文件到Active Record object。它 和本地驱动服务一起用于开发和测 阅读全文
posted @ 2018-05-22 11:54 Mr-chen 阅读(190) 评论(0) 推荐(0) 编辑
摘要: Make it work, make it right, make it fast. 测试运行的时间。应用和测试组件的增长,速度会越来越慢,目标是保持代码的readable, maintainable.如何快速编写清晰的测试 具体: RSpec 为精简代码提供的简练句法;✅找有用的看了看 善用代码编 阅读全文
posted @ 2018-05-21 21:03 Mr-chen 阅读(356) 评论(0) 推荐(0) 编辑
摘要: Don't Repeat Yourself. • 把操作步骤提取到辅助模块中;✅ • 通过let复用测试中的实例变量;✅ • 把通用的设置移到共享的情景中;⚠️(不喜欢) • 在RSpec和rspec-rails提供的匹配器之外,自定义匹配器;⚠️未学习• 把多个测试用例中的期望合到一个测试用例中; 阅读全文
posted @ 2018-05-21 11:22 Mr-chen 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 测试应用与非人类用户的交互,涵盖外部 API 7.1request test vs feature test 对 RSpec 来说,这种专门针 对 API 的测试最好放在 spec/requests 目录中,与前面编写的功能测试分开。这种测试也不使用 Capy- bara,因为它模拟的是浏览器交互, 阅读全文
posted @ 2018-05-19 15:45 Mr-chen 阅读(469) 评论(0) 推荐(0) 编辑
摘要: https://github.com/rspec/rspec-expectations https://relishapp.com/rspec/rspec-expectations/v/3-7/docs 总文档连接: RSpec.info/documentation/ be_completed是Pr 阅读全文
posted @ 2018-05-18 22:07 Mr-chen 阅读(361) 评论(0) 推荐(0) 编辑
摘要: 我们要把应用各组件放在一起做集成 测试,这样才能保证模型和控制器之间能够良好契合。在 RSpec 中,这种测试称为功能测试(feature spec),有时也称为验收测试(acceptance test)或集成测试(integration test)。这种测试的作用是确保 软件作为一个整体能按预期使 阅读全文
posted @ 2018-05-18 21:59 Mr-chen 阅读(1010) 评论(0) 推荐(0) 编辑
摘要: 第 5 章 控制器测试 5.1基础 rails generate rspec:controller home RSpec.describe HomeController, type: :controller do describe '#index' do it "responds successfu 阅读全文
posted @ 2018-05-18 11:21 Mr-chen 阅读(534) 评论(0) 推荐(0) 编辑
摘要: 总文档连接: RSpec.info/documentation/ 包括core, expectiation,rails , mock, 点击最新版本,然后右上角搜索class, method. 第3章: rspec-expectations gem : RSpec匹配器 第4章: 预构件gem: f 阅读全文
posted @ 2018-05-16 19:02 Mr-chen 阅读(732) 评论(0) 推荐(0) 编辑
摘要: 复制粘体错误到google。找到解决方案: https://github.com/thoughtbot/shoulda-matchers/issues/1057 阅读全文
posted @ 2018-05-15 17:26 Mr-chen 阅读(168) 评论(0) 推荐(0) 编辑
上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 44 下一页