search for: thing

Displaying 20 results from an estimated 123765 matches for "thing".

Did you mean: think
2007 Oct 25
1
Mocking/Stubbing help with subdomain as account key
My app uses account_location to set up subdomains as account keys. In my controllers, all my model operations are scoped through the @current_person object. The question is: How do I test this with RSpec''s mocking and stubbing? Basically, I need to test that @current_person.things is getting the find message and returning @thing. I''ve tried stubbing and mocking @current_person.things a number of different ways with no luck. Here''s my latest attempt: # things_controller_spec.rb before do @request.host = "subdomain.test.host" @thing =...
2007 Jul 19
5
need help getting a word right
Hey all, I see examples showing up that look like this: describe Thing do before(:each) do @thing = Thing.new end it do @thing.should be_something end end This will produce output like this: Thing - should be something But "it do" is driving me mad :( We need a better word. Of course, ''specify'' has not been completely r...
2006 Apr 24
5
Custom pagination
I am trying to paginate objects from a has_many/:through relationship using Paginator. current_user.things returns the objects that I''d like to paginate. For testing, I tried to make it 1 item per page. I initialise the paginator as follows: @thing_pages = Paginator.new(self, current_user.things.count, 1, @params[''page'']) I don''t know how to obtain @things now...
2006 Jun 04
6
Activerecord relations.
I''ve got two tables set up - Things and Users where Users have many things and Things belongs to Users. They''re connected by Things.user_id => User.id and Things.updated_by_id => User.id both in the Things model using Belongs_to and custom foreign key for one of them. Problem is when I''ve got the updated...
2006 May 18
3
Model Madness: habtm vs through
This has me scratching my head: a Person has many Things a Person has many Collections a Collection has many Things ...Things in a Collection are ordered ...Things in a Collection can be related to (created by) any User ...a collection has additional attributes, such as a name etc I am confused about habtm in rails (especially when using acts_a...
2007 Oct 26
3
Selecting a database from the application itself?
...g back to their good old excel after 5 minutes. The most "exciting" feature i thought of is also the one that scares me the most when it comes to coding: I''d love to let users actually connect to any database they want, retrieve a list of tables and fields and let them select anything they want on the labels. I can already see the tables with their fields that they could drag and drop on a label template... Well, I''m dreaming, and I''d love to know if this is going to stay just a dream or if this is actually possible using Ruby and Rails... Summary : Is there a...
2007 Dec 22
4
StepGroup ?
Hi, I have a need for the StepGroup feature in stories but not clear what''s the current api. Could you provide an example? In my case I have several scenarios which vary in the Givens, but not the results. Ideally I''m hoping to achieve something like: (but anything will do for now :) Scenario: one Given something When he does foo Then good things should happen Scenario: two Given something different When he does foo Group Of good things should happen Group: good things should happen Then good thing one And goo...
2007 Dec 18
16
shared behav
hi, i want to make a behavior shared between models, the examples need to create new instances etc. Is there a way to pass the model class to the shared behavior? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071218/5b400cc5/attachment-0001.html
2001 Nov 08
2
Error Bars
I'm trying to draw some error bars on a bar chart. I'm using code like this: thing <- c(3,3,3) se <- c(1,1,1) names(thing) <- c("A", "B", "C") barplot(thing, ylim=c(0,4)) arrows(c(1:3), thing-se, c(1:3), thing+se, code=3, angle=90,length=0.1) Using c(1:3) has 2 problems: 1. Obviously it is untidy, but using names(thing) doesn't work, a...
2011 Feb 02
1
A question about sampling
Greetings, I am attempting to do something with R that I think should be efficiently do-able, but I haven't yet found success. I have a vector of probability weights (for 17 categories), let's call it things (it could look like the one below, for instance). > things 0.026 0 0.233 0 0.131 0 0.415 0 0 0 0 0 0.192 0 0.067 0 0 I...
2007 Jun 27
3
template.expect_render
Trunksters, I just added a couple of methods to ActionView::Base in Spec::Rails (as of r2136) that lets you do this in view examples: describe ''/things/index.html.erb'' do it "should render _thing with a collection of things" do assigns[:things] = things = [Object.new] template.expect_render(:partial => ''thing'', :collection => things) render ''/things/index.html.erb'' end e...
2007 Jul 29
24
View-Driven-Development by Behavior-Driven-Development and RSpec
One of the things that turned me on to BDD and RSpec was speccing views first, that the desired end would drive the development. In previous projects while using Test::Unit I would try to make educated guesses as to what would be needed in the model and controllers to derive the view without actually writi...
2007 Feb 09
2
Re: customizing map.resources for REST
...of the old url pattern stuff out of the water. Would love to hear an answer to this question!!! b Andy Triboletti wrote: > I want to customize map.resources so it uses a uid in the URL instead > of the database id. The uid is a field on my object. > > So I have map.resources :things in routes.rb and I can update a thing > by accessing POST /thing/1. Instead I want to update the thing by > POST /thing/80ed14ce098affc2 The thing has an id of 1 and a uid of > 80ed14ce098affc2 > > Any options other then getting rid of map.resources and explicitly > defin...
2007 Jun 09
11
authentication, controller specs. I think I''m missing something simple ....
Hi all, I feel like I''m missing something really easy and I''m just not seeing it. I''m using the restful_authentication plugin and have a User model. Uesr has_many :things and Thing belongs_to :user. That''s it. I did a "script/generate rspec_scaffold thing" to generate all the necessary bits. The &q...
2005 Dec 15
0
RJS Templates and the Replace semantics
I have an issue with the way replace_html works in an RJS template. This is a copy of a post on my blog (http://blog.craz8.com <http://blog.craz8.com/> ) that describes the problem and my working solution to the problem. If I have a collection of things that are output like this: <div id="things"> <% @things.each do |thing| %> <%= render :partial => ''thing'' %> <% end %> </div> Or <div id="things"> <%= render :partial => ''thing'', :collection...
2005 Jul 12
2
save order from drag and drop
only just found the script.aculo.us site. brilliant. much respect. wondered if anyone can point me in the right direction on this drag and drop list re-ordering type thing, i''ve read through what I can but to be honest it''s gone right over my head! How do I get the new order that has been established via dragging list elements around and store them in a database. I figured an update link of some sort that grabs the order of the <li> id names a...
2008 Mar 13
2
joining matrices, vectors, scalars in one object
Hi, I have: a <- matrix(c(0,1,0,1),nrow=2) b <- matrix(c(1,1,1,0,0,0),nrow=3) c <- 1 d <- c(1,0,1) And I would like to join them in an object 'thing' so that I can access a, b, c, or d through an index in a for loop. For example: thing[4] would return [1] 1 0 1 Note however, that I have many of these 'thing' components. So many that a command like thing <- list(a = matrix(c(0,1,0,1),nrow=2), b = matrix(c (1,1,1,0,0,0)...
2020 Aug 07
2
LLVM deprecation policy
....td file in the system? That sounds a bit scary. I wrote a new test for range lists that tests the old and new range punctuator. And a release note is certainly in order. But I wasn't planning to patch all 600 .td files. At 8/7/2020 01:56 PM, David Blaikie wrote: >Fine by me to say the old thing's deprecated. > >Ideally, if it's not too painful - would be good if you could do a >complete migration to the new thing & remove the old thing, to help >keep things streamlined. (over multiple patches, with some >notification to llvm-dev and in release notes about the ol...
2007 Jun 24
6
mocking errors
What is the correct way to mock out the errors on a Rails model? I''m assuming i need to say @mock_thing = mock_model(Thing) @mock_thing_errors = mock("errors") @mock_thing_errors.should_receive(:full_messages).and_return("An error") @mock_thing.should_receive(:errors).and_return(@mock_thing_errors) Just wanted to check the best practice on this kind of thing and how other peopl...
2006 Aug 07
7
mysql Date field not getting set correctly
I created a simple test to try and pinpoint my problem but nothing seems clear to me. I created a Thing model with fields { id (INT), date (DATE) } now when I try to create a new "thing" the date does not get stored, and no errors are reported. @myNewThing = Thing.new(:date => "2006-08-07") @myNewThing.save this results in a new recor...