similar to: Trouble with rspec and FactoryGirl Sequence

Displaying 20 results from an estimated 2000 matches similar to: "Trouble with rspec and FactoryGirl Sequence"

2012 Nov 06
2
rspec failure upon revisit
I just returned from a different project after taking a few weeks off of my tutorial. I''m using Ruby on Rails 3 Tutorial - Learn Rails by Example by Michael Hartl. After rebooting my server I ran an rspec spec/ command to check to see if there were any problems and this is what I received. I didn''t modify anything except I did overwrite users_controller.rb and
2013 Jun 18
1
Getting rspec error: Net::SMTPServerBusy: Relay access denied
I''m trying to test registration emails (sent with devise), and I keep getting the error: Net::SMTPServerBusy: 454 4.7.1 <model_spec-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org>: Relay access denied I''m running Rails 3.2.11 with Capybara, and I have (temporarily) chopped my spec_helper.rb and test.rb files down to the bare minimum, still getting the error above.
2012 Nov 08
1
validates_uniqueness_of(*attr_names) w scope not working in unit test
Rails 3.2.8 Very strange , it works in dv mode console , but not in a unit test class User < ActiveRecord::Base belongs_to :subdomain validates_uniqueness_of :email, :scope => :subdomain_id class UserTest < ActiveSupport::TestCase def initialize_user @booboo = FactoryGirl.create(:subdomain, name: "booboo") @coocoo = FactoryGirl.create(:subdomain, name:
2012 Nov 18
3
remarkable activerecord association RSpec
i''m using gem Remarkable activerecord for association. i''ve installed remarkable and remarkable activerecrod both gem. i''ve added both gem in my Gemfile. i''ve added "remarkable_activerecord" as required in spec_helper.rb. describe Authentication do FactoryGirl.build(:authentication).should belong_to(:user)
2012 Nov 12
7
RSpec: controller POST create
Rails 3.1.3 rspec-rails (2.11.4) rspec 2.11.1 I am new to rspec. I don''t quite understand tests for POST create part. I have generated scaffold, and simultaneously it generated controller_spec.rb as well. it "assigns a newly created plan as @plan" do post :create, {:plan => valid_attributes}, valid_session assigns(:plan).should be_a(Plan)
2012 Jun 08
1
[Rails 3.2.5] Rails: unit test fixture_path : fixture_file_upload cannot find the file ...
I am trying to perform a test unit, using FactoryGirl include ActionDispatch::TestProcess FactoryGirl.define do factory :article do ....... photo { fixture_file_upload ''/files/test.jpg'', ''image/jpg'' } end end IN mt test_helper.rb I defined the fixture_path def fixture_path File.dirname(__FILE__) + "/fixtures/" #
2013 Aug 22
1
How do I deal with ActiveRecord::RecordInvalid: Validation failed:
Hello all, I am currently writing model tests in rails 4. I am attempting to add an error to a reservation object if the total number of reservations for a given date and time has reached a pre-determined limit. When my test runs, it is hitting the appropriate code but it is raising the following error as opposed to just giving me an error in the object that I can use.
2013 Feb 28
1
Validation Failed: Userkey has already been taken, Email has already been taken
Hi, I am using Factory girl with rspec and capybara for testing my rails appliction. I have the below code FactoryGirl.define do factory :user do |f| f.email "sss1 at gmail.com" f.userkey "12ssd345q62" end end When I run the test it is failing as "Validation Failed: Userkey has already been taken, Email has already been taken". What could be the reason for
2011 Jul 25
6
What does using a lambda in rspec tests accomplish?
Here is the code in question: describe UsersController do render_views … … describe "POST to ''create'' action" do describe "failure" do before(:each) do @attr = { :name => '''', :email => '''', :password => '''', :password_confirmation =>
2012 Nov 12
1
Factory girl associations and rspec
Hi, I am trying to test factory girl associations basically I have a user model and status model , what is supposed to happen is a user has many statuses and a status belongs to a user. I have tried to model this in factory girl as you can see in the files. When I try to execute the test I get Failure/Error: visit("/users/#{user.id}/statuses/#{status.id}")
2012 Jul 22
1
RSpec/rails & Capybara: #within
I''m new with Capybara and after a good amount of google, I still can''t figure out how the #within methods works! I can use it only if I call visit before? There''s no way to use it on a string, like the `page = Capybara.string(html_string)` trick? When describe a view, I want something like that: describe "path/to/view.html.erb" do it "should pass"
2013 Jan 09
2
Rails 3.2.10 and Rspec Tests that Fail?
The following tests used to reside in requests directory and used to work ... since I have upgraded to rails 3.2.9 and now 3.2.10 they fail. I have the following tests in(I am only showing the first two tests): spec/features/authentication_pages_spec.rb require ''spec_helper'' describe "Authentication" do subject { page }
2011 Jan 20
11
RSpec / Cucumber painfully slow Rails 3 OSX
I am working on my first Rails BDD project with extensive tests since starting out with Rails a few years ago. Running RSpec or Cucumber is really slow. I''m using Rails 3 and RSpec 2. To run one model spec with only 5 tests takes almost 1 minute! When it finishes it says it took only 0.9 seconds to run the actual test. So obviously it is loading the environment that takes so long. I just
2012 Mar 01
1
Testing selector order in RSpec
Could someone point me to a reference that explains how I would test the order of elements on an HTML page? For example, in RSpec I would like to verify that the content of one <p> element appears before the content of another. response.should have_selector("p", :content => "Should appear first") response.should have_selector("p", :content =>
2014 Jun 09
0
How can I test my controller via rspec for something other than response.should be_success?
1) Right now this is just testing a successful response. However, since I've gone and created a Post via FactoryGirl... how can I test the @post.id equals one of the id's being returned by the get: index json? describe Api::V1::PostsController do context 'Post' do before(:each) do @post = FactoryGirl.create(:post) end context '#index' do
2011 Jul 19
0
Ruby on Rails Tutorial Chapter 8 Signup Success
I have written the Users controller and Spec tests correctly for the "successful creation" in the User controller however I get the following two errors: 1) UsersController POST ''create'' success should create a user Failure/Error: lambda do count should have been changed by 1, but was changed by 0 #
2010 Oct 20
3
rspec error's when checking LayoutLinks from the railstutorials
I am following the rails tutorial: http://railstutorial.org/chapters/filling-in-the-layout#top Basically the test is something like: spec/requests/layout_links_spec.rb require ''spec_helper'' describe "LayoutLinks" do it "should have a Home page at ''/''" do get ''/'' response.should
2008 Apr 03
1
Anyone experienced RSpec/Autotest forgetting models?
Hi Saving a controller spec frequently gives me this error: 52) LoadError in ''UsersController GET /users with basic request params should find all the user types'' Expected /home/amoran/Documents/becta/apps/Backend/app/models/user_type.rb to define UserType ./spec/controllers/users_controller_spec.rb:299: script/spec:4: I have to Ctrl-C autotest before it will load again.
2012 Mar 16
0
Rails tests failing
http://dl.dropbox.com/u/15024055/CloudShot/shot_15032012_232654.png if i write the test like this its working just fine it passes green [code] it "should have the right title" do get ''view'' response.should have_selector(''title'', :content => "View Snippets") end [/code] but for
2011 Sep 07
6
FactoryGirl doesnt produce unique names?!
Hey, I got following very simple test case: require ''spec_helper'' describe Country do it "should create a new instance given valid attributes" do Factory(:country) end end Factory looks like: Factory.sequence :country_name do |n| "Country #{n}" end Factory.define :country do |c| c.name Factory.next(:country_name) c.nationality "Foo