Skip to content

Commit

Permalink
Merge pull request #492 from srachner/fix-setting-editor-with-symbol
Browse files Browse the repository at this point in the history
Fix setting editor with symbol
  • Loading branch information
RobinDaugherty committed Nov 5, 2020
2 parents afc1e3e + 1f65a70 commit fce143f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/better_errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def self.editor
#
def self.editor=(editor)
if editor.is_a? Symbol
@editor = Editor.for_symbol(editor)
@editor = Editor.editor_from_symbol(editor)
raise(ArgumentError, "Symbol #{editor} is not a symbol in the list of supported errors.") unless editor
elsif editor.is_a? String
@editor = Editor.for_formatting_string(editor)
Expand Down
6 changes: 3 additions & 3 deletions spec/better_errors_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
describe ".editor" do
context "when set to a specific value" do
before do
allow(BetterErrors::Editor).to receive(:for_symbol).and_return(:editor_from_symbol)
allow(BetterErrors::Editor).to receive(:editor_from_symbol).and_return(:editor_from_symbol)
allow(BetterErrors::Editor).to receive(:for_formatting_string).and_return(:editor_from_formatting_string)
allow(BetterErrors::Editor).to receive(:for_proc).and_return(:editor_from_proc)
end
Expand All @@ -27,9 +27,9 @@
end

context "when the value is a symbol" do
it "uses BetterErrors::Editor.for_symbol to set the value" do
it "uses BetterErrors::Editor.editor_from_symbol to set the value" do
subject.editor = :subl
expect(BetterErrors::Editor).to have_received(:for_symbol).with(:subl)
expect(BetterErrors::Editor).to have_received(:editor_from_symbol).with(:subl)
expect(subject.editor).to eq(:editor_from_symbol)
end
end
Expand Down

0 comments on commit fce143f

Please sign in to comment.