Skip to content

Commit

Permalink
Rename FindRaid -> ShowRaid
Browse files Browse the repository at this point in the history
While this Interactor might still be too simple for it's own object, I'm
taking the steps to ensure the Interactor names aren't REST-ish but
indicative of the actual use case being handled.
  • Loading branch information
jasonroelofs committed Jul 4, 2012
1 parent d8e9660 commit 8d3e8b4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/controllers/raids_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def update
protected

def find_raid(id)
FindRaid.new.by_id id.to_i
ShowRaid.new.by_id id.to_i
end

def schedule_raid(raid = nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
##
# NOTE: Is this too simple for an Interactor?
##
class FindRaid
class ShowRaid

def by_id(id)
Repository.for(Raid).find(id)
Expand Down
4 changes: 2 additions & 2 deletions test/integration/raids_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class RaidsControllerTest < ActionController::TestCase
login_as_user

@raid = Raid.new when: Date.today, start_at: Time.now, invite_at: Time.now
FindRaid.any_instance.expects(:by_id).with(10).returns(@raid)
ShowRaid.any_instance.expects(:by_id).with(10).returns(@raid)
ListCharacters.any_instance.stubs(:run).returns([])
end

Expand Down Expand Up @@ -99,7 +99,7 @@ class RaidsControllerTest < ActionController::TestCase
login_as_user

raid = Raid.new
FindRaid.any_instance.expects(:by_id).with(10).returns(raid)
ShowRaid.any_instance.expects(:by_id).with(10).returns(raid)

get :edit, :id => 10

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
require 'unit/test_helper'
require 'interactors/find_raid'
require 'interactors/show_raid'

describe FindRaid do
describe ShowRaid do

it "exists" do
FindRaid.new.wont_be_nil
ShowRaid.new.wont_be_nil
end

it "can find a raid by id" do
Repository.for(Raid).save Raid.new(where: "ICC", id: 1)

action = FindRaid.new
action = ShowRaid.new

r = action.by_id 1
r.wont_be_nil
Expand Down

0 comments on commit 8d3e8b4

Please sign in to comment.