Displaying 20 results from an estimated 283 matches for "spec_help".
Did you mean:
spec_helper
2012 Jun 03
3
rspec spec_helper
Hi,
I was playing with rspec and every time I find a possible improvement
that could be made in spec_helper or rakefile I have to change it in
every module that is using rspec tests. So maybe these things could be
centralized, I thought to myself.
I found the following module, actually.
https://github.com/puppetlabs/puppetlabs-module_spec_helper
But I am at a lost how to use it.
Is it supposed to pr...
2012 Sep 27
3
load global variable so I can access in spec files
In my spec_helper, I want to load yaml file to a variable, and then be able
to use that in my tests.
spec_helper.rb:
RSpec.configure do |config|
end
config = YAML::Load(......)
some_spec.rb
describe ''blah'' do
it "should be...." do
MyClass.new( config[''test'...
2007 Nov 22
0
changes to spec_helper in trunk r2952
If you''re keeping up to date with trunk, don''t forget to run
script/generate rspec. Revision 2952 includes a small change to
spec/spec_helper.rb.
Cheers,
David
2007 Mar 09
0
Mocks & Stubs in spec_helper?
I have to stub out
setup do
request.stub!(:user_agent).and_return(''Mozilla'')
end
in each context because my Rails application.rb relies on it (for IE
reasons).
Is there a way to create mocks or stubs in spec_helper.rb so I don''t
have to repeat this?
Thanks,
Steve
2007 May 02
13
RSpec 0.8.2 pain, missing spec/rails?
...ading a project from an 0.8.0 pre-release gem to 0.8.2.
I''ve installed the 0.8.2 gem, and the rspec_on_rails 0.8.2 plugin:
ruby script/plugin install
svn://rubyforge.org/var/svn/rspec/tags/REL_0_8_2/rspec
When I try to run my specs though, I get the below error. It''s as if the
spec_helper cannot find "spec/rails". I''ve noticed that "spec/rails" is
part of the rspec plugin, but I''m using the gem and cannot find
spec/rails.rb (it''s required in spec_helper.rb). I''m stuck and banging
my head against the walls. Things fall out....
2007 Apr 30
7
Migrating spec_helper with modifications
Hello,
After moving into the HEAD of rspec, I am greeted with a mountain of errors,
which I expected, due to my specs not being migrated.
I use hpricot for a lot of my view tests, as it is extremely simple to
traverse the DOM with it. I used to include HpricotSpecHelper in
spec_helper.rb, like so:
require ''hpricot_spec_helper''
module Spec
module Rails
module Runner
class EvalContext < Test::Unit::TestCase
include HpricotSpecHelper
end
end
end
end
However, I am now getting errors that indicate that this inclusion no longer...
2009 Oct 22
4
spec failing to run specs when spec.opts is present on 1.2.9
...spec/spec.opts
$ spec spec/models/topic_spec.rb
*
Pending:
Topic should have specs (Not Yet Implemented)
./spec/models/topic_spec.rb:6
Finished in 0.048676 seconds
1 example, 0 failures, 1 pending
$
Outside of the old merb app, I wasn''t able to duplicate this issue. I
also copied the spec_helper from a newly created merb app (1.0.12)
into the old app, but the issue persisted. Perhaps a library conflict
might be to blame?
I also encoutered an even stranger issue where a single example
resulted in multiple failures i.e. a spec containing 4 examples
produced the following output
3 examples...
2007 Dec 17
14
Change in isolation behaviour 1.08 - 1.10 ?
Hi,
I just moved from 1.08 to 1.10 and now have one example failing, which,
under 1.08, passed. Is the due to a change in behaviour?
Here''s my spec (removed some passing examples)
require File.dirname(__FILE__) + ''/../spec_helper''
describe "A user" do
before(:each) do
@user = User.new
@valid_user = User.new(
:email => ''bert.valid at lostboys.nl'',
:fname => ''bert'',
:lname => ''valid'',
:jobtitle =>...
2007 Mar 02
2
database modifications not rolling back
...fter all tests have finished the test database is populated entirely
with all the records I have created, whereas on 0.7.5.1 I''d find this
database completely empty on completion.
FYI - I''m using Rspec 0.8.2 with matching revision of rspec_on_rails,
Rails 1.2.2 and Mysql.
spec_helper.rb
module CompetitionSpecHelper
def new_competition
code_to_create_a_new_competition
return the competition
end
end
competition_spec.rb
require File.dirname(__FILE__) + ''/../spec_helper''
context "Given a visible competition" do
include Competi...
2007 Aug 31
3
Setting use_transactional_fixtures=false for a single spec - a bad idea?
Hi!
I would really like to find a way to allow me to write RSpec
specifications for code that use database transactions. I know I can set
config.use_transactional_fixtures = false
in my spec_helper.rb. That works, and that''s great, but it will (I
think) slow down my specs quite a bit. I would like to turn off
transactional fixtures for just a single spec (describe), or even
better, just a single example (it). I tried this:
before(:all) do
Spec::Runner.configure do |c...
2007 Nov 23
3
Creation of spec.opts spec_helper etc
When do these files, along with lib/spec and lib/spec_server get
created?
I tried to create a quick test project and can''t remember how they were
created in a previous project.
Thanks
--
Posted via http://www.ruby-forum.com/.
2007 Oct 24
1
Alternate File "require" line in TextMate bundle
Ok, this is INCREDIBLY finicky of me, and I''m a really finicky person
at the best of times, but I noticed that when you use the TM
Alternate File command to create specs, it does it with a header line
like this:
File.dirname(__FILE__) + ''/../../../spec_helper''
I use a header line like this
require File.expand_path(File.join(File.dirname(__FILE__), *%w
[.. .. .. spec_helper.rb]))
(Think I nicked it from some of David''s code)
Does the former expose you to loading the spec_helper twice under any
circumstances? Just wondered,...
2007 May 24
15
Specs for code stored in rails_app/lib/
Where should the specs go for code in the "lib" directory of a Rails
app?
I made a folder, "spec/lib/", for storing such specs, and RSpec
automatically picks them up when run using "rake spec".
Before I go ahead and patch rspec_on_rails/lib/autotest/
rails_rspec.rb so that autotest can monitor these specs I''d like to
ask whether this is the
2008 Jun 03
5
Autotest/RSpec 1.1.4/Rails 2.1 Infinite Loop?
I just got back from RailsConf, and upgraded on of my development apps
to 2.1, and now autotest is going into an infinite loop. It runs tests
continuously instead of waiting for files to be saved before rerunning.
Has anybody else seen this, or know how to get around it?
Thanks,
Andrew
2007 Jul 09
12
Mocking User.find( :all, :limit => 10 )
Hi,
I''m trying to setup a mock for my controller test but I can''t get it to
recognise the mock.
I use
it "should find all users" do
User.should_receive(:find).with( :all, :limit => 10
).and_return([@user])
do_get
end
and in the controller
@users = User.find(:all, :limit => 10 )
But this does not work. It gives me
User expected :find with (:all)
2013 Jun 18
1
Getting rspec error: Net::SMTPServerBusy: Relay access denied
I''m trying to test registration emails (sent with devise), and I keep
getting the error:
Net::SMTPServerBusy: 454 4.7.1 <model_spec-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org>: Relay access denied
I''m running Rails 3.2.11 with Capybara, and I have (temporarily) chopped my
spec_helper.rb and test.rb files down to the bare minimum, still getting
the error above.
spec_helper.rb:
require ''rubygems''
require ''spork''
Spork.prefork do
ENV["RAILS_ENV"] ||= ''test''
require File.expand_path("../../config/environmen...
2007 Apr 25
9
Running specs for a plugin - undefined method ''define'' for object
...s/rspec)
- edge rspec_on_rails (in vendor/plugins/rspec_on_rails)
- I ran script/generate rspec
- plugin created with rspec_plugin (using script/generate rspec_plugin
audit_fu)
File contents of: vendor/plugins/audit_fu/spec/audit_fu_spec.rb
require File.dirname(__FILE__) + ''/spec_helper''
define "Widget" do
fixtures :widgets
it "should find all records" do
Widget.count.should==4
end
end
File contents of: vendor/plugins/audit_fu/spec/spec_helper.rb
require File.dirname(__FILE__) + ''/../../../../spec/spec_helper''
plugin_spe...
2009 Mar 15
7
How to use different mocking frameworks?
...ope someone can help me out with this.
I''m leveraging a couple pre-existing applications in my current
project, both have fairly robust test suites in Rspec already.
However, one is using Rspec''s builit in mocking, and the other is
using mocha.
If I set config.mock_with mocha in spec_helper.rb, then all of the
rspec mocks fail. If I comment this out, all of the specs with mocha
fail.
Is there some way to set the mocking framework on a test and/or file
basis? I''ve been all over Google, and can''t seem to find a resolution
to this. I really don''t want to...
2012 Nov 18
3
remarkable activerecord association RSpec
i''m using gem Remarkable activerecord for association. i''ve installed
remarkable and remarkable activerecrod both gem. i''ve added both gem in
my Gemfile. i''ve added "remarkable_activerecord" as required in
spec_helper.rb.
describe Authentication do
FactoryGirl.build(:authentication).should
belong_to(:user)
end
it "has a valid factory" do
FactoryGirl.create(:authentication).should
validate_presence_of(:uid)
end
i got err...
2007 Sep 13
5
Authenticating before tests
Hi all,
I''m using Goldberg, an engine that provides roles based access
control for my app. I need to login before I can do controller tests,
but I can''t find any examples of people doing this.
Could someone point me in the right direction?
I thought the simplest way would be to either call the login action
from my other tests before(:all), but I can''t seem to