Commit 9317c27a authored by Amy Qualls's avatar Amy Qualls

Test for British spellings of authorize

Variants on this word were not in the British test, and I spotted
them in a merge request I'm working on for Create.
parent 5e88a37a
...@@ -19,6 +19,10 @@ swap: ...@@ -19,6 +19,10 @@ swap:
analyse: analyze analyse: analyze
annexe: annex annexe: annex
apologise: apologize apologise: apologize
authorise: authorize
authorised: authorized
authorisation: authorization
authorising: authorizing
behaviour: behavior behaviour: behavior
busses: buses busses: buses
calibre: caliber calibre: caliber
......
...@@ -84,7 +84,7 @@ could not authorize you from Crowd because invalid credentials ...@@ -84,7 +84,7 @@ could not authorize you from Crowd because invalid credentials
``` ```
Ensure the Crowd users who need to sign in to GitLab are authorized to the Ensure the Crowd users who need to sign in to GitLab are authorized to the
[application](#configure-a-new-crowd-application) in the **Authorisation** step. [application](#configure-a-new-crowd-application) in the **Authorization** step.
This could be verified by trying "Authentication test" for Crowd (as of 2.11). This could be verified by trying "Authentication test" for Crowd (as of 2.11).
![Example Crowd application authorisation configuration](img/crowd_application_authorisation.png) ![Example Crowd application authorization configuration](img/crowd_application_authorisation.png)
...@@ -595,7 +595,7 @@ response = GitLab::HTTP.perform_request(Net::HTTP::Get, 'https://gitlab.com', ss ...@@ -595,7 +595,7 @@ response = GitLab::HTTP.perform_request(Net::HTTP::Get, 'https://gitlab.com', ss
##### TLS 1.2 ##### TLS 1.2
**Golang** does support multiple cipher suites that we do not want to use with TLS 1.2. We need to explicitly list authorised ciphers: **Golang** does support multiple cipher suites that we do not want to use with TLS 1.2. We need to explicitly list authorized ciphers:
```golang ```golang
func secureCipherSuites() []uint16 { func secureCipherSuites() []uint16 {
...@@ -694,69 +694,69 @@ Thank you for your contribution! ...@@ -694,69 +694,69 @@ Thank you for your contribution!
Before Ruby 2.5.1, you could implement delegators using the `delegate` or `method_missing` methods. For example: Before Ruby 2.5.1, you could implement delegators using the `delegate` or `method_missing` methods. For example:
```ruby ```ruby
class User class User
def initialize(attributes) def initialize(attributes)
@options = OpenStruct.new(attributes) @options = OpenStruct.new(attributes)
end end
def is_admin? def is_admin?
name.eql?("Sid") # Note - never do this! name.eql?("Sid") # Note - never do this!
end end
def method_missing(method, *args) def method_missing(method, *args)
@options.send(method, *args) @options.send(method, *args)
end end
end end
``` ```
When a method was called on a `User` instance that didn't exist, it passed it along to the `@options` instance variable. When a method was called on a `User` instance that didn't exist, it passed it along to the `@options` instance variable.
```ruby ```ruby
User.new({name: "Jeeves"}).is_admin? User.new({name: "Jeeves"}).is_admin?
# => false # => false
User.new(name: "Sid").is_admin? User.new(name: "Sid").is_admin?
# => true # => true
User.new(name: "Jeeves", "is_admin?" => true).is_admin? User.new(name: "Jeeves", "is_admin?" => true).is_admin?
# => false # => false
``` ```
Because the `is_admin?` method is already defined on the class, its behavior is not overridden when passing `is_admin?` to the initializer. Because the `is_admin?` method is already defined on the class, its behavior is not overridden when passing `is_admin?` to the initializer.
This class can be refactored to use the `Forwardable` method and `def_delegators`: This class can be refactored to use the `Forwardable` method and `def_delegators`:
```ruby ```ruby
class User class User
extend Forwardable extend Forwardable
def initialize(attributes) def initialize(attributes)
@options = OpenStruct.new(attributes) @options = OpenStruct.new(attributes)
self.class.instance_eval do self.class.instance_eval do
def_delegators :@options, *attributes.keys def_delegators :@options, *attributes.keys
end end
end end
def is_admin? def is_admin?
name.eql?("Sid") # Note - never do this! name.eql?("Sid") # Note - never do this!
end end
end end
``` ```
It might seem like this example has the same behavior as the first code example. However, there's one crucial difference: **because the delegators are meta-programmed after the class is loaded, it can overwrite existing methods**: It might seem like this example has the same behavior as the first code example. However, there's one crucial difference: **because the delegators are meta-programmed after the class is loaded, it can overwrite existing methods**:
```ruby ```ruby
User.new({name: "Jeeves"}).is_admin? User.new({name: "Jeeves"}).is_admin?
# => false # => false
User.new(name: "Sid").is_admin? User.new(name: "Sid").is_admin?
# => true # => true
User.new(name: "Jeeves", "is_admin?" => true).is_admin? User.new(name: "Jeeves", "is_admin?" => true).is_admin?
# => true # => true
# ^------------------ The method is overwritten! Sneaky Jeeves! # ^------------------ The method is overwritten! Sneaky Jeeves!
``` ```
In the example above, the `is_admin?` method is overwritten when passing it to the initializer. In the example above, the `is_admin?` method is overwritten when passing it to the initializer.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment