similar to: Specs for ApplicationController, where to put them?

Displaying 20 results from an estimated 100 matches similar to: "Specs for ApplicationController, where to put them?"

2007 May 10
12
shared descriptions -- a couple of issues
Hello All, I''ve just upgraded to rspec/rspec_on_rails 0.9.3 and am very excited about shared descriptions. They couldn''t have come at a better time: I just finished refactoring some REST controllers so that the bulk of the actions are inherited from a superclass. Now I can write the specs once, too. :) I''ve hit a couple of snags, though. I thought I''d
2007 Oct 16
6
Failure trying to test ApplicationController
I''m trying to write some tests for the ApplicationController as shared tests that can be run in all of my other controller tests, but am getting a nil.rewrite error. Below is what I have... describe AccountController do it_should_behave_like ''Application controller'' end describe ''Application controller'', :shared => true do it
2007 Dec 12
3
undefined method: controller_name
With rspec 1.0.8 I have a spec in the directory: spec/units/controllers/application_controller_spec.rb require File.dirname(__FILE__) + ''/../../spec_helper'' class DummyController < ApplicationController def index raise "Prevent index from rendering" end end describe ApplicationController, "Handling errors in production", :behaviour_type =>
2007 Dec 04
1
spec''ing shared controller methods
I want to isolate and spec methods that are shared by controllers, and live in application.rb. Whereas I usually also provide examples in individual controllers that use these methods, not necessarily all the edge cases and I''d like to isolate the examples. This is the approach I''m taking (thanks to bryanl for suggestions and http://pastie.caboo.se/123626). WDYT? This
2006 Sep 23
8
acts_as_rateable plugin help!
Hello, I am having some trouble figuring out how to use the rateable plugin. i followed as close as the directions located at http://www.naffis.com/blog/articles/2006/08/31/rails-ajax-star-rating-system but i fail at working it. i am getting this error You have a nil object when you didn''t expect it! The error occured while evaluating nil.rating Extracted source (around line #1): 1:
2007 Aug 04
5
reusable specs - almost there
I have a lot of controllers with virtually identical functionality for most actions. I''ve been using shared behaviours to DRY things up a bit, but I still have to create separate behaviours for each context before I can use the shared behaviours what I have now is a generic file which contains all the behaviours and examples common to all the controllers, and that file gets loaded from
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
2007 Jun 21
9
it_should_behave_like
I''m trying to use it_should_behave_like, and something seems to be wonky with the syntax. When I add :shared=>true, the DSL complains that the next line is the fixture declaration: /vendor/plugins/rspec/lib/spec/dsl/behaviour_eval.rb:137:in `method_missing'': undefined method `fixtures'' for #<Spec::DSL::EvalModule:0x324a2cc> (NoMethodError) Here''s the
2007 Aug 06
2
used the described Class in a shared behavior
Is it possible to access the described class in a shared behavior? I''m trying to do something like this: describe "Siberian feline", :shared => true do described_class_instance_as :feline, :name => "fluffy", :breed => "Siberian" # or maybe before(:all) do @feline = described_class.new(:name => "fluffy", :breed =>
2007 Nov 21
22
Getting Class in Shared Behaviours
Hi, I want to be able to get at the described class in my shared behaviour. I''m sure an example will say it better than my words describe "my shared", :shared => true do it "should tell me what the class is its describing" do how_do_i_get_the_user_class_here end end describe User do it_should_behave_like "my shared" #... end So in my
2007 May 04
11
spec template for CRUD?
Hello, Has anyone already come up with a set of shared behaviours that someone could leverage when adhering to a CRUD concept, with respect to controllers? Relatedly, it would be nice if there were a way to share generalized behaviour specs. -Chris
2007 Nov 01
8
Specifying mixins
Hi folks, Can anyone share some accumulated wisdom about the best way to spec mixins in general, and (Jamis Buck-style) ActiveRecord "concerns" in particular? The standard situation here is that there''s a bunch of functionality, related by concept if not by implementation, that one wants to inherit in many different classes (e.g. ActiveRecord models) without having to
2007 Jun 27
2
Controller specs not shareable?
Hi I just wondered if there was a reason why Rails controller specs are not shareable? eg describe "All XHR POSTs to /gap/calculate_quote", :shared => true do controller_name :gap # ... end describe "XHR POST /gap/calculate_quote with valid details" do it_should_behave_like "All XHR POSTs to /gap/calculate_quote" # ... end blows up with
2007 Jun 17
2
Testing a call to super
Hi, Is there or could there be any way to test that a method calls "super"? Thanks -- Jonathan Leighton, Web Developer http://jonathanleighton.com/
2010 Mar 18
1
shared_example can't have the same name even if defined it different specs
I am writing some specs related to permissions for different kinds of users. Every user has some common examples to test in many different specs. For example, all users can view, and edit their profile. Also, all users can view their own "history." So I have two spec files, say profile_controller_spec and history_controller_spec. They might look like http://gist.github.com/336898
2007 Sep 14
0
using #include in shared behaviours
Hi folks, Is there any way I can call #include from within a shared behaviour without it blowing up?: > vendor/plugins/rspec/lib/spec/dsl/shared_behaviour.rb:48:in > `included'': private method `include'' called for #<Class:0x3047484> > (NoMethodError) More detail: I have a spec/concerns directory which contains specs corresponding to mixins in
2007 Oct 21
8
Interesting shared behaviour side-effect
Given the following ApplicationController specs: describe ApplicationController, "one facet", :shared => true do it ''foo'' ... it ''bar'' ... end describe ApplicationController, "some other facet", :shared => true do it ''abc'' ... it ''xyz'' ... end describe
2007 Dec 27
5
ExampleGroup and SharedExampleGroup relationship(?)
I''m working on a series going over the source code for rspec, and I ran into something interesting with ExampleGroup and SharedExampleGroup. I was wondering if anyone could shed light on it. [NOTE: I''m working through the code for my own edification in learning Ruby. Ruby has some features that I think are incredibly cool, so I''m using a concrete implementation (RSpec)
2007 Mar 19
0
cookies
How do I set cookies in a spec so I can see them in my controller, please? Conversely, why doesn''t this work... require File.dirname(__FILE__) + ''/../spec_helper'' class TestApplicationController < ApplicationController def index @seen = cookies[''auth_token''] || ''NOT seen!'' puts cookies.inspect #
2011 Aug 05
5
named context or calling include_context with block?
Hello, I''m playing around with Rspec again after going from test/unit to rspec then back to test/unit... :) Right off the bat, I find myself wanting to do something like this: https://gist.github.com/1128091 Basically, I want to name a context, then call it later by name, passing a block to it. Or in other words... what is the best way to DRY this code?