Skip to content

Commit

Permalink
Added spec and implementation code for storing a tickets title.
Browse files Browse the repository at this point in the history
  • Loading branch information
baphled committed May 24, 2010
1 parent 2a83660 commit 877685e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/parking_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def import
@resource = Resource.find(params[:resource][:id])
params[:lighthouse][:ticket_id].each do |item|
ticket = @resource.ticket(item)
if not LightHouse.create(:ticket_id => item, :body => ticket.original_body)
if not LightHouse.create(:ticket_id => item, :title => ticket.title, :body => ticket.original_body)
flash[:error] = "Unable to save tickets"
redirect_to parking_index_path and return
end
Expand Down
7 changes: 6 additions & 1 deletion spec/controllers/parking_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,13 @@
end

it "should save the tickets content body" do
Resource.should_receive(:find)
post :import, {:lighthouse =>{:ticket_id => ["9"]}, :resource => {:id => 1}}
Resource.first.body.should_not be_nil
end

it "should save the tickets title" do
post :import, {:lighthouse =>{:ticket_id => ["9"]}, :resource => {:id => 1}}
Resource.first.title.should_not be_nil
end
end

Expand Down

0 comments on commit 877685e

Please sign in to comment.