Displaying 4 results from an estimated 4 matches for "active_project".
Did you mean:
active_projects
2007 Jul 29
6
Isolating rails model specs from their implementation
...Rails project management app I built when
learning Rails and adding specs to it. During the course of building
the app the requirement that project should be archiveable was added.
So a project is in one of two states active or archived.
This led to the creation of the following methods:
Project.active_projects
Project.archived_projects
@project.active?
@project.archived?
@project.archive!
@project.unarchive!
The current implementation of this is using a separate table of
"visibilities" as follows:
# Implementation 1 (Current)
Tables:
Project
id name visibility_status_id...
2007 Jan 22
1
Observed models cause failures with DRBSpec ?
.../../spec_helper"
context "A user with an inactive and an active project" do
setup do
@user = User.new
end
specify "should be able to return active projects only" do
@active = mock("active")
Project.stub!(:active).and_return([@active])
@user.active_projects.should == [@active]
end
end
# app/models/user.rb
class User < ActiveRecord::Base
has_many :projects, :foreign_key => "owner_id", :order => "projects.title"
def active_projects(force=false)
@active_projects = nil if force
@active_projects ||= self.proje...
2007 Jan 21
35
Collection proxies need to be stubbed ?
Hi all !
I just started writing specs on a new project. I would just like to
validate that this is the way you would write it. I know about mocks,
stubs and expectations. I don''t think this is a problem for me.
My question really boils down to:
def index
@projects = current_user.projects.active
end
My spec needs to return the proxy, no ? Here''s my code:
context "A
2012 Oct 30
1
pass javascript date variable to rails controller as params
...;%=update_projects_admins_users_path%>",
{
id:''<%=params[:user]%>'',
date_selected: date.getDate()
},
function(data)
{ $(''.active_projects'').html(data);
//alert("Data: " + data + "\nStatus: " +
status);
}
);
if (allDay) {
alert(''Clicked on the entire day: '' + date);
}...