rspec2

no such file to load -- rspec/autorun (LoadError)

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 ...

rspec 2 spec: command not found

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. ...

Rails 3, RSpec 2, and Cucumber yields wrong number of arguments (3 for 1) (ArgumentError)

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...

Testing two different expectations with mocking

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...

Stubbing Devise in rSpec and Rails3

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. ...

Geokit Gem 1.5 and Ruby 1.9.2 => "incompatible character encodings: UTF-8 and ASCII-8BIT"

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...

rspec2 should_receive is creating some singleton

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. ...

Writing view_spec for login form with authlogic (rspec2)

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...

Undefined local variable or method `_setup_mocks' in cucumber 0.8.5 and rspec2

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...

Rails 3 RSpec 2 NetBeans integration

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? ...

Adding custom directories (source and spec) to autotest in a Rails 3 project

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...

Anyone know why I'm getting this RSpec error? getting nil <--

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...

Accidentally uninstall rspec..

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? ...

Can someone describe to me what RSpec 2 is doing in this?

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...

How to completely remove Rspec and its generated files, and reinstall them into a project?

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. ...

What does this default RSpec statement mean?

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...

An RSpec2 error by the biggest newb in New Jersey :( | factory_girl, authlogic, rails3

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...

How do you stub a `current_user` with update_attributes set to false?

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) } ...

rpsec rails mocking session hash

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) ...

rails3 rspec issue

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...