Displaying 20 results from an estimated 1000 matches similar to: "Specing Rails Views"
2006 Apr 12
3
acts_as_authenticated trouble
First off, I''d like to address that I''m n00bs.
I''ve read the README and blogs associated with this plugin, and there
really isn''t too much documentation. I have the newest version of
rails,ruby, and acts_as_authenticated installed.
#The setup
I set up the acts_as_authenticated in the following manner.
*created a table called "accounts" in the
2008 Jan 30
2
Where can I get "authenticate_with_http_basic"?
Hi,
I just installed Rails 2.0.2
[root@mymachine easyx]# ruby --version
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]
[root@mymachine easyrx]# gem install rails --include-dependencies
Need to update 16 gems from http://gems.rubyforge.org
................
complete
Successfully installed rails-2.0.2
[root@remandev easyrx]#
But I''m getting this error in my restful_authentication
2007 Feb 05
1
long jumping out of code in specs
I wrote this abomination just now, and wonder if anyone else has had
experience with the pattern behind it. In short, I''m specing an
after_create hook on an ActiveRecord model, that calls a bunch of
private methods. Instead of stubbing all those private methods (which
is verboten anyway, as well as impossible because creating the object
which owns those methods is what I''m
2007 Jun 23
4
inverse examples? (should fail)
The new "pending" example feature reminds me of a feature I''ve been
bouncing around in my head, to aid in refactoring. Often, when I''m
changing existing behaviour, I know that certain aspects of the old
behaviour should change. Imagine changing the "it" method to perhaps
"not" or "old" or "removed"... The behaviour would be to
2007 Jan 08
2
thoughts on mocks and specs
I spent the last couple of days getting my sea legs with Rails and
RSpec. I''d been waiting til things seemed calmer before jumping in,
and I''m overall very happy with my experience so far.
My only real annoyance so far has been forgetting to call "do_post" or
"do_create" from my specify blocks. My mocks don''t get the calls they
want, and it usually
2006 Nov 25
2
Comparison between RSpec and test/unit
I''m curious, Christian Neukirchen has released test/unit[1] that seems
to mirror much of RSpec, but built on Test::Unit, so in some ways less
brittle from a Rails-integration perspective, and also allowing you to
mix the two together as appropriate.
So, has anyone made an informed comparison? I''m new enough that I
don''t really know the finer points yet. The syntax is
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
2007 Oct 04
5
Specs and Libs
How would I go about writing specs for a lib, particularly one with
all protected and private methods. I''m trying to spec the
AuthenticatedSystem library from the rails restful_authentication
plugin:
http://pastie.caboo.se/103625
Also, when you''re mocking objects, a side-effect is helping you
define the api of the object. Is there a way to get all the
behaviors that
2007 Oct 01
15
how to spec views
I''m trying to spec a view but haven''t done much view specing.
This view render different partials depending on authentication of the user:
annon, admin, player
So I I''ll write if conditionals in the view with the partials
it "should render signup propaganda for annon users trying to view games"
do
render "/games/index.rhtml"
2007 Feb 28
2
Fixture name not available as class variable in spec
Hi there,
I can''t seem to access the fixture name as a class variable from my
specs. I have to set the variable in the spec setup.
... [fixtures]
my_fixture:
id: 1
... [rpsec]
@my_fixture.id.should == 1
... [error]
You have a nil object when you didn''t expect it!
The error occurred while evaluating nil.id
... [my setup]
RSpec-0.7.5.1 (r1395) - BDD for Ruby
Rails
2006 Dec 13
4
RSpec and simply_helpful
Hi All
I''m having some problems running my view specs when using
simply_helpful. I have it semi-working via the following:
module SimplyHelpfulHelper
def self.included(base)
base.send :include, SimplyHelpful::RecordIdentificationHelper
base.send :include, SimplyHelpful::RecordTagHelper
end
end
context "The index template" do
setup do
@shift =
2006 Dec 11
2
Does mongrel look at the Rails page cache?
Hi all. I''m trying to skip the Rails page cache if the user is logged
in:
---
# Rewrite index to check for static
RewriteCond %{HTTP_COOKIE} !^.*logged_in=yes.*$
RewriteRule ^/$ /index.html [QSA]
# Rewrite to check for Rails cached page
RewriteCond %{HTTP_COOKIE} !^.*logged_in=yes.*$
RewriteRule ^([^.]+)$ $1.html [QSA]
# Redirect all non-static requests to cluster
RewriteCond
2007 Jun 23
6
Autotest bug with rerunning passing tests?
Am I correct in remembering that autotest (with Test::Unit) would
rerun all the tests if a subset of the tests passed? If so,
shouldn''t this behaviour also be present in rspec''s autotest library?
Scott
2008 Jun 17
3
Help with error - uninitialized constant AuthenticatedSystem::Base64
I am using restful_Authentication plugin combined with the built-in
http_basic authentication Rails 2.0.2
The following code in my controller seemed to work fine,
1. before_filter :authenticate
2.
3. def authenticate
4. case request.format
5. when Mime::XML, Mime::ATOM
6. if user = authenticate_with_http_basic { |name,
pass| User.authenticate(name,
2006 Oct 28
5
RSpec, REST and different formats
Is anyone using RSpec with RESTful rails apps? In my rails controllers I
check request.respond_to? and render different views accordingly.
I noticed that the get method in the rails plugin doesn''t accept headers:
controller_mixin.rb line 92
def get(action, parameters = nil)
@request.env[''REQUEST_METHOD''] = ''GET''
process action,
2008 Aug 08
2
template.expect_render fails when partial is rendered from a helper
My spec;
describe ''subnav rendering while logged in'' do
before do
template.stub!(:logged_in?).and_return(true)
template.stub!
(:current_profile).at_least(:once).and_return(mock_profile)
end
def do_render
render "/homepages/show.html.erb"
end
it "should render the logged in partial for homepages" do
2006 Nov 22
3
Controller Isolation
Hi,
I have a project that I had running under rspec 0.6.x and recently upgraded
to 0.7.2.
I am trying to isolate my controllers from the database as I go through and
change all the specs to run under 0.7.2.
I am having a problem where I need to make the create! method return the
mocked object as well as raise RecordInvalid exception. Is this at all
possible?
I use the rescue statement in my
2010 Jan 22
5
Rails Render Issue
Hi,
I am adding login functionality to my app which has two controllers
users and photos and i am having some trouble.
In my users/index view
<%if logged_in? %>
<%=render "photos/index"%>
<%else%>
.... Home page With login.....
<%end%>
In my photos/index view
<%if logged_in? %>
.... Welcome page .....
<%else%>
2008 Jun 13
3
before_filter order of execution
Hi
I''m trying to use before_filter to allow access to a site. Only logged
in users can view any object in the controller, but only users with a
access_level higher than 2 can view specific objects. My code is:
-----------------------------------------------------------
IN USER_CONTROLLER
before_filter :login_required
before_filter :access_granted, :only => [:destroy, :new , :edit]