Top Level Namespace
Defined Under Namespace
Modules: Kernel, MagicAttributes, Math, Rails, Ruby
Classes: Array, BigDecimal, File, Hash, String
Instance Method Summary
collapse
Instance Method Details
#current_user ⇒ Object
34
35
36
|
# File 'lib/mark_facets/rails/test/authlogic.rb', line 34
def current_user
@current_user
end
|
#decode_json(json) ⇒ Object
1
2
3
4
5
|
# File 'lib/mark_facets/rails/test/decode_json.rb', line 1
def decode_json(json)
res = ActiveSupport::JSON.decode(json)
res = res.to_mash if res.is_a?(Hash)
return res
end
|
#delivered_emails ⇒ Object
1
2
3
|
# File 'lib/mark_facets/rails/test/delivered_emails.rb', line 1
def delivered_emails
ActionMailer::Base.deliveries
end
|
#enable_ssl ⇒ Object
1
2
3
|
# File 'lib/mark_facets/rails/test/enable_ssl.rb', line 1
def enable_ssl
request.env['HTTPS'] = 'on'
end
|
#have_same_elements(expected) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/mark_facets/rails/test/rspec/should/have_same_elements.rb', line 3
def have_same_elements(expected)
RSpec::Matchers::Matcher.new :have_same_elements, expected do
match do |actual|
unless actual.size == expected.size
false
else
ret = true
actual.each do |v|
ret = expected.include?(v)
break if !ret
end
ret
end
end
end
end
|
#login(user = @user) ⇒ Object
5
6
7
8
9
10
|
# File 'lib/mark_facets/rails/test/authlogic.rb', line 5
def login(user = @user)
@current_user = user
activate_authlogic
sess = UserSession.create(user)
UserSession.stub!(:find).and_return(sess)
end
|
#logout ⇒ Object
12
13
14
15
|
# File 'lib/mark_facets/rails/test/authlogic.rb', line 12
def logout
@current_user = nil
UserSession.stub!(:find).and_return(nil)
end
|
#render_404 ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/mark_facets/rails/test/rspec/should/render_404.rb', line 10
def render_404
simple_matcher("render a 404 page") do |given, matcher|
matcher.failure_message = "expected #{given.inspect} to render a 404 page"
matcher.negative_failure_message = "expected #{given.inspect} not to render a 404 page"
given.code.should == '404'
given.should render_template('public/404')
end
end
|