Displaying 11 results from an estimated 11 matches for "behaviour_type".
2007 Aug 16
17
undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
I am getting:
undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
with my view specs after upgrading to 1.0.8. Is anyone else seeing this?
To isolate the message I did the following setup:
- create new rails project (with edge)
- installed rspec and rspec_on_rails
- ran rake spec
- ran script/generate rspec_scaffold products
- tried to run a builtin view
2007 Aug 31
2
Can module spec "behave like" controller spec?
...are provided by my
colleagues. Some of the modules actually contain action methods. I tried
very hard to spec those action methods in modules. But it seems that the
rspec does not allow module spec to ''get'' action like controller does. After
I saw the documentation, I then used :behaviour_type=>:controller. However,
it failed again. It reported an error for me. For illustration, I''d like a
simple example.
module MyModule
def copy #an action method
render :partial=>"/index", :layout=>false
end
end
describe MyModule, :behaviour_type=>:control...
2007 Oct 23
9
Running rails specs outside of the normal project tree
I want to create a spec/regressions directory with various
regressions (for my rails project). I tried the following:
describe LoginController, "regression for user creation when
steves_sister does not exist", :behavior_type => :controller do
controller_name :login
before :each do
@params = {
"commit"=>"Create Account",
2007 Dec 12
3
undefined method: controller_name
...cation_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 => :controller do
controller_name :dummy
before(:each) do
# set up request and response
lambda { get :index }.should raise_error
end
it "should display ''file not found'' when a routing error occurs" do
controller.rescue_action_in_public(ActionC...
2007 Aug 02
2
Do the :attributes and :content matchers work
...lock.
As I said I would expect this to fail but it does not.
I am trying this because in the
<my_app>/vendor/plugins/rspec_on_rails/spec/rails/dsl/view_spec_spec.rb
file there is an example
describe "A view that includes a partial using :collection and
:spacer_template", :behaviour_type => :view do
before(:each) do
render "view_spec/partial_collection_including_template"
end
it "should render the partial w/ spacer_tamplate" do
response.should have_tag(''div'', :content => ''Alice'')
response...
2007 Aug 30
7
mock_model in spec/lib
Has anyone else run into a problem with trying to use mock_model in spec/lib ?
For some reason, I can take the same spec, put it in spec/models, have it run
fine, but put it in spec/lib, and have it complain about not being able to find
#mock_model
Thanks,
Edward
2007 May 15
3
nested blocks
Hello,
Does anyone have an explanation for why the following code results in
the error that follows? I also would value any criticisms of my
approach (i.e., defining it_should_populate_collections). Thanks
-Chris
#Code
def it_should_populate_collections(condition=nil)
it "should populate any necessary collections #{condition}" do
[*@collections_to_populate].each do
2007 Jun 21
0
Testing a Rails plugin
...quot;#{RAILS_ROOT}/db/migrate")
require ''spec/rails''
Spec::Runner.configure do |config|
config.use_transactional_fixtures = true
config.use_instantiated_fixtures = false
config.fixture_path = File.dirname(__FILE__) + "/fixtures/"
config.before(:each, :behaviour_type => :controller) do
raise_controller_errors
end
end
--------------
It all seems to be working, but I haven''t kicked the tires to hard yet.
Just thought I''d run this setup by you for comments.
Tom
2008 Mar 14
2
Lib Specs and config.use_transactional_fixtures = true
Hi
We have specs in our rails project other than model/view/controller ..
we have interests and lib ...
using use_transactional_fixtures = true seems fine in a spec in the m/
v/c and interests directories but not in lib
Just wondered if anyone had any quick thoughts as to why that may be???
Shane Mingins
ELC Technologies (TM)
1921 State Street
Santa Barbara, CA 93101
Phone: +64 4 568
2007 May 23
8
Rails Rendering diagnostics.rhtml in Controller Spec
Forgive me if this isn''t the proper list. It''s specific to the rSpec
Rails plugin.
The problem is, some controller actions are rendering the
"diagnostics.rhtml" template when I''m expecting it to render something
else in a controller spec. I''m assuming this is the template that
displays the error message and a stack trace when an error is raised
in the
2007 May 31
28
Another attempt for a succinct model validation DSL
On 5/28/07, David Chelimsky <dchelimsky at gmail.com> wrote:
> The behaviour you''re trying to describe is that the User should
> require that passwords bear certain qualities - in this case a length
> between 5 and 40. So you need to ask yourself how the User should
> behave when this requirement is violated, and then specify that it
> behaves that way.
>
>