Skip to content

Instantly share code, notes, and snippets.

View RaZer's full-sized avatar

Sergey Stupachenko RaZer

View GitHub Profile
module PunditMatchers
extend ::RSpec::Matchers::DSL
matcher :permit do |action|
match do |policy|
policy.public_send("#{action}?")
end
failure_message_for_should do |policy|
"Expected #{policy.class} to permit :#{action} on #{policy.record} for #{policy.user.inspect}."
@RaZer
RaZer / ruby_test.rb
Created November 18, 2011 12:21 — forked from skwp/ruby_test.rb
Ruby Questions
# Instructions for this test:
# 1. Please clone this gist as a git repo locally
# 2. Create your own github repo called 'rubytest' (or a name of your choice) and add this repo as a new remote to the cloned repo
# 3. Edit this file to answer the questions, and push this file with answers back out to your own 'rubytest' repo.
# Problem 1. Explain briefly what this code does, fix any bugs, then clean it up however you
# like and write a unit test using RSpec.
def bracketed_list(values)
temp=""