Skip to content

Commit

Permalink
chore(reflectors): Rename Bot to Reflector
Browse files Browse the repository at this point in the history
  • Loading branch information
akabiru committed Aug 13, 2018
1 parent e84da35 commit 6cf8ce3
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/fakerbot/command.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require 'forwardable'
require_relative 'bot'
require_relative 'reflector'
require_relative 'renderer'

module FakerBot
Expand Down
2 changes: 1 addition & 1 deletion lib/fakerbot/commands/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize(options)
end

def execute(output: $stdout)
render FakerBot::Bot.list(verbose: @options[:verbose]), output
render FakerBot::Reflector.list(verbose: @options[:verbose]), output
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/fakerbot/commands/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize(options)
end

def execute(input, output: $stdout)
render FakerBot::Bot.find(input), output
render FakerBot::Reflector.find(input), output
end

private
Expand Down
2 changes: 1 addition & 1 deletion lib/fakerbot/bot.rb → lib/fakerbot/reflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module FakerBot
# Exposes `Faker` reflection methods
# @api private
class Bot
class Reflector
Faker::Base.class_eval do
# Select `Faker` subclasses
# @return [Array] `Faker::Base` sub classes
Expand Down
8 changes: 4 additions & 4 deletions spec/fakerbot/bot_spec.rb → spec/fakerbot/reflector_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
RSpec.describe FakerBot::Bot do
subject(:bot) { described_class }
RSpec.describe FakerBot::Reflector do
subject(:reflector) { described_class }

describe '.find' do
context 'when a match is found' do
let(:result) { bot.find('name') }
let(:result) { reflector.find('name') }

it 'it returns the list of matches' do
expect(result[Faker::Name]).to include(:name)
Expand All @@ -13,7 +13,7 @@

context 'when no match is found' do
it 'returns an empty array' do
expect(bot.find('foobar')).to be_empty
expect(reflector.find('foobar')).to be_empty
end
end
end
Expand Down
1 change: 0 additions & 1 deletion spec/integration/list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@
it 'executes `fakerbot list -v` command successfully' do
output = `fakerbot list -v`
expect(output).to match(/Faker::/)
expect(output).to match(/└──/)
end
end

0 comments on commit 6cf8ce3

Please sign in to comment.