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
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 =
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
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
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
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
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) }
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
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:
>
&
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
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
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
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"
>
&
:
> 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
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 #
_
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
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
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=>"
18 matches
Mail list logo