Module: RSpecApi::Expectations::BodyExpectations

Defined in:
lib/rspec-api/expectations/body.rb

Instance Method Summary collapse

Instance Method Details

#expect_a_collection(response, is_collection) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/rspec-api/expectations/body.rb', line 7

def expect_a_collection(response, is_collection)
  if is_collection
    expect(response).to be_a_collection
  else
    expect(response).not_to be_a_collection
  end
end

#expect_a_filtered(response, filter = {}) ⇒ Object



23
24
25
# File 'lib/rspec-api/expectations/body.rb', line 23

def expect_a_filtered(response, filter = {})
  expect(response).to be_filtered filter[:value], filter.except(:value)
end

#expect_a_sorted(response, sort = {}) ⇒ Object



19
20
21
# File 'lib/rspec-api/expectations/body.rb', line 19

def expect_a_sorted(response, sort = {})
  expect(response).to be_sorted sort
end

#expect_attributes(response, attributes) ⇒ Object



27
28
29
# File 'lib/rspec-api/expectations/body.rb', line 27

def expect_attributes(response, attributes)
  expect(response).to have_attributes attributes
end

#expect_callback_wrapped(response, callback) ⇒ Object



15
16
17
# File 'lib/rspec-api/expectations/body.rb', line 15

def expect_callback_wrapped(response, callback)
  expect(response).to be_a_jsonp callback
end