Sha256: f8fb6a8a7ab8b244a86924c14a4912ee886e5dd5465b1dc2f28d873d1580c3bd
Contents?: true
Size: 1.91 KB
Versions: 1
Compression:
Stored size: 1.91 KB
Contents
# # Bug Report: # # # [#17249] String.random in a STI base class works, but doesn't work with inherited classes # Date: # 2008-01-20 14:01 Priority: # 3 # Submitted By: # andy watts (andywatts) Assigned To: # Nobody (None) # Category: # Console (script/console) State: # Open # Summary: # String.random in a STI base class works, but doesn't work with inherited classes # # Detailed description # # Love the plugin, but seem to have found a bug with the latest FixtureReplacemnt2. # # There appears to be a problem when a base STI class in example_data has a random string. # The derived STI classes do not get a fresh random string with each call. # # Eg. # Given the below example_data.rb, repeated new_user/create_user will work fine. # Each call creating a new object with a new random string. # # However the STI classes do not work as expected... # new_player/create_player will always return an object with the same random string # # # attributes_for :user do |u| # u.first_name = "First_name_" + String.random # u.email = "#{u.first_name}@aaa.com" # end # # attributes_for :player, :from => :user, :class => Player # # # Thanks # Andy # require File.dirname(__FILE__) + "/../../spec_helper" module FixtureReplacement describe "random_string" do before :each do @obj = use_module do attributes_for :user do |u| u.key = "foo" u.username = random_string(55) end attributes_for :player, :class => Player, :from => :user end end it "should have a different string for each instance in the base class" do user1 = @obj.create_user user2 = @obj.create_user user1.username.should_not == user2.username end it "should have a different string for each instance in the inherited class (with STI)" do player1 = @obj.create_player player2 = @obj.create_player player1.username.should_not == player2.username end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fixture_replacement-3.0.1 | spec/fixture_replacement/regressions/2008_01_21_random_string_with_sti_spec.rb |