-
-
Save rafbm/5019918 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe ReportsController do | |
| describe :create do | |
| before do | |
| @payload = { :version => "1.0.0" } | |
| end | |
| it "succeeds with present serial" do | |
| @payload[:serial] = "123abc" | |
| post reports_path, @payload.to_json | |
| last_response.should be_ok | |
| last_response.status.should eq 200 | |
| end | |
| it "fails with missing serial" do | |
| @payload[:serial] = nil | |
| post reports_path, @payload.to_json | |
| last_response.should_not be_ok | |
| last_response.status.should eq 400 | |
| end | |
| end | |
| end |
Author
Dans cet exemple, est-ce que RSpec roule le
beforeavant leitet avant leits?
Yep. Le before est exécuté une fois avant le it et une fois avant le its.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Toujours possible de faire ça si t’as une shitload d’expectations :
__evil laugh**