Skip to content

Instantly share code, notes, and snippets.

@Fire-Dragon-DoL
Created December 30, 2014 23:21
Show Gist options
  • Save Fire-Dragon-DoL/a44f5cf5976b7803366a to your computer and use it in GitHub Desktop.
Save Fire-Dragon-DoL/a44f5cf5976b7803366a to your computer and use it in GitHub Desktop.
:symbol.rolify raises, "symbol".rolify works
class String
def rolify
Roles.for(to_sym)
end
end
class Symbol
def rolify
Roles.for(self)
end
end
require 'rails_helper'
require 'extensions/symbol'
require 'extensions/string'
require 'roles'
RSpec.describe Roles, type: :model do
subject { described_class }
let!(:guest) { Roles.guest }
it "rolifies a symbol", focus: true do
expect(:guest.rolify).to eq guest
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment