Skip to content

Commit

Permalink
Refactored passing in the correct parameters and improved the tickets…
Browse files Browse the repository at this point in the history
… action also.
  • Loading branch information
baphled committed May 17, 2010
1 parent a3406a8 commit 8ba3c5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion app/controllers/parking_controller.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
class ParkingController < ActionController::Base
layout "application"

def index
end

def new
@resource = Resource.new
end

def tickets
@resource = Resource.new(:name => 'baphled', :project_id => '50164')
@resource = Resource.find(params[:resource][:id])
@tickets = @resource.tickets(params[:tag])
end

Expand Down
6 changes: 4 additions & 2 deletions spec/controllers/parking_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
describe "GET, tickets" do
context "requesting a list of tickets" do
it "should do a search using the LightHouse API for tags" do
Lighthouse::Ticket.should_receive(:find).with(:all, :params => { :project_id => '50164', :q => "state:open tagged:feature" })
get :tickets, {:tag => 'feature'}
@resource = mock_model(Resource, :name => "baphled", :project_id => '50164').as_null_object
Resource.stub!(:find).and_return @resource
@resource.should_receive(:tickets).with("feature")
get :tickets, {:tag => 'feature', :resource => {:id => 1}}
end
end
end
Expand Down

0 comments on commit 8ba3c5d

Please sign in to comment.