Top Level Namespace
Defined Under Namespace
Modules: Kernel, Rspeckled
Instance Method Summary
collapse
Instance Method Details
#base64_digit_regex ⇒ Object
11
12
13
|
# File 'lib/rspeckled/helpers/patterns.rb', line 11
def base64_digit_regex
%r{[a-z0-9\+/=]}i
end
|
#encrypted_json_web_token_regex ⇒ Object
#factory_name ⇒ Object
3
4
5
|
# File 'lib/rspeckled/helpers/factories.rb', line 3
def factory_name
described_class.name.underscore
end
|
#fixture_filepath(filepath) ⇒ Object
15
16
17
|
# File 'lib/rspeckled/helpers/filepaths.rb', line 15
def fixture_filepath(filepath)
"#{root_filepath}/spec/fixtures/#{filepath}"
end
|
#guid_regex ⇒ Object
19
20
21
|
# File 'lib/rspeckled/helpers/patterns.rb', line 19
def guid_regex
/[a-f0-9]{32}/i
end
|
#hex_digit_regex ⇒ Object
15
16
17
|
# File 'lib/rspeckled/helpers/patterns.rb', line 15
def hex_digit_regex
/[a-f0-9]/i
end
|
#iso8601_regex ⇒ Object
7
8
9
|
# File 'lib/rspeckled/helpers/patterns.rb', line 7
def iso8601_regex
/(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?((?:[\+\-]\d{2}:\d{2})|Z)?/
end
|
#json_response ⇒ Object
3
4
5
|
# File 'lib/rspeckled/helpers/responses.rb', line 3
def json_response
JSON.load(response.body) end
|
#json_web_token_base64_regex ⇒ Object
39
40
41
|
# File 'lib/rspeckled/helpers/patterns.rb', line 39
def json_web_token_base64_regex
%r{[A-Za-z0-9_/\+\=\-]}
end
|
#json_web_token_regex ⇒ Object
#md5_regex ⇒ Object
23
24
25
|
# File 'lib/rspeckled/helpers/patterns.rb', line 23
def md5_regex
/[a-f0-9]{32}/i
end
|
#null_described_class ⇒ Object
3
4
5
|
# File 'lib/rspeckled/helpers/null_objects.rb', line 3
def null_described_class
"Null#{described_class.name}".constantize
end
|
#parse_fixture(filepath) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/rspeckled/helpers/filepaths.rb', line 23
def parse_fixture(filepath)
contents = read_fixture(filepath)
case filepath[/\.\w+\z/]
when '.json'
::JSON.parse(contents)
when '.eml'
::Mail.new(contents)
else
fail ArgumentError, "I don't know how to parse #{filepath}."
end
end
|
#read_fixture(filepath) ⇒ Object
19
20
21
|
# File 'lib/rspeckled/helpers/filepaths.rb', line 19
def read_fixture(filepath)
::File.read(fixture_filepath(filepath))
end
|
#root_filepath ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/rspeckled/helpers/filepaths.rb', line 3
def root_filepath
@root_filepath ||= begin
current_directory = Dir.pwd
until Dir.exist?(current_directory + '/spec')
current_directory += '/..'
end
File.expand_path(current_directory)
end
end
|
#sha_regex ⇒ Object
27
28
29
|
# File 'lib/rspeckled/helpers/patterns.rb', line 27
def sha_regex
/[a-f0-9]{64}/i
end
|
#test_email_regex ⇒ Object
31
32
33
|
# File 'lib/rspeckled/helpers/patterns.rb', line 31
def test_email_regex
/user\[email protected]/
end
|
#test_username_regex ⇒ Object
35
36
37
|
# File 'lib/rspeckled/helpers/patterns.rb', line 35
def test_username_regex
/username\d+/
end
|
#uuid_regex ⇒ Object
3
4
5
|
# File 'lib/rspeckled/helpers/patterns.rb', line 3
def uuid_regex
/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i
end
|