attempting to use rspec2, rails3, and autotest. When running autotest I get stuck with the following:
loading autotest/rails_rspec2
style: RailsRspec2
--------------------------------------------------------------------------------
...
...bin/rspec:2:in `require': no such file to load -- rspec/autorun (LoadError)
Looks like a path ...
I'm posting this because it took me forever to find the answer, because the search terms didn't match what I expected. Just trying to help out the next guy:
spec has been renamed to rspec
Credit: http://stackoverflow.com/users/377631/jasonpgignac for supplying the answer in another thread.
...
I mostly followed these instructions to get things spun up:
http://lindsaar.net/2010/5/9/Getting-Rails-3-Edge-with-jQuery-RSpec-and-Cucumber-using-RVM
If I create a completely blank .feature file, running cucumber results in this error:
cucumber
wrong number of arguments (3 for 1)
(ArgumentError)
/gems/gherkin-2.0.2/lib/ghe...
I've recently just added Devise to my first Rails3 app, and I'm having a bit of trouble with the controller tests.
I'm testing the User controller class, which is the same model that Devise uses. So at the beginning of my spec I have this:
before(:each) do
sign_in @user = Factory.create(:user)
end
Now I can get the test passing wit...
How would you stub Devise in Rails 3 with rSpec. I have a UsersController and a User model. Both of which are associated with Devise at the moment, I'm writing controller specs and I really am having a hard time with my expectations as the Devise sign_in is really jamming up the works.
Any thing will help.
...
Hi there,
I am currently writing a rails app using bleeding edge stuff. Rails3, rSpec2, Ruby 1.9.2 and Geokit 1.5.0. When i try to geocode addresses that have special characters that are not in ASCII-8Bit i get this error:
incompatible character encodings:
UTF-8 and ASCII-8BIT
The Trace is like this:
1) Spot Basic Validations s...
http://gist.github.com/535643#comments
this code doesn't work because rspec2 is creating some singleton that is creating some exception in dump. The error is on commments.
...
Hi there,
i am trying to write a view_spec for my login form that uses authlogic. This is my current view_spec:
require 'spec_helper'
describe "user_sessions/new.html.haml" do
before :each do
user_session = mock("UserSession").as_null_object
assign(:user_session, user_session)
end
it "should have a login form" do
re...
Inside of : features/support/env.rb
require 'cucumber/rspec/doubles'
I just ported my project to a new cpu and it's returning this error on everything:
undefined local variable or method `_setup_mocks'
I'm guessing I'm missing something.
Gems :
rspec (2.0.0.beta.18)
rspec-core (2.0.0.beta.18)
rspec-expectations (2.0.0.beta.18)
rs...
NetBeans 6.9 provides a custom Runner class for RSpec to be integrated into the IDE. I'm trying to get my Rails 3 applications specs to be correctly displayed inside NetBeans, but RSpec 2 seems no longer to support custom Runner classes in general.
Any ideas how to get the specs into the IDE anyway?
...
I have a Rails 3 app that uses RSpec2 as my testing framework, and I'm able to use autotest to watch my model and spec directories for changes and re-run my spec suite when files change.
I'd like to add a directory with some custom classes in it (RAILS_ROOT/lib/some_project/lib/*.rb) and their corresponding specs (RAILS_ROOT/spec/some_p...
def mock_category(stubs={})
@mock_category ||= mock_model(Category, stubs).as_null_object
end
describe "GET show" do
it "assigns the requested category as @category" do
Category.stub(:find).with("37") { mock_category }
get :show, :id => "37"
assigns(:category).should be(mock_category)
end
end
Which returns :
1) Cate...
Trying to reinstall RSpec, and I can't seem to re-add its command to my bin folder.
Mac-Users-MacBook-Pro:bin macuser$ rspec
-bash: /usr/bin/rspec: No such file or directory
>> which rspec
#> returns nothing.
I tried sudo gem install rspec --prerelease a dozen times, bundle install , and nothing seems to give.
What am I missing?
...
I have been attempting to dive into RSpec 2 but its auto generated controller specs do not work for any version of RSpec 2 with any version of Ruby or any version of Rails. Maybe I'm missing something obvious?
def mock_category(stubs={})
@mock_category ||= mock_model(Category, stubs).as_null_object
end
describe "GET show" do
it "as...
Is it possible to completely remove rspec from a project, and then reinstall it again?
The reason I ask is because I had started my project on Rails 3 beta, and now that the new one has come out, the new rspec conflicts and nothing passes. But if I start a new project, everything seems to work as expected.
...
User.should_receive(:update_attributes).with({'these' => 'params'})
What does that statement mean? these isn't instantiated anywhere as meaning anything.
The whole statement is this :
describe "with valid params" do
it "updates the requested user" do
User.should_receive(:find).with("37") { mock_user }
User.should_re...
I'm writing an rspec scenario thats failing with:
(#<User:0x1056904f0>).update_attributes(#<RSpec::Mocks::ArgumentMatchers::AnyArgMatcher:0x105623648>)
expected: 1 time
received: 0 times
users_controller_spec.rb:
describe "Authenticated examples" do
before(:each) do
activate_authlogic
@user = Factory.create(:vali...
This is a pure syntactical question. I'm very new to RSpec.
I basically want to write something on the lines of this erroring line :
controller.stub!(:current_user(:update_attributes => false))
Anyone know how to properly write that?
RSpec's default looks like this :
User.stub(:find) { mock_user(:update_attributes => false) }
...
I am trying to mock out the session hash for a controller like so:
it "finds using the session[:company_id]" do
session.should_receive(:[]).with(:company_id).and_return 100
Company.should_receive(:find).with(100)
get 'show'
end
When I call get 'show' it states:
received :[] with unexpected arguments
expected: (:company_id)
...
Hey Guys!
I am trying out rails3. I am using railstutorial
site to explore more about rails3; the tutorial is very good to begin with (I have minimal experience with rails2).
I have an issue with rspec which is currently blocking my progress. I saw that the tutorial recommended using rspec2.0.0.beta.18 gem; I instead installed rspec2.0...