similar to: Question: Writing migration code

Displaying 20 results from an estimated 2000 matches similar to: "Question: Writing migration code"

2007 Jun 11
12
Mocking system/`
This drives me insane on a regular basis. How does one mock system(''blah'') or `blah` ? Adding expectations on Kernel doesn''t do it. Adding expectations on Object just makes me sad: Object.any_instance.expects(:system).with(''ls'') # => #<Mock:0x12b584e>.system(''ls'') - expected calls: 0, actual calls: 1 And this really
2006 Dec 21
4
Stubbing Kernel#open
Anyone know how to stub Kernel#open? I''m trying to mock/stub an open-uri call, but it doesn''t seem to like it. Here''s the test code, and the failures: body = File.open(File.dirname(__FILE__) + ''/../fixtures/google_search_california.html'').read
2006 Jun 07
4
Question: coding protected methods
Apologies first, because I need to ramp up on Ruby and coding Ruby in Rails, however it''s my 3rd day with this beast :) so I''m asking : When I added protected methods to the model before it was like: protected method.................... end Would this be a valid way to write a protected method as well ?: attr_protected :column1, :column2 Perhaps this particular call
2006 Sep 03
2
Fwd: Dealing with exec?
---------- Forwarded message ---------- From: Kevin Clark <kevin.clark at gmail.com> Date: 01-Sep-2006 20:31 Subject: Dealing with exec? To: James Mead <jamesmead44 at gmail.com> Hey James, Sorry to bug you. I was curious how you''d handle a call to exec in a method you were testing. Kernel.stubs(:exec)... doesn''t seem to work but I''m not sure where else an
2007 Apr 12
15
Preview of Latest Mocha Changes
I''ve finally managed to find some time to do some serious work on Mocha. There are some code snippets on my blog (http://blog.floehopper.org/articles/2007/04/12/preview-of-latest-mocha-changes) showing the new functionality available in trunk (revision 128). I don''t don''t know how many people out there are using trunk, but it would be great to get some feedback on these
2007 Jan 17
8
Mocha Mock''s hanging on after test run?
Hi guys, I''m running mocha (0.3.2) against Rails core and just found an issue where the mock doesn''t go away after the test is run. For example: def test_reset_bang_doesn_reinstall_named_routes ActionController::Routing::Routes.named_routes.expects(:install).never @session.reset! end def test_zzz puts ActionController::Routing::Routes.named_routes.inspect
2006 Aug 23
2
Re: STI and Joins Broken
I''ve made a inheritance rework some weeks ago that would possible fix it since it only loads the inheritance support in the class that''ll use it. In STI case, it would load only if the class that descends directly from AR has been inherited and the column specified in the inheritance_column is available. People here told me to wait until next release so we can dig into this, but
2006 Mar 07
7
m:n or multiple 1:n?
I have a Newbee question: i have three tables and want to connect them. so is it stupid to make a triple m:n (rails style xs_ys_zs) or do i have to make a new table (newtable) where i got multiple 1:n? the habtm (has and belongs to many) do only work proper to join two tables, or i am wrong? -jens -- Posted via http://www.ruby-forum.com/.
2006 Jun 09
18
Is IRB the ruby console ?
I''m running script/console but keep getting the message that irb.bat is not recognized as an internal or external command, operable program or batch file. If it means anything I am running instant rails. I can invoke irb straight forward. TIA Stuart -------------- next part -------------- An HTML attachment was scrubbed... URL:
2006 Oct 17
4
Mocking the rendering of a Rails template
Hello all, I''m having difficulty setting up mocks such that I can verify that Rails was going to render the right template file (for example new.rhtml) and stop Rails from performing the actual rendering. After peeking at Rails'' internals, I tried two techniques as illustrated here: http://pastie.caboo.se/18197 Neither worked. I think the first one failed because Rails
2006 Aug 07
8
Login form question
I''m using Rails Recipes to create a login form but instead of username and password, my setup is firstname, lastname, password. I seemed to be gramatically challenged and not sure how to set up the parameter list. Can anyone offer up a suggestion. The book shows the method starting like: if request.post? user = User.find(:first, :conditions => [''username = ?'' ,
2006 Aug 08
11
Newb question- method not working
I know this shouldn''t be in the view but to test the code it is. Anyway if I do just session[user] I get back the user id (the id from the user table) which is good. However this code does not work. <% a = session[:user] %> <% uname = User.find(:first, :conditions => id = a) %> <%= @uname %> TIA Stuart
2006 Jun 17
4
Simple tutorial weirdness
Sorry - working on a simple tutorial but something is throwing me here. I''m supposed to get a Time.now() print to the page but it''s not working and I can''t figure out why. No errors are thrown my the page shows: Howdy, world! My name is Stuart Felenstein. This was verified at . So no time stamp showing. I went into IRB , did a Time.now() and it''s working
2006 Sep 03
1
Returning different values with stubs
Right now I''m working on adding tests to a method that looks like this: def get_via_redirect(path, args={}) get path, args follow_redirect! while redirect? status end So, I want to confirm that get is called and that status is returned but I also want to see that when the value of redirect? effects how many times follow_redirect is called. Is there
2006 Sep 03
1
Slimmed down version for inclusion in Rails?
I''m pushing a major overhaul in testing the Rails codebase. Mocha and stubba make my life easy so that''s what I''m using. The first major patch using them is in RailTies (http://dev.rubyonrails.org/ticket/5970) now. I spoke to DHH today about using it in the other libraries and I think it''ll be ok, but they really want to include as little code as needed. I
2006 Jun 14
13
Undefined method
I really hope this is not a bad question (as in he''s abusing the list). However I could use a little direction (even though I''m reading books, tutorials) Right now I''m getting a undefined method `category'' for 4:Fixnum The specific lines from the rhtml file are: <td><%= link_to position.category_id.category, :action => "show", :id =>
2006 Jun 12
3
Syntax errors on "insert into"
I''m digging around and googling but can''t seem to find what I think is a simple thing. All I''m trying to do is insert data in a migration into a table, using regular SQL statements. LIke this: class AddStateData < ActiveRecord::Migration def self.up INSERT INTO states values ('''',''Alaska''); INSERT INTO states values
2007 Jun 15
2
Is it still possible to use should_have_rjs
Hi I''ve come back to a Rails project after about a month doing other work, and there''s a lot of changes. I was on the 0.7 branch before and I''ve upgraded to RSpec 1.0.5. I used the spec translator, fixed the cases where it barfed on unusual line contents, and all my model and controller specs now pass. But I''m getting 53 failures on my view specs,
2006 Jul 16
3
OT: Radrails
Sorry, but I have tried signing up for the RadRails list and never can get a confirmation email. I think it may not exist. Anyway, I created a project using just cli, now I''m trying to import the project with no success. I choose the directory and radrails just sits there not enabling the okay button Sound familiar ? Maybe I''m doing something wrong. Stuart
2006 Nov 13
9
Setting up Mongrel and Apache , some direction needed
I have a site that is PHP on Apache / RedHat , but will send requests to a subdomain (running Rails) for database operations. I believe the set up should be to have ROR using Mongrel, and an Apache virtual host passing requests from apache to mongrel. Does this sound correct ? I believe the Virtual Host is set up in Apache. One of my problems is I can''t find the httpd.conf file for