similar to: simulating behavior without actually affecting database

Displaying 20 results from an estimated 20000 matches similar to: "simulating behavior without actually affecting database"

2010 Sep 01
1
Faking Paperclip has_attached_file with Factory girl?
Hello! I wonder if it''s possible to simulate Paperclip''s has_attached_file with Factory Girl and then test it with Rspec. I don''t get it to work. My factories.rb file looks like this: Factory.define :user do |user| user.name "Anders" user.email "user-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org" user.password
2013 Apr 03
2
strange behavior with active relation any? method
In console, I run the following and any? returns true: drivers = Driver.select("drivers.*, drivers.id").joins([:reports, :driving_habits]).where("extract(MONTH FROM reports.time) = ? AND extract(YEAR FROM reports.time) = ?", 3, 2013).uniq.order("drivers.id asc").page(2).per(1) drivers.any? => true This correctly evaluates to true because the relation contains one
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}")
2013 Mar 28
0
Can not determine issue in my factories with factory girl in rspec
Hi Folks, I hope you''re doing good. Sorry for a long email. I am just trying my best to learn something new and, need your help to understand/ sort a small issue which I am not able to figure out. I have create couple of factories and created some examples for rspec for one of my projects. I have got everything working on my local. Even, my specs are green on local for both ruby
2010 Aug 16
3
Load dummy data using Factory girl
Hello, I wanted to know how to load dummy data in the application using Factory girl. I had done this using Fixtures.I had made a fixtures folder into the test folder and run the command "rake test fixtures:load" Currently i tried using factories in the spec which is working fine. Wanted to know know regarding loading dummy data. -- Posted via http://www.ruby-forum.com/.
2012 Sep 08
4
dash symbol
In the example below, what is the dash doing between the class attribute and array: (field_helpers - [:label, :check_box, :radio_button, :fields_for, :hidden_field, :file_field]).each do |selector| -- 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
2008 Jul 25
0
discrete event simulation - "factory" with rework
Good morning, I wonder could somebody help me bridge the gap? I want to try and simulate a "factory" type environment with an object moving between stages of production with errors and re-work. The intent of this is to demonstrate the effect of error rates and re-work at various stages in the 'factory' on the total volumes of work at each stage of the factory - in order to
2012 Jan 01
4
Chronic parsing date range in console but not in application in rails 3
Hey all, Chronic will parse a date range in console: Chronic.parse(1/1/2011 - 1/1/2012, :guess => false) => 2012-01-01 12:00:00 -0500..2012-01-01 12:00:01 -0500 However, when I use logger to check if it''s parsing in application, it is not: logger.info "The value of history date is #{history_date}" => The value of history date is 1/1/2011 - 1/1/2012
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 22
1
rails3 tutorial: testing with factories
I''m having trouble understanding what the assigns() method does, as described at the following link: http://ruby.railstutorial.org/chapters/modeling-and-viewing-users-two#sec:better_user_views The User model has been ''rake db:test:prepare''ed, but I checked and no records were copied to the test db after doing that. Yet the description of assigns() says that the code:
2001 Mar 17
2
smbclient/mount question
This is driving me up the wall. I've had a basic samba server up for a couple of years and it was easy to do. Now with a second server I try to mount the same shares from the new linux box but I can get nothing to work. I would use NFS between the linux boxes but the support isn't compiled into my kernel, and I don't want to tackle that beast tonight... To test I tried the smbclient
2010 Aug 18
2
RSpec 2/Rails 3 - content_for in view specs
My main layout includes separate content_for/yield sections for my header, sidebar, footer, and content. However, when running a view spec, the `rendered` variable seems to only contain a string of just the primary content and ignores the header/footer/sidebar as well as the rest of my layout file (the "render" call just returns my primary content wrapped in generic <html> and
2012 Jan 21
4
why doesn't an instance of Object get Class's new instance method?
"Object is the root of Ruby''s class hierarchy. Its methods are available to all classes unless explicitly overridden." Wouldn''t Class class be at the root of the class hierarchy? After all, look at this: 1.9.2p290 :006 > Object.instance_of? Class => true Object is an instance of class, after all we can use one of Class'' instance methods on Object:
2011 Jan 17
4
Factory Girl and attr_accessor with validation
I have a problem with a recent change to one of my models when created via Factory.create. class User < ActiveRecord::Base attr_accessor :tc_check validates :tc_check, :presence => true, :acceptance => true ... end The following definition fails, when calling Factory.create(:valid_user) Factory.define :valid_user, :class => User do |u| u.email
2012 Oct 10
4
How do we get the End of Line date for the gems which we are using Ruby on Rails?
Hi All, I want to know the EOL date for the below gems for ROR. Can anyone help me how to find the EOL dates - authlogic - will paginate - oauth-plugin 0.3.14 - statistics 0.1.1 - YUI - cucumber 0.6.4 - cucumber-rails 0.3.0 - rspec 1.3.0 - rspec-rails 1.3.2 - webrat 0.7.0 - factory-girl 1.2.4 - database_cleaner 0.5.0 - SSL requirement - calender_select
2012 Nov 22
0
Simulating a VEC
Hello everyone, I have estimated a VEC using functions of package urca. Now I need to simulate several trajectories of the variables of the model based in the information of the model. To do that first I converted the VEC to a VAR using vec2var (from package vars) and then I converted de VAR to an ARMA using ARMA function of package dse. The idea is to use the function simulate (from package
2013 May 07
2
Net::HTTP
I''m looking at the documentation: http://ruby-doc.org/stdlib-2.0/libdoc/net/http/rdoc/Net/HTTP.html And I notice two uses of Net::HTTP. Both are using GET requests. But what''s the difference? When to use which? Net::HTTP.start(uri.host, uri.port) do |http| request = Net::HTTP::Get.new uri response = http.request request # Net::HTTPResponse object end uri =
2012 Feb 04
3
the ^ and % operators in context
The % is modulus (remainder) operator and ^ is bitwise. In this context, we take a file, and go through each character and encrypt it. But why are the ^ and % operators used here: def encrypt(reader, writer) key_index = 0 while not reader.eof? clear_char = reader.getc encrypted_char = clear_char ^ @key[key_index] writer.putc(encrypted_char) key_index = (key_index +
2011 Nov 18
1
What does :count actually mean in assert_select?
Hi guys, I tried reading up the RSPEC Book (Dec 2010) and googled a bit but I could not find anything. I''m using Rspec2. Example: spec/factories/categories.rb ====================== FactoryGirl.define do factory :category_intakes, :class => ''category'' do name ''intakes and filters'' description ''airfilters and
2013 Apr 27
3
where exactly are gems?
when you add a gem to the Gemfile and then run bundle install, where does the command look for the gem? If you had "gem ''rails'', :git => ''github.com/rails/rails.git", I assume it would update your system .rvm gems directory with the latest github commits. But what is the default repository that bundler looks for gems? -- You received this message because