Module: CfScript::Output::Tests

Included in:
CfScript::Output
Defined in:
lib/cf_script/output/tests.rb

Instance Method Summary collapse

Instance Method Details

#already_exists?(type, name) ⇒ Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/cf_script/output/tests.rb', line 47

def already_exists?(type, name)
  out.last_line_matches?(/#{type} #{name} already exists/)
end

#authenticated?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/cf_script/output/tests.rb', line 15

def authenticated?
  matches?(/Authenticating\.\.\.\nOK/m)
end

#contains?(text) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/cf_script/output/tests.rb', line 7

def contains?(text)
  out.contains?(text)
end

#credentials_rejected?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/cf_script/output/tests.rb', line 35

def credentials_rejected?
  contains? 'Credentials were rejected'
end

#failed?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/cf_script/output/tests.rb', line 19

def failed?
  contains? 'FAILED'
end

#is_already?(name, state) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/cf_script/output/tests.rb', line 43

def is_already?(name, state)
  out.last_line_matches?(/#{name} is already #{state}/)
end

#matches?(regexp) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/cf_script/output/tests.rb', line 3

def matches?(regexp)
  out.matches?(regexp)
end

#no_api_endpoint?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/cf_script/output/tests.rb', line 23

def no_api_endpoint?
  contains? 'No API endpoint set'
end

#not_authorized?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/cf_script/output/tests.rb', line 31

def not_authorized?
  contains? 'You are not authorized'
end

#not_found?(type, name) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/cf_script/output/tests.rb', line 39

def not_found?(type, name)
  out.last_line_matches?(/#{type} #{name} not found/)
end

#not_logged_in?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/cf_script/output/tests.rb', line 27

def not_logged_in?
  contains? 'Not logged in'
end

#ok?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/cf_script/output/tests.rb', line 11

def ok?
  out.last_line_matches?(/^OK$/)
end