Skip to content

Instantly share code, notes, and snippets.

@zdennis
Created August 22, 2014 13:17
Show Gist options
  • Save zdennis/e566f55b63afa8eeed32 to your computer and use it in GitHub Desktop.
Save zdennis/e566f55b63afa8eeed32 to your computer and use it in GitHub Desktop.
1) Grape::DSL::Validations.reset_validations! resets validations
Failure/Error: expect(subject.settings.peek[:validations]).to be_empty
expected to respond to `empty?`
# ./spec/grape/dsl/validations_spec.rb:30:in `block (3 levels) in <module:DSL>'
2) Grape::Validations::PresenceValidator with a required non-empty string requires when missing
Failure/Error: expect(last_response.body).to eq('{"error":"email is missing, email is invalid"}')
expected: "{\"error\":\"email is missing, email is invalid\"}"
got: "{\"error\":\"email is missing\"}"
(compared using ==)
# ./spec/grape/validations/presence_spec.rb:67:in `block (3 levels) in <top (required)>'
3) Grape::Validations::PresenceValidator with nested parameters validates nested parameters
Failure/Error: expect(last_response.body).to eq('{"error":"user is missing, user[first_name] is missing, user[last_name] is missing"}')
expected: "{\"error\":\"user is missing, user[first_name] is missing, user[last_name] is missing\"}"
got: "{\"error\":\"user is missing\"}"
(compared using ==)
# ./spec/grape/validations/presence_spec.rb:120:in `block (3 levels) in <top (required)>'
4) Grape::Validations::PresenceValidator with triply nested required parameters validates triple nested parameters
Failure/Error: expect(last_response.body).to eq('{"error":"admin[admin_name] is missing, admin[super][user] is missing, admin[super][user][first_name] is missing, admin[super][user][last_name] is missing"}')
expected: "{\"error\":\"admin[admin_name] is missing, admin[super][user] is missing, admin[super][user][first_name] is missing, admin[super][user][last_name] is missing\"}"
got: "{\"error\":\"admin[admin_name] is missing\"}"
(compared using ==)
# ./spec/grape/validations/presence_spec.rb:160:in `block (3 levels) in <top (required)>'
5) Grape::Validations params required with an Array block errors when param is not an Array
Failure/Error: expect(last_response.body).to eq('items is invalid, items[key] is missing')
expected: "items is invalid, items[key] is missing"
got: "items is invalid"
(compared using ==)
# ./spec/grape/validations_spec.rb:230:in `block (4 levels) in <top (required)>'
6) Grape::Validations params required with a Hash block errors when param not present
Failure/Error: expect(last_response.body).to eq('items is missing, items[key] is missing')
expected: "items is missing, items[key] is missing"
got: "items is missing"
(compared using ==)
# ./spec/grape/validations_spec.rb:278:in `block (4 levels) in <top (required)>'
7) Grape::Validations params required with a Hash block errors when param is not a Hash
Failure/Error: expect(last_response.body).to eq('items is invalid, items[key] is missing')
expected: "items is invalid, items[key] is missing"
got: "items is invalid"
(compared using ==)
# ./spec/grape/validations_spec.rb:284:in `block (4 levels) in <top (required)>'
8) Grape::Validations params validation within arrays errors when param is not an Array
Failure/Error: expect(last_response.body).to eq('children is invalid, children[name] is missing, children[parents] is missing, children[parents] is invalid, children[parents][name] is missing')
expected: "children is invalid, children[name] is missing, children[parents] is missing, children[parents] is invalid, children[parents][name] is missing"
got: "children is invalid"
(compared using ==)
# ./spec/grape/validations_spec.rb:401:in `block (4 levels) in <top (required)>'
9) Grape::Validations params with block param requires defaults to Array type
Failure/Error: expect(last_response.body).to eq('planets is invalid, planets[name] is missing')
expected: "planets is invalid, planets[name] is missing"
got: "planets is invalid"
(compared using ==)
# ./spec/grape/validations_spec.rb:456:in `block (4 levels) in <top (required)>'
10) Grape::Validations params with block param optional defaults to Array type
Failure/Error: expect(last_response.body).to eq('moons is invalid, moons[name] is missing')
expected: "moons is invalid, moons[name] is missing"
got: "moons is invalid"
(compared using ==)
# ./spec/grape/validations_spec.rb:472:in `block (4 levels) in <top (required)>'
11) Grape::Validations params with block param group defaults to Array type
Failure/Error: expect(last_response.body).to eq('stars is invalid, stars[name] is missing')
expected: "stars is invalid, stars[name] is missing"
got: "stars is invalid"
(compared using ==)
# ./spec/grape/validations_spec.rb:491:in `block (4 levels) in <top (required)>'
12) Grape::Validations params optional with an Array block errors when param is present but isn't an Array
Failure/Error: expect(last_response.body).to eq('items is invalid, items[key] is missing')
expected: "items is invalid, items[key] is missing"
got: "items is invalid"
(compared using ==)
# ./spec/grape/validations_spec.rb:580:in `block (4 levels) in <top (required)>'
13) Grape::Validations params multiple validation errors throws the validation errors
Failure/Error: expect(last_response.body).to match(/swag is missing/)
expected "yolo is missing" to match /swag is missing/
Diff:
@@ -1,2 +1,2 @@
-/swag is missing/
+"yolo is missing"
# ./spec/grape/validations_spec.rb:676:in `block (4 levels) in <top (required)>'
14) Grape::Validations params custom validation when using requires with a custom validator validates when param is not present
Failure/Error: expect(last_response.body).to eq('custom is missing, custom is not custom!')
expected: "custom is missing, custom is not custom!"
got: "custom is missing"
(compared using ==)
# ./spec/grape/validations_spec.rb:751:in `block (5 levels) in <top (required)>'
15) Grape::Validations params mutually exclusive more than one set of mutually exclusive params errors for all sets
Failure/Error: expect(last_response.body).to eq "beer, wine are mutually exclusive, scotch, aquavit are mutually exclusive"
expected: "beer, wine are mutually exclusive, scotch, aquavit are mutually exclusive"
got: "beer, wine are mutually exclusive"
(compared using ==)
# ./spec/grape/validations_spec.rb:1006:in `block (5 levels) in <top (required)>'
Finished in 7.18 seconds (files took 1.06 seconds to load)
855 examples, 15 failures, 17 pending
Failed examples:
rspec ./spec/grape/dsl/validations_spec.rb:29 # Grape::DSL::Validations.reset_validations! resets validations
rspec ./spec/grape/validations/presence_spec.rb:64 # Grape::Validations::PresenceValidator with a required non-empty string requires when missing
rspec ./spec/grape/validations/presence_spec.rb:117 # Grape::Validations::PresenceValidator with nested parameters validates nested parameters
rspec ./spec/grape/validations/presence_spec.rb:149 # Grape::Validations::PresenceValidator with triply nested required parameters validates triple nested parameters
rspec ./spec/grape/validations_spec.rb:227 # Grape::Validations params required with an Array block errors when param is not an Array
rspec ./spec/grape/validations_spec.rb:275 # Grape::Validations params required with a Hash block errors when param not present
rspec ./spec/grape/validations_spec.rb:281 # Grape::Validations params required with a Hash block errors when param is not a Hash
rspec ./spec/grape/validations_spec.rb:397 # Grape::Validations params validation within arrays errors when param is not an Array
rspec ./spec/grape/validations_spec.rb:453 # Grape::Validations params with block param requires defaults to Array type
rspec ./spec/grape/validations_spec.rb:469 # Grape::Validations params with block param optional defaults to Array type
rspec ./spec/grape/validations_spec.rb:488 # Grape::Validations params with block param group defaults to Array type
rspec ./spec/grape/validations_spec.rb:577 # Grape::Validations params optional with an Array block errors when param is present but isn't an Array
rspec ./spec/grape/validations_spec.rb:672 # Grape::Validations params multiple validation errors throws the validation errors
rspec ./spec/grape/validations_spec.rb:748 # Grape::Validations params custom validation when using requires with a custom validator validates when param is not present
rspec ./spec/grape/validations_spec.rb:991 # Grape::Validations params mutually exclusive more than one set of mutually exclusive params errors for all sets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment