I just started using rspec. I have controllers that inherit from an admin
controller. If I modify them to inherit from applicationcontroller the
rspec test works. If I inherit from admincontroller i get "" back for a new
template. Is there something I am missing to get this to work? The pro
I have this in my admin controller:
before_filter :login_required
before_filter :admin_required
def admin_required
current_user.is_admin?
end
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/
No idea why this is not working:
describe "stub_model(Food) with a hash of stubs" do
let(:food) do
stub_model Food
end
it "edit action should render edit template" do
get :edit, :id => food
response.should render_template(:edit)
end
Says cannot find a
I am running rspec2 with a rails 3 app no autorun required.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
I keep getting "" returned when looking for a template:
describe "edit action" do
it "edit action should render edit template" do
Food.stub(:find_by_id).and_return(food)
response.should render_template(:edit)
end
end
__
It is already there.
On Tue, May 24, 2011 at 19:05, Justin Ko wrote:
>
>
> On Tue, May 24, 2011 at 2:25 PM, Chris Habgood wrote:
>
>> I keep getting "" returned when looking for a template:
>>
>> describe "edit action" do
>>
no.
On Tue, May 24, 2011 at 19:21, Justin Ko wrote:
>
>
> On Tue, May 24, 2011 at 6:10 PM, Chris Habgood wrote:
>
>> It is already there.
>>
>> On Tue, May 24, 2011 at 19:05, Justin Ko wrote:
>>
>>>
>>>
>>> On Tue, May 24
action should render edit template" do
#Food.stub(:find_by_id).and_return(food)
Food.any_instance.stubs(:valid?).returns(true)
response.should render_template(:edit)
end
end
On Tue, May 24, 2011 at 19:38, Chris Habgood wrote:
> no.
>
>
> On Tu
Never seen the error above before, code:
describe "edit action" do
it "edit action should render edit template" do
food = Food.create(:name=>'mooo') #
Food.any_instance.stubs(:valid?).returns(true)
get :edit, :id => food.id
response.should render_template(:edit)
find).with("1").and_return(@food)
>>
>> get :edit, :id => "1"
>>
>> assigns(:food).should be(@food)
>> end
>> end
>>
>> This is still very fast, and it has the added benefit that you can use
>>
s_controller_spec.rb:21:in `block (2 levels)
in '
On Tue, May 31, 2011 at 13:57, Chris Habgood wrote:
> The program works when I run it on the server.
>
> describe FoodsController do
> render_views
>
>before(:each) do
> Food.delete_all
> login_as_ad
quot;).and_return(@food)
puts @food
get :edit, :id => @food.id
assigns(:food).should be(@food)
end
end
end
On Tue, May 31, 2011 at 13:50, Ken Egervari wrote:
>
> On Tue, May 31, 2011 at 2:38 PM, Chris Habgood wrote:
>
>> Still g
Ya, that is not working. The code I gave you I was trying different things
out.
Rails 3.0
Rspec rspec (2.6.0.rc6)
On Tue, May 31, 2011 at 14:35, Ken Egervari wrote:
> Oh, don't forget the :id in the call to edit
>
>
> before(:each) do
> @food = Food.new
> @food.id = 1
> end
>
> d
yes
On Tue, May 31, 2011 at 15:33, Ken Egervari wrote:
> Dumb question, do you have required "spec_helper" at the top of the file?
>
> Ken
>
>
>
> On Tue, May 31, 2011 at 4:03 PM, Chris Habgood wrote:
>
>> Ya, that is not working. The code I gave
Try this in your spec helper file:
Dir[Rails.root.join("spec/factories/**/*.rb")].each {|f| require f}
On Wed, Jun 1, 2011 at 09:14, Jarmo Pertman wrote:
> Hi!
>
> When having a file structure like this:
> project
> -spec
>-subdir
> -my_spec.rb
>
> and then being in directory "project
I have a rails 3.1 app. I am using mongo_mapper, but when I run rake rspec
it says:
Mongoid is not installed (gem install mongoid)
Any idea where this could be coming from.
I am using:
gem 'machinist', '>= 2.0.0.beta2'
gem 'machinist2_mongomapper', :require => "machinist_mongomapper"
gem
I am using guard to detect changes and run rspec automatically. It doe snot
seem to see my changes in a model when guard is run. When I run "rake spec"
from the cli rspec runs fine. Does anyone know why this might be happening?
___
rspec-users mailin
Yes I needed to run the guard with bundle exec.
On Thu, Sep 1, 2011 at 09:58, Tim Gremore wrote:
> Have you added any of the available Guards (guard-rails) to your project?
> https://github.com/guard/guard/wiki/List-of-available-Guards
>
> On Sun, Aug 28, 2011 at 9:36 PM, Chris Ha
I have a basic user class and doing rspec validations. When I do a factory
create to produce validations it blows up before I can get to the second
line to check for errors. Ideas how to get this to perform like AR
Validations?
MongoMapper::DocumentNotValid:
Validation failed: Password
Sorry, it fails validation which it should but it errors out in the cli as
opposed to going along and checking, it does not get past the inital factory
new line:
Failure/Error: user = Factory(:user, :email=> '', :password => '')
MongoMapper::DocumentNotValid:
Validation failed: Passwo
MongoMapper::DocumentNotValid:
Validation failed: Password can't be blank, Email can't be blank,
Password digest can't be blank
On Sun, Sep 4, 2011 at 19:06, Nick wrote:
> What does the backtrace say?
> ___
> rspec-users mailing list
> rspec-us
this group is for rspec
On Wed, Nov 16, 2011 at 11:34, Vin MR wrote:
> I'm new with Ruby and Cucumber. I've tried this simple test, but it
> didn't work for me
>
> Given
> When I enter ABC on keyboard
> Then ...
>
>
> And here is the ruby code
> When /^I enter "([^\"]*) on keyboard$/ do |i
This is an rspec mailing list.
On Wed, Dec 7, 2011 at 12:48, Alex Whiteland wrote:
> hmm...
>
> I changed 2 servers to friend with google. wtf?
>
> first - 37.com,
> second - hushmail.com
>
> Maybe, google think it is spam and sends to it folder. Can yo find my
> letters in it?
>
> --
> Posted v
Are you really sure you need a polymorphic table?
On Thu, Mar 22, 2012 at 12:27, Fearless Fool wrote:
> The basic question: how do you mock a reference to a polymorphic class
> in RSpec? Trying the obvious thing leads to an error of the form:
>
> undefined method `base_class' for Post:Class
>
24 matches
Mail list logo