test/gravaty/test_application.rb in gravaty-9.0.1 vs test/gravaty/test_application.rb in gravaty-10.0.0
- old
+ new
@@ -1,8 +1,8 @@
#--
# gravaty
-# Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
+# Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Marco Bresciani
#
# This file is part of gravaty.
#
# gravaty is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@@ -21,106 +21,90 @@
require_relative '../test_helper'
describe Gravaty::Gravaty do
describe 'when created with a valid email address' do
- subject {Gravaty::Gravaty.new(Gravaty::TEST_MY_ADDRESS,
- Gravaty::parser)}
+ subject { Gravaty::Gravaty.new(Gravaty::TEST_MY_ADDRESS,
+ Gravaty::parser) }
it 'shall return the email content on demand' do
- subject.email.must_equal Gravaty::TEST_MY_ADDRESS.downcase
+ _(subject.email).must_equal Gravaty::TEST_MY_ADDRESS.downcase
end
it 'shall return the digest content on demand' do
- subject.digest.must_equal Gravaty::TEST_MY_MD5
+ _(subject.digest).must_equal Gravaty::TEST_MY_MD5
end
it 'shall return a valid string' do
- subject.to_s.wont_be_nil
+ _(subject.to_s).wont_be_nil
end
it 'shall return a valid JSON' do
- subject.to_json.wont_be_nil
- JSON.parse(subject.to_json).wont_be_nil
+ _(subject.to_json).wont_be_nil
+ _(JSON.parse(subject.to_json)).wont_be_nil
end
[:avatar, :profile].each do |method|
describe "when asked for '#{method}'" do
describe 'when no parameters are provided' do
it 'shall provide an URI' do
- subject.send(method)
- .must_match Gravaty::TEST_SIMPLE_URI_REGEXP
+ _(subject.send(method)).must_match Gravaty::TEST_SIMPLE_URI_REGEXP
end
it "shall provide a '#{method}' URI" do
- subject.send(method)
- .must_include Gravaty::TEST_STRING[method]
+ _(subject.send(method)).must_include Gravaty::TEST_STRING[method]
end
it "shall provide a '#{method}' with a secure URI" do
- subject.send(method)
- .must_match Gravaty::TEST_SECURE_URI_REGEXP
- subject.send(method)
- .wont_match Gravaty::TEST_UNSECURE_URI_REGEXP
+ _(subject.send(method)).must_match Gravaty::TEST_SECURE_URI_REGEXP
+ _(subject.send(method)).wont_match Gravaty::TEST_UNSECURE_URI_REGEXP
end
end
describe 'when nil is provided' do
it 'shall provide an URI' do
- subject.send(method, nil)
- .must_match Gravaty::TEST_SIMPLE_URI_REGEXP
+ _(subject.send(method, nil)).must_match Gravaty::TEST_SIMPLE_URI_REGEXP
end
it "shall provide a '#{method}' URI" do
- subject.send(method, nil)
- .must_include Gravaty::TEST_STRING[method]
+ _(subject.send(method, nil)).must_include Gravaty::TEST_STRING[method]
end
it "shall provide a '#{method}' with a secure URI" do
- subject.send(method, nil)
- .must_match Gravaty::TEST_SECURE_URI_REGEXP
- subject.send(method, nil)
- .wont_match Gravaty::TEST_UNSECURE_URI_REGEXP
+ _(subject.send(method, nil)).must_match Gravaty::TEST_SECURE_URI_REGEXP
+ _(subject.send(method, nil)).wont_match Gravaty::TEST_UNSECURE_URI_REGEXP
end
end
describe 'when secure:false is provided' do
it "shall provide a '#{method}' with an unsecure URI" do
- subject.send(method, secure: false)
- .wont_match Gravaty::TEST_SECURE_URI_REGEXP
- subject.send(method, secure: false)
- .must_match Gravaty::TEST_UNSECURE_URI_REGEXP
+ _(subject.send(method, secure: false)).wont_match Gravaty::TEST_SECURE_URI_REGEXP
+ _(subject.send(method, secure: false)).must_match Gravaty::TEST_UNSECURE_URI_REGEXP
end
end
end
end
it 'shall provide the XML-RPC API interface' do
- subject.must_respond_to :xmlrpc
+ _(subject).must_respond_to :xmlrpc
end
describe 'when asked for nil method' do
it 'must raise an ArgumentError' do
- assert_raises ArgumentError do
- subject.xmlrpc(nil)
- end
+ _(-> { subject.xmlrpc(nil) }).must_raise ArgumentError
end
end
describe 'when asked for an unsupported method' do
it 'must raise an ArgumentError' do
- assert_raises ArgumentError do
- subject.xmlrpc('my_method', 'my_password')
- end
+ _(-> { subject.xmlrpc('my_method', 'my_password') }).must_raise ArgumentError
end
end
describe 'when asked for a valid method with a nil password' do
it 'must raise an ArgumentError' do
- assert_raises ArgumentError do
- subject.xmlrpc('my_method')
- end
+ _(-> { subject.xmlrpc('my_method') }).must_raise ArgumentError
end
end
end
end