Top Level Namespace
- Includes:
- ActionDispatch::TestProcess
Defined Under Namespace
Modules: MuckAdminHelper, MuckControllerMacros, MuckEngine, MuckEngineHelper, MuckFormMacros, MuckModelMacros, MuckPaginationMacros, MuckPluginMacros
Classes: BasicMailer
Constant Summary
collapse
- NOT_LOGGED_IN_MSG =
/You must be logged in to access this feature/i
- PERMISSION_DENIED_MSG =
/You don't have permission to do that/i
Instance Method Summary
collapse
Instance Method Details
#assert_no_xml_tag(xml, conditions) ⇒ Object
34
35
36
37
38
|
# File 'lib/test/muck_test_methods.rb', line 34
def assert_no_xml_tag(xml, conditions)
doc = HTML::Document.new(xml)
assert !doc.find(conditions),
"expected no tag, but found tag matching #{conditions.inspect} in:\n#{xml.inspect}"
end
|
#assert_xml_tag(xml, conditions) ⇒ Object
Add more helper methods to be used for testing xml
28
29
30
31
32
|
# File 'lib/test/muck_test_methods.rb', line 28
def assert_xml_tag(xml, conditions)
doc = HTML::Document.new(xml)
assert doc.find(conditions),
"expected tag, but no tag found matching #{conditions.inspect} in:\n#{xml.inspect}"
end
|
#assure_logout ⇒ Object
11
12
13
14
|
# File 'lib/test/muck_test_methods.rb', line 11
def assure_logout
user_session = UserSession.find
user_session.destroy if user_session
end
|
#ensure_flash(val) ⇒ Object
16
17
18
|
# File 'lib/test/muck_test_methods.rb', line 16
def ensure_flash(val)
assert_contains flash.values, val, ", Flash: #{flash.inspect}"
end
|
#ensure_flash_contains(val) ⇒ Object
20
21
22
23
24
25
|
# File 'lib/test/muck_test_methods.rb', line 20
def ensure_flash_contains(val)
flash.values.each do |flv|
return true if flv.include?(val)
end
false
end
|
#login_as(user) ⇒ Object
1
2
3
4
5
6
7
8
9
|
# File 'lib/test/muck_test_methods.rb', line 1
def login_as(user)
success = UserSession.create(user)
if !success
errors = user.errors.full_messages.to_sentence
message = 'User has not been activated' if !user.active?
raise "could not login as #{user.to_param}. Please make sure the user is valid. #{message} #{errors}"
end
UserSession.find
end
|
#make_parent_params(parent) ⇒ Object
40
41
42
|
# File 'lib/test/muck_test_methods.rb', line 40
def make_parent_params(parent)
{ :parent_id => parent.id, :parent_type => parent.class.to_s }
end
|
#muck_routes_protocol ⇒ Object
Use to determine whether or not ssl should be used
20
21
22
23
|
# File 'lib/muck-engine.rb', line 20
def muck_routes_protocol
@@routes_protocol ||= MuckEngine.configuration.enable_ssl ? (ENV["RAILS_ENV"] =~ /(development|test)/ ? "http" : "https") : 'http'
end
|