Displaying 7 results from an estimated 7 matches for "messagescontrol".
2007 Nov 13
2
More Rails Pattern Examples?
Hi,
I have been reading the documentation and examples on the rspec site.
There are two "patterns" from Rails that I am not clear how to
implement that are kind of related, and so I am not sure how to start.
Does anyone have any examples of how to write rspecs for these?
1/ Nested resources.
2/ Resources that are specific to the current_user. In other words, I
only want to
2007 Jun 02
7
I''m really bad at controllers, help please.
...'m trying to cover the following code w/ rspec
def index
if params[:user_id]
@user = User.find(params[:user_id])
@messages = @user.messages
end
end
So basically what I''m doing is listing all the messages for a user,
provided there is an id parameter.
describe MessagesController, " handling GET /messages for a user" do
before do
@message = mock_model(Message)
@message.stub!(:user_id).and_return(1)
@user = mock_model(User)
@user.stub!(:id).and_return(1)
User.stub!(:messages).and_return([@message])
User.stub!(:find).and_return([@user])...
2010 Jun 10
1
RSpec 2 equivalent for: assigns[:message].should == @message
describe MessagesController, "POST create" do
before(:each) do
@message = mock_model(Message, :save => nil)
Message.stub(:new).and_return(@message)
end
context "when the message fails to save" do
before(:each) do
@message.stub(:save).and_return(false)
end
it "...
2006 May 24
0
POST op parameters are coming in as StringIOs
I''m receiving a multipart post request from another server. The
request parameters are being received as StringIOs, rather than plain
strings. For instance :
Processing MessagesController#receive (for 83.166.68.31 at 2006-05-24
10:36:53) [POST]
Session ID: eedafb24033be0714f8133f02810083f
Parameters: {"message"=>#<StringIO:0xb7503358>, "date"=>#<StringIO:
0xb7501f30>, "from"=>#<StringIO:0xb7502944>, "type"...
2007 Apr 19
1
Spec''ing Namespaced Controllers
I''m stucking trying to figure out how to write a spec for a namespaced
controller. Any help is appreciated.
Thanks,
Marcus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070419/75a167fa/attachment.html
2006 May 31
5
Sharing code between some controllers? Staying DRY
Hi,
I have four controllers: one for the store front and three for the
store admin. In each controller I have copied and pasted exactly the
same code. It is a method called redirect_to() to override Action
Controller''s redirect_to(). Copy and paste is bad. I can think of two
options but I don''t know how Rails will feel about them.
Option 1: Can I create an intermediate
2007 May 31
16
Could anyone please help with rspec/nested resource behavior checking?
My problem has been listed here:
http://railsforum.com/viewtopic.php?pid=25439#p25439
Don''t think it would be required to completely re-type it here :)
Thanks!
--
-Daniel Fischer
http://danielfischer.com - Geek Blog
http://abigfisch.com - Portfolio
http://writersbeat.com - Writing Community