Displaying 6 results from an estimated 6 matches for "ticketscontrol".
2007 Aug 17
11
[rspec] looking for a simple refresher
I''ve been off the rspec for a few months and I''m trying to get back on it.
1)
Spec::Mocks::MockExpectationError in ''TicketsController handling POST
/tickets should create a new ticket''
Mock ''Ticket_1001'' expected :new with ({}) once, but received it 0 times
./spec/controllers/tickets_controller_spec.rb:16:
script/spec:4:
class TicketsController < ApplicationController
def new
Ticket.new...
2007 Aug 21
2
using restful_authentication current_user inside controller specs
...ted out while rspec''in but I''ll need to add them
in my specs.
def create
@ticket = Ticket.new(params[:ticket])
@ticket.user = current_user
if @ticket.save
redirect_to tickets_path
else
render new_ticket_path(params[:user_id])
end
end
describe TicketsController, "handling POST /tickets" do
before do
@ticket = mock_model(Ticket, :save => true)
@current_user = mock_model(User)
@params = {}
end
def do_post
post :create, :ticket => @params
end
it "should create a new ticket and assign current user as...
2006 Aug 14
2
ActionPack: number_to_phone error
...ut the number_to_phone function as provided by rails in actionpack:
http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html
If I do this in my controller:
num = number_to_phone(params[:phone_number])
I get this error:
undefined method `number_to_phone'' for #<TicketsController:0xb7a2bfcc>
Whereas if I do this in my view:
<% phone_number = number_to_phone(@phone_number.phone_number) %>
<%= text_field ''phone_number'', ''phone_number'', {
:value => phone_number,...
2007 Jun 14
1
rspec will_paginate
....filter_status_by(status, page, per_page = 10)
conditions = {:status => false} if status == "unsolved"
conditions = {:status => true} if status == "solved"
return Ticket.paginate(:page => page, :per_page => per_page, :conditions
=> conditions)
end
describe TicketsController, "handling GET /tickets" do
before do
@tickets = mock_model(Ticket)
Ticket.stub!(:find).and_return([@ticket])
end
def do_get
get :index
end
it "should be successful" do
do_get
response.should be_success
end
it "should render index te...
2006 Jun 16
0
Polling pop3 and adding emails to ticket system
...the ticket system.
but all i get is error, can somebody enlighten me?
class IncomingMail < ActionMailer::Base
def receive(email)
@ticket = Ticket.new
@ticket.name = email.from[0]
@ticket.title = email.subject
@ticket.description = email.body
@ticket.save
end
end
class TicketsController < ApplicationController
def index
list
render :action => ''list''
end
# GETs should be safe (see
http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action...
2006 Apr 24
0
Blank page output :(
...yntax. Could this be the problem??
development.log:
===============================================================
Your environment.rb uses the old syntax, it may not continue to work in
future releases.
For upgrade instructions please see:
http://manuals.rubyonrails.com/read/book/19
Processing TicketsController#index (for 82.168.159.24 at 2006-04-24
14:26:05) [GET]
Session ID: d55cf422bb16714c754a503aa82ea334
Parameters: {"action"=>"index", "controller"=>"tt/tickets"}
GOT HERE
Rendering tt/tickets/index
Completed in 0.00432 (231 reqs/sec) | Renderi...