[rspec-users] running rspec causes errror => no such file to load -- rspec/rails

2011-10-13 Thread slavix
strange install related problems in my rails 3.1 app gemfile group :test, :development do .. gem "rspec" gem "rspec-rails" gem 'rspec-rails-ext' gem 'rspec-rails-matchers' .. end >>bundle show rspec-rails /home/slava/.rvm/gems/ruby-1.9.2-p290/gems/rspec-rails-1.3.2 >>rails generate rspec

[rspec-users] rspec and should have_many through

2011-09-13 Thread slavix
Hi, Anyone can help me with rspec shoulda validations please. I can't get the syntax right for these validations. Please correct me it { should have_one :tradable, :through => :trade_order} it { should belong_to :source, :polymorphic => true } it { should have_many :transfers, :as =

[rspec-users] rspec testing inheritance

2011-09-06 Thread slavix
Hello, Is there any way to test model inheritance in spec? something like.. it { ChildModel.should < ParentModel } thanks. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] rspec and should eql

2011-09-05 Thread slavix
Here is another example that is failing due to same problem.. class Currency < ActiveRecord::Base end class Bitcoin < Currency include ActiveRecord::Singleton default_scope where(:char_code => 'BTC') end spec: describe Bitcoin do .. Bitcoin.instance.char_code.should eql('BTC') .. end err

Re: [rspec-users] rspec and should eql

2011-09-05 Thread slavix
thanks. tried both with same result. btw documentation says to use eql 5.should eql(5) http://rspec.rubyforge.org/rspec/1.1.9/classes/Spec/Matchers.html#M000429 On Sep 5, 7:08 pm, Nick wrote: > Try "eq" or "equal". ___ rspec-users mailing list rspe

[rspec-users] rspec and should eql

2011-09-05 Thread slavix
Having troubles with rspec and should eql.. in a rails 3.1 app spec has this User.first.name.should eql('admin') get this error .rvm/gems/ruby-1.9.2-p290/gems/remarkable-4.0.0.alpha4/lib/remarkable/ core/macros.rb:15:in `method_missing': undefined method `eql' for # (NoMethodError) btw, I am

[rspec-users] undefined method `dependent' - rspec and shoulda

2011-09-04 Thread slavix
hello, Getting this error when using shoulda and rspec for model tests. my gemfile ... gem "shoulda-matchers" .. spec file .. it { should have_many(:balances).dependent(:destroy) } error: User shoulda validations Failure/Error: it { should have_many(:balances).dependent(:destroy) }

[rspec-users] should validate_numericality_of with greater_than_or_equal_to

2011-09-03 Thread slavix
Hello, I have this in my spec it { should validate_numericality_of(:amount).greater_than_or_equal_to(0) } but I get error: Failure/Error: it { should validate_numericality_of(:amount).greater_than_or_equal_to(0) } NoMethodError: undefined method `greater_than_or_equal_to' for # t

Re: [rspec-users] rspec assert inclusion in..

2011-09-03 Thread slavix
Thanks. I wanted to test it as part of model validation like it { should validate_presence_of(:some_attribute).among(['value1', 'value2']) } it { should validate_that(:some_attribute) >= 0 } On Sep 3, 6:42 pm, Nick wrote: > Hey Slavix. How about this: > &

Re: [rspec-users] rspec assert inclusion in..

2011-09-03 Thread slavix
this seems to be the way to do it. it { should_validate_numericality_of :amount, :greater_than_or_equal_to => 0 } it { should_validate_inclusion_of :gender, :in => %w( m f ) On Sep 3, 6:42 pm, Nick wrote: > Hey Slavix. How about this: > > it 'has a valid &qu

Re: [rspec-users] rspec and shoulda have_indices

2011-09-03 Thread slavix
fields.  Try specifying them individually and not in an array. > > > > > > > > > > On Fri, Sep 2, 2011 at 7:07 PM, slavix wrote: > > now getting > > Failure/Error: it { should > > have_db_index([:user, :currency, :tradable]) } > >       Expected B

[rspec-users] rspec assert inclusion in..

2011-09-03 Thread slavix
hello, I would like to assert that an attribute of a model has value among those in an array. How would I do it in rspec? Something like this... describe OptionType do context "shoulda validations" do it { assert_contains :type, ['Type1', 'Type1']} end end

Re: [rspec-users] rspec and shoulda have_indices

2011-09-02 Thread slavix
On Sep 2, 6:17 am, David Chelimsky wrote: > On Sep 2, 2011, at 4:12 AM, slavix wrote: > > > Hello, > > I am developing a rails 3.1 app. My Gemfile has shoulda gems > > Gemfile > > .. > > gem "shoulda" > > gem "shoulda-matchers" > &

Re: [rspec-users] rspec and shoulda have_indices

2011-09-02 Thread slavix
: > On Sep 2, 2011, at 4:12 AM, slavix wrote: > > > Hello, > > I am developing a rails 3.1 app. My Gemfile has shoulda gems > > Gemfile > > .. > > gem "shoulda" > > gem "shoulda-matchers" > > You only need shoulda-matchers if yo

[rspec-users] rspec and shoulda have_indices

2011-09-02 Thread slavix
Hello, I am developing a rails 3.1 app. My Gemfile has shoulda gems Gemfile .. gem "shoulda" gem "shoulda-matchers" In a model spec I have spec file it { should have_indices([:user, :currency]) } And I get this error... NoMethodError: undefined method `has_indices?' for # _

Re: [rspec-users] troubles running rspec..

2011-08-28 Thread slavix
never mind. I didn't run rails generate rspec:install On Aug 28, 12:03 am, slavix wrote: > developing a 3.1 app. trying to run spec on and get this error: > >  bundle exec rake spec > * > DEPRECATION WARN

[rspec-users] troubles running rspec..

2011-08-28 Thread slavix
developing a 3.1 app. trying to run spec on and get this error: bundle exec rake spec * DEPRECATION WARNING: you are using a deprecated constant that will be removed from a future version of RSpec. /home/slava/.rvm/gems/ruby-1.9.2-p

[rspec-users] routing error for a name-spaced nested controller

2011-02-07 Thread slavix
Struggling with nested routing and rspec... When I run spec/controllers/admin/website_users_controller_spec.rb describe Admin::WebsiteUsersController do ... get :index, :website => @website at this line I get: ActionController::RoutingError Exception: No route matches {:website=>#, :controller=>"