:{User_email:user.email,User_token:user.authentication_token }expect (response). To Have_http_status (: Success)#调试: See what Response.body is. An array that contains information about the projects of the logged-on user.[{"id": 2, "name": "Second Sample Project", "description": "A Test Project.", "due_on": "2018-05-26", "Created_at": " 2018-05-19t07:30:14.169z "," Updated_at ":" 2018-05-19t07:30:14.169z "," user_id ": 1}]Byebugputs "---#{response.bo
Rspec-rails Installing dependent libraries
> VI gemfile:
Gem ' Rspec-rails '
The wording of the specification:
Group:d evelopment,: Test do
...
Gem ' rspec-rails ' ...
End
> bundler Install:
Using Rspec-support 3.5.0
using Rspec-core 3.5.1 using
ArticleDirectory
Preface
Introduction
Install
TDD
Core
Introduction to rspec story
Preface
To understand rspec, we need to first understand what is behaviour driven development (BDD), and BDD is an acceptance test driven planning ), domain driven design and agile development model of test driven development (TDD. Rspec provides TDD su
block for deferred execution, and the detected value is executed two times before and after the request is executed to verify the change (3) Test patch request (UPDATE): The parameter is divided into legal and illegal cases, respectively verify whether the return data, and whether the success of the modification, as well as the rendering template; (4) Test delete request (destroy): Change (Class,: Count). by ( -1), redirect_to (5) Test non-crud action: There is a return value to verify the retu
This is a concise rspec guide written by David chelimsky. The original Article is here.
Introduction
To understand rspec, we need to first understand what is behaviour driven development (BDD), and BDD is an acceptance test driven planning ), domain driven design and agile development model of test driven development (TDD. Rspec provides TDD support for BDD dev
Transfer from Http://lmws.net/describe-vs-context-in-rspecLearn RSpec, not quite understand describe and context. Google a bit, find this article, feel that there is some truth1 in the RSpec world, we often see people using Descirbe code blocks and context code blocks such as1 " launch the Rocket " Do 2 " all ready " Do 3 End 4 5 " not ready " Do 6 End7 EndSo what's the difference between cont
Use rspec for behavior-driven testing:
Require 'machine'Describe machine do # machine is the name of the class to be testedBefore: each do@ Machine = machine. New ([: shopping,: checking_out])@ Machine. Events = {: checkout = >{: from =>: shopping,: To =>: checking_out }}EndIt "shoshould initially have a State of the first State" do@ Machine. state. shocould =: ShoppingEndIt "shoshould remember a list of valid states" do@ Machine. States. shold = [: s
I've learned some shells before, but not very deep, and the time to write code is not much. Shortly before the shell was more thin, leader assigned a task to write a script with the shell to upload the Redis source tarball from one server to another server, while the command on the server, unzip the source package and start the Redis service on another server.Although some shells have been learned, the SCP and expect that need to be used in this task
(1) When it is necessary to re-use the test situation, you can use the Shared_examples ("describe") do end, where needed to use the It_behaves_like "describe" reuse, code written in Controller_ In the Spec.rb file(2) A large number of reusable code can be put forward separately, placed in the spec/support/in the module, and in the Spec/spec_helper.rb file in the Rspec.configure block, add config.include Moudle, or directly under the Spec/support or sub-folder to write a RB file, SPEC_HELPER.RB w
If cocould not find table appears when running rspec, you need rake DB: Test: Prepare.
If your database uses sqlite3, the database used during the test is not development. sqlite3, but test. sqlite3, depending on the execution process:
Rake DB: Test: Prepare -- Trace** Invoke DB: Test: Prepare (first_time)** Invoke DB: abort_if_pending_migrations (first_time)** Invoke environment (first_time)** Execute Environment** Invoke DB: load_config (first_tim
Use expect to implement automatic logon script, there are many online, but there is no clear explanation, beginners are generally copied, collection. But why do you want to write this but do not know it. This article uses a shortest example to illustrate the principle of scripting.The script code is as follows:
##############################################
#!/usr/bin/expect
Set Timeout 30
Use expect to implement automatic logon script, there are many online, but there is no clear explanation, beginners are generally copied, collection. But why do you want to write this but do not know it. This article uses a shortest example to illustrate the principle of scripting.The script code is as follows:1 #!/usr/bin/expect23ssh192.168. 1.1 4 " Password: " 5 " ispass\r " 6 Interact 1. [#!/usr/bin/expect
Recently in the Zabbix, the company has six new servers. When the Zabbix client is deployed, the baby is really angry. Grandpa's always so repetitive work is also not AH. But as a war five slag, what else can be mixed with rice? Think of last year wrote a expect blog, so came the inspiration. God, please don't squirt me. So I decided to play a bit of technical little difficulty, remote automatic synchronization. Client software. So I revisit the
Use expect to implement automatic logon script, there are many online, but there is no clear explanation, beginners are generally copied, collection. But why do you want to write this but do not know it. This article uses a shortest example to illustrate the principle of scripting.The script code is as follows:###############################################!/usr/bin/expectSet Timeout 30Spawn ssh-l username 192.168.1.1Expect "Password:"Send "ispass\r"I
Recently in the Zabbix, the company has six new servers. When the Zabbix client is deployed, the baby is really angry. Grandpa's always so repetitive work is also not AH. But as a war five slag, what else can be mixed with rice? Think of last year wrote a expect blog, so came the inspiration. God, please don't squirt me. So I decided to play a bit of technical little difficulty, remote automatic synchronization. Client software. So I revisit the
Recently in the Zabbix, the company has six new servers. When the Zabbix client is deployed, the baby is really angry. Grandpa's always so repetitive work is also not AH. But as a war five slag, what else can be mixed with rice? Think of last year wrote a expect blog, so came the inspiration. God, please don't squirt me. So I decided to play a bit of technical little difficulty, remote automatic synchronization. Client software. So I revisit the
Recently in the Zabbix, the company has six new servers. When the Zabbix client is deployed, the baby is really angry. Grandpa's always so repetitive work is also not AH. But as a war five slag, what else can be mixed with rice? Think of last year wrote a expect blog, so came the inspiration. God, please don't squirt me. So I decided to play a bit of technical little difficulty, remote automatic synchronization. Client software. So I revisit the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.