similar to: minitest validations - is there a cleaner way?

Displaying 20 results from an estimated 800 matches similar to: "minitest validations - is there a cleaner way?"

2011 Mar 23
0
Passing NilClass To Create & MiniTest Backtrace Cleaner
Morning All! Some things I noticed while playing with 3.1 master last night. 1) When using the #create! method on an association and pass "nil" vs an empty hash, now fails silently with no warning or anything. It''s almost like a no-op. I did not test to see if this behavior occurred on a basic model or not. My app''s controller was setup in such a way that I would
2011 Oct 19
1
Rails 3.1 and minitest
I''m looking for a simple way to integrate minitest/spec with Rails 3.1. Anybody have it working? There''s an older article on MetaSkills about this but it adds stuff I don''t want. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2013 Jun 09
2
Minitest mock or stub methods
Hi I''m building a small library to use in my Rails app which interacts with a 3rd party API. It fetches artists and tracks. So I have: lib/my_lib.rb lib/my_lib/artist.rb lib/my_lib/track.rb To get an artist I do artist = MyLib::Artist.find("Oasis") Which returns an instance of Artist if it finds (via 3rd party API) it or nil otherwise. Then I can call artist.tracks which
2009 Apr 22
15
Why RSpec?
I like Shoulda. Sometimes I like plain old Test::Unit. Cucumber gives me a different thought process. I''d just like to hear some thoughts on why RSpec? What does it buy me that I can''t get with Shoulda? I just can''t seem to think in RSpec. Where is there a good example of RSpec tests that will help me grasp the right path? Thanks! -- Amos King
2011 Jul 28
2
RSpec, shoulda-matchers and Rails model attributes validations
I was trying out RSpec framework in a project and got stopped doing the unit test of a model. In particular, doing the test for the associations and the ActiveRecord validations. I started writing the validations but my tests didn''t look DRY at all. Before refactoring the tests checked out and look for other people solutions. I found out shoulda-matchers and Shoulda (which if I
2016 Jun 07
0
[PATCH 2/2] ruby: tests: Give each test class and method a unique name.
'tc_410_close_event.rb' was not being run. You could prove this by simply inserting "exit 1" into that test. The reason is unclear, but by renaming every class and method in the tests to be unique, this ensures the tests are run. --- ruby/t/tc_010_load.rb | 4 ++-- ruby/t/tc_020_create.rb | 4 ++-- ruby/t/tc_030_create_flags.rb | 4 ++--
2010 Mar 10
1
ifelse logic and multiple assignments
I'm a fairly new R user and while I have a solution to my problem I'm wondering if there is a better one. In SAS it's common to use if/then logic along with a "do" statement to make several things happen. While I could do the same thing in R using a "for" loop, and "if" and {}, I've read that loops are less common in R and I wonder if I'm doing
2011 Nov 05
2
Where is my gem file located so that i can rake test
Googling around, I found that apparently adding to the gem file will fix my problems, but where do i find the gem file? what is the name of the gem file? "group :test do # Pretty printed test output gem ''minitest'' ####### add this line ####### end" Here is what happens when i run rake test, please note that i have already installed minitest
2010 Aug 11
6
rspec2 not working with shoulda
I am using rails edge. I am using gem "rspec-rails", "= 2.0.0.beta. 19" . I have following code at spec/models/user_spec.rb require ''spec_helper'' describe User do it { should validate_presence_of(:email) } it { should validate_presence_of(:name) } end Here is my gemfile group :development, :test do gem ''factory_girl_rails'',
2010 Dec 22
8
Shoulda issue: no more "should have_instance_methods" ?
I''m using Shoulda. After copying the code here.... .... http://joshuaclayton.github.com/code/2009/07/14/should-act-as-list.html.... into my test_helper file so I can test acts_as_list, I came across issues. For one I realized I had to get rid of the _ between the "should" and "have" in past cases, but here, I get this error when I run my unit test:
2009 Jun 07
6
Missing Template when testing with the Brain Buster Captcha partial
When I run my functional tests, they throw an error with the following message: ActionView::TemplateError: Missing template /_captcha.erb in view path app/views:test/vendor/plugins/brain_buster/views/brain_busters On line #23 of app/views/contacts/_form.html.erb 20: <%= f.label :message %><br /> 21: <%= f.text_area :message %> 22:
2011 Mar 01
11
Did rails or shoulda go insane on the inflection of 'taxes'?
I have a model ''xp_jurisdiction_taxes'' which rails (3) created correctly. Another model ''xp_jurisdiction_states'' has many :xp_jurisdiction_taxes. In my spec I am using a shoulda helper to test the association but get the following error. BTW, greped the whole project just in case and the string ''taxi'' exists nowhere. 1)
2010 Jun 15
8
Allow blank on should validate_uniqueness_of
Hello, Using shoulda, any ideas how to allow blank when having this test: should validate_uniqueness_of(:email) Thanks. -- J. Pablo Fernández <pupeno-GAtDADarczzQT0dZR+AlfA@public.gmane.org> (http://pupeno.com) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2019 Jan 17
1
[hivex PATCH] ruby: improve test functions
Use better functions to check for proper values instead of assert: - refute_nil for non-null functions - assert_equal for checking equality Also, make sure that the parameters for assert_equal are correct: expected value, then got value. --- ruby/tests/tc_120_rlenvalue.rb | 4 ++-- ruby/tests/tc_130_special.rb | 12 ++++++------ ruby/tests/tc_200_write.rb | 4 ++--
2012 Oct 21
0
rails g problem
When I enter rails g, I get the bunch of logs behind. Any idea what I''m missing? I though it''s trying to install minitest, so I manually installed it. Still this error persists. $ rails g gem install minitest /Library/Ruby/Gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'': no such file to load -- minitest/unit
2016 Feb 23
0
[PATCH 2/2] ruby: tests: use more asserts instead of manual checks
Make more use of assert_equal/refute_equal instead of manually checking values and raising errors. --- ruby/t/tc_100_launch.rb | 4 +--- ruby/t/tc_410_close_event.rb | 8 ++------ ruby/t/tc_420_log_messages.rb | 4 +--- ruby/t/tc_810_rhbz664558c6.rb | 4 +--- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/ruby/t/tc_100_launch.rb b/ruby/t/tc_100_launch.rb index
2008 Jan 10
21
Shoulda
Hey, we''re currently using shoulda (http://dev.thoughtbot.com/ shoulda/) on a project and I saw some things that would be really nice to see in rspec, namely the should_ methods, and especially the should_be_restful method. Do these go against the rspec goals at all? Or could an ambitious programmer go to town implementing these for rspec_on_rails? Nathan Sutton fowlduck at
2011 Jun 30
2
How to play with shoulda with functional testing
Hi, I am new in rails testing, and now i try to use shoulda to test the functional section. can anyone give me some advice, example or recommend tutorial site to me.. thanks -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To
2009 Mar 03
1
shoulda tested better
We''ve made quite a few contributions in our facebooker fork (http://github.com/collectiveidea/facebooker ), but unfortunately, one thing some of our contributions have in common with many others is the lack of testing. I want to change that. I''d like to help lead an effort to make the facebooker tests better. One thing that I think would help is a little better
2011 Jun 30
8
Error of DEPRECATION WARNING
Hi, I Have a strange error when i type the command "rake db:migrate " Can you help to solve this error or give me some advices the error is: DEPRECATION WARNING: Rake tasks in /home/joanne/Desktop/picto/vendor/ plugins/prawnto/tasks/prawnto_tasks.rake are deprecated. Use lib/tasks instead. (called from <top (required)> at /home/joanne/Desktop/picto/ Rakefile:7) thanks for help