Skip to content
Permalink
Browse files

Rename FindRaid -> ShowRaid

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 8d3e8b47274d4092cf03763d9489d10ad51b1780
@@ -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)
@@ -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)
@@ -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

@@ -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

@@ -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

0 comments on commit 8d3e8b4

Please sign in to comment.
You can’t perform that action at this time.