spec/support/behaviors.rb in landable-1.13.1 vs spec/support/behaviors.rb in landable-1.13.2
- old
+ new
@@ -23,11 +23,11 @@
end
end
shared_context 'JSON API endpoint', type: :request do
before do
- default_parameters[:format] ||= 'json'
+ default_parameters[:format] ||= 'json'
default_headers['HTTP_ACCEPT'] ||= 'application/json'
end
def json(reload = false)
return @_last_json if @_last_json && !reload
@@ -43,11 +43,11 @@
end
it 'returns 401 if unauthorized' do
default_headers.delete 'HTTP_AUTHORIZATION'
send(request_method)
- response.status.should == 401
+ response.status.should eq 401
end
end
# For any controller spec tagged with `api: true`:
#
@@ -76,11 +76,11 @@
# def make_request
# post :create, some: 'param', values: 'here'
# end
# end
shared_examples 'Authenticated API controller' do |request_method|
- raise ArgumentError.new("Method name required as argument") if request_method.nil?
+ fail(ArgumentError, 'Method name required as argument') if request_method.nil?
before do
use_access_token unless example.metadata[:auth] == false
end
@@ -100,8 +100,8 @@
request.env.delete 'HTTP_AUTHORIZATION'
end
it 'returns 401 if unauthorized', auth: false do
send(request_method)
- response.status.should == 401
+ response.status.should eq 401
end
end