I've upgraded my app from using config.gem to a Gemfile with bundler and have noticed that my unit tests have now stopped running. It's a bit strange and I'm not entirely sure where to start looking.
When I run rake test:units --trace I can see my environment being setup and it lists the files it intends to execute, but then it just re...
I'm migrating over to shoulda from rspec and I can't seem to get access to the http response. Can someone point out what I may be doing wrong?
context "doing somethin" do
setup do
get :index
end
@response.body
should respond_with :success
end
When i run this i get an error saying that @response is a...
Hello,
I have this kind of relation:
class Article < ActiveRecord::Base
has_many :comments
end
class Comment < ActiveRecord::Base
belongs_to :article
attr_protected :article_id
end
The default scenario inside controllers looks like:
@article = Article.create(:title => "foobar")
@comment = @article.comments.create(:content => ...
I'm trying to upgrade my rails application to Rails3.
When I run functional tests, I get a lot of NameError: uninitialized constant Test::Unit::AssertionFailedError errors. But unit tests and website itself seems to work fine.
Trace looks like this:
NameError: uninitialized constant Test::Unit::AssertionFailedError
/Users/mantas/.rvm/...
I'm trying out 'shoulda' on top of rspec (rails 3) with the following spec:
require 'spec_helper'
describe Article do
should "be true" do
assert true
end
end
and it fails with
/Users/jeppe/.rvm/gems/ruby-1.8.7-p302/gems/rspec-expectations-2.0.0.beta.20/lib/rspec/expectations/handler.rb:11:in `handle_matcher': undefined method...
I have following models in my app:
class Game < ActiveRecord::Base
has_many :players
has_many :villages, :through => :players
end
class Village < ActiveRecord::Base
belongs_to :player
end
class Player < ActiveRecord::Base
belongs_to :game
has_many :villages
before_create :build_starting_village
protected
def...
I have one spec:
require 'spec_helper'
# hmm... I need to include it here because if I include it inside describe block `method_missing` exception raises.
include Shoulda::ActionController::Matchers
describe CategoriesController do
include Devise::TestHelpers
render_views
context "new should render template :new" do
setup ...
Hi
I'm using Rails3 with rspec and shoulda. I have the below spec
describe PagesController, "on GET to show while logged off" do
before(:each) do
@site = Factory.create(:site)
@site.domains << Factory.create(:domain)
@site.save!
@site.pages << Factory.create(:page)
@site.menus << Factory.create(:menu, {:site=>@si...
I'm having an awful time trying to understand what my validation method is having trouble with.
I installed shoulda and when I tried to use it it errors out with a strange undefined method NoMethodError: undefined method '[]' for false:FalseClass which is very odd.
I narrowed it down to this piece of offending code:
validates_each :na...
While writing functional tests for a controller, I came across a scenario where I have a before_filter requesting some information from the database that one of my tests requires. I'm using Factory_girl to generate test data but I want to avoid hitting the database when its not explicitly needed. I'd also like to avoid testing my before_...
I'm using Shoulda, Mocha, and Test::Unit for testing. I have the following controller and test:
class FoosController < ApplicationController
caches_action :show
def show
@foo = requested_foo
end
private
def requested_foo
Foo.find(params[:id])
end
end
class FoosCachingTest < ActionController::IntegrationTest
def s...
Hi all,
when I run rspec spec/models result is OK.
But when I use spork, every test where shoulda macros (like it { should validate_presence_of(:title) } is used FAILS with error like: undefined method 'validate_presence_of' for ...
I use:
rails (3.0.0)
shoulda (2.11.3)
spork (0.8.4)
rspec-rails (>= 2.0.0.beta.22)
spec/spec_helper....
After using shoulda it is very clear that shoulda no longer uses macros (They are all deprecated for the preferred matchers) For example:
should_allow_custom_test
is deprecated for the following:
should allow_custom_test
However all the documentation I can find is for the former macro setup by placing them in the shoulda_macros dir...
I am attempting to get RCov to work with my RSpec and Shoulda test for a rails 3 app. It seems to work fine with my RSpec after using the Rake task below but all of the shoulda tests fail and I cant seem to find any documentation on getting these to work. They all run fine under autotest(rspec and shoulda).
namespace :spec do
desc "...