-
-
Save Fire-Dragon-DoL/a44f5cf5976b7803366a to your computer and use it in GitHub Desktop.
:symbol.rolify raises, "symbol".rolify works
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def rolify | |
Roles.for(to_sym) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Symbol | |
def rolify | |
Roles.for(self) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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