Skip to content

Instantly share code, notes, and snippets.

@dchapman1988
Forked from rthbound/spaghetti.rb
Created July 8, 2012 00:10
Show Gist options
  • Save dchapman1988/3068671 to your computer and use it in GitHub Desktop.
Save dchapman1988/3068671 to your computer and use it in GitHub Desktop.
spaghetti
require 'use_case_helper'
describe UseCase::Plan::Hotel::Create do
describe "when executed" do
before do
hotel_search_usecase_class = mock("Hotel Search UseCase Class")
hotel_search_usecase_object = mock("Hotel Search UseCase Object")
hotel_usecase_search_result = mock("Hotel Search UseCase Result")
hotel_usecase_search_data = mock("Hotel Search UseCase Data")
hotel = mock("Hotel")
persistence_class = mock('Persistence Class')
persistence_object = mock('Persistence Object')
# Start "find_hotel_for_plan"
hotel_search_usecase_class.expects(:new).returns(hotel_search_usecase_object).once
hotel_search_usecase_object.expects(:execute!).returns(hotel_usecase_search_result).once
hotel_usecase_search_result.expects(:data).returns(hotel_usecase_search_data).once
hotel_usecase_search_data.expects("[]").with("search").returns(hotel).once
# End "find_hotel_for_plan"
@use_case = UseCase::Plan::Hotel::Create.new(params: {hotel_id: 126913 }, hotel_search_usecase_class: hotel_search_usecase_class, persistence_class: persistence_class)
end
it "should initialize properly" do
@use_case.execute!
end
it "should return a UseCase::Result class" do
@use_case.execute!.must_be_kind_of UseCase::Result
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment