fixture_replacement 3.0.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.rdoc +5 -0
- data/README.rdoc +2 -14
- data/VERSION +1 -1
- data/lib/fixture_replacement/attribute_builder.rb +5 -3
- data/lib/fixture_replacement/class_methods.rb +10 -2
- data/lib/fixture_replacement/version.rb +2 -2
- data/lib/fixture_replacement.rb +0 -1
- metadata +26 -109
- data/.gitignore +0 -2
- data/Rakefile +0 -8
- data/etc/bug_reports/2007_09_28_linoj.txt +0 -51
- data/etc/google_analytics +0 -6
- data/etc/patches/2007_09_14_default_model_name_with_arguments.diff +0 -26
- data/etc/patches/2007_10_14_active_record_specs.diff +0 -396
- data/etc/patches/2007_10_14_protected_attributes.diff +0 -26
- data/etc/patches/2007_10_14_send_patch.diff +0 -79
- data/etc/patches/2007_10_14_spelling_error_in_comments.diff +0 -13
- data/etc/patches/2007_10_17_protected_attributes_second_go.diff +0 -212
- data/etc/patches/2007_10_18_README.diff +0 -137
- data/etc/patches/2007_10_19_readme_tweak.diff +0 -12
- data/etc/patches/2007_10_19_silence_migration.diff +0 -12
- data/etc/patches/2007_10_25_changed_classify_to_camelize.diff +0 -38
- data/etc/patches/2007_11_20_fixture_replacement_generator_should_not_reload_environment_or_boot.patch +0 -13
- data/etc/patches/2007_11_20_string_random_refactor_and_extension.patch +0 -104
- data/etc/patches/2007_11_20_string_random_refactor_and_extension_v2.patch +0 -108
- data/fixture_replacement.gemspec +0 -126
- data/rake_tasks/code_quality.rb +0 -37
- data/rake_tasks/docs.rb +0 -59
- data/rake_tasks/gem.rb +0 -27
- data/rake_tasks/specs.rb +0 -7
- data/rake_tasks/tests.rb +0 -7
- data/rake_tasks/website.rb +0 -11
- data/spec/fixture_replacement/attribute_builder_spec.rb +0 -162
- data/spec/fixture_replacement/fixture_replacement_spec.rb +0 -96
- data/spec/fixture_replacement/fixtures/classes.rb +0 -78
- data/spec/fixture_replacement/fr_spec.rb +0 -7
- data/spec/fixture_replacement/integration/attr_protected_attributes_spec.rb +0 -71
- data/spec/fixture_replacement/integration/attributes_for_with_invalid_keys_spec.rb +0 -14
- data/spec/fixture_replacement/integration/attributes_from_spec_without_block.rb +0 -52
- data/spec/fixture_replacement/integration/create_method_spec.rb +0 -61
- data/spec/fixture_replacement/integration/cyclic_dependency_spec.rb +0 -32
- data/spec/fixture_replacement/integration/default_warnings_spec.rb +0 -29
- data/spec/fixture_replacement/integration/extend_spec.rb +0 -37
- data/spec/fixture_replacement/integration/has_and_belongs_to_many_spec.rb +0 -64
- data/spec/fixture_replacement/integration/new_method_spec.rb +0 -96
- data/spec/fixture_replacement/integration/private_methods_spec.rb +0 -43
- data/spec/fixture_replacement/integration/public_methods_spec.rb +0 -21
- data/spec/fixture_replacement/integration/valid_attributes_spec.rb +0 -41
- data/spec/fixture_replacement/integration/validation_spec.rb +0 -54
- data/spec/fixture_replacement/regressions/2008_01_21_random_string_with_sti_spec.rb +0 -71
- data/spec/fixture_replacement/version_spec.rb +0 -7
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -16
- data/spec/spec_helpers.rb +0 -117
- data/test/test_helper.rb +0 -21
- data/test/unit/user_test.rb +0 -57
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/spec/spec_helper.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/spec_helpers"
|
2
|
-
include SpecHelperFunctions
|
3
|
-
setup_database_connection
|
4
|
-
|
5
|
-
require File.dirname(__FILE__) + "/../lib/fixture_replacement"
|
6
|
-
require File.dirname(__FILE__) + "/fixture_replacement/fixtures/classes"
|
7
|
-
|
8
|
-
Spec::Runner.configure do |config|
|
9
|
-
config.prepend_before(:each) do
|
10
|
-
FixtureReplacement::AttributeBuilder.clear_out_instances!
|
11
|
-
end
|
12
|
-
|
13
|
-
config.prepend_after(:each) do
|
14
|
-
FixtureReplacement::AttributeBuilder.clear_out_instances!
|
15
|
-
end
|
16
|
-
end
|
data/spec/spec_helpers.rb
DELETED
@@ -1,117 +0,0 @@
|
|
1
|
-
module SpecHelperFunctions
|
2
|
-
def setup_database_connection
|
3
|
-
require 'rubygems'
|
4
|
-
require 'sqlite3'
|
5
|
-
require 'active_record'
|
6
|
-
|
7
|
-
ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:'
|
8
|
-
ActiveRecord::Migration.verbose = false
|
9
|
-
|
10
|
-
ActiveRecord::Schema.define do
|
11
|
-
create_table :users, :force => true do |t|
|
12
|
-
t.column :key, :string
|
13
|
-
t.column :other_key, :string
|
14
|
-
t.column :gender_id, :integer
|
15
|
-
t.column :username, :string
|
16
|
-
end
|
17
|
-
|
18
|
-
create_table :players, :force => true do |t|
|
19
|
-
t.column :username, :string
|
20
|
-
t.column :key, :string
|
21
|
-
end
|
22
|
-
|
23
|
-
create_table :genders, :force => true do |t|
|
24
|
-
t.column :sex, :string
|
25
|
-
end
|
26
|
-
|
27
|
-
create_table :aliens, :force => true do |t|
|
28
|
-
t.column :gender_id, :string
|
29
|
-
end
|
30
|
-
|
31
|
-
create_table :admins, :force => true do |t|
|
32
|
-
t.column :admin_status, :boolean
|
33
|
-
t.column :name, :string
|
34
|
-
t.column :username, :string
|
35
|
-
t.column :key, :string
|
36
|
-
t.column :other_key, :string
|
37
|
-
end
|
38
|
-
|
39
|
-
create_table :items, :force => true do |t|
|
40
|
-
t.column :category, :integer
|
41
|
-
t.column :type, :string
|
42
|
-
t.column :name, :string
|
43
|
-
end
|
44
|
-
|
45
|
-
create_table :categories, :force => true do |t|
|
46
|
-
t.column :name, :string
|
47
|
-
end
|
48
|
-
|
49
|
-
create_table :subscribers, :force => true do |t|
|
50
|
-
t.column :first_name, :string
|
51
|
-
end
|
52
|
-
|
53
|
-
create_table :subscriptions, :force => true do |t|
|
54
|
-
t.column :name, :string
|
55
|
-
end
|
56
|
-
|
57
|
-
create_table :subscribers_subscriptions, :force => true, :id => false do |t|
|
58
|
-
t.column :subscriber_id, :integer
|
59
|
-
t.column :subscription_id, :integer
|
60
|
-
end
|
61
|
-
|
62
|
-
create_table :events do |t|
|
63
|
-
t.column :created_at, :datetime
|
64
|
-
t.column :updated_at, :datetime
|
65
|
-
end
|
66
|
-
|
67
|
-
create_table :schedules do |t|
|
68
|
-
t.integer :event_id
|
69
|
-
end
|
70
|
-
|
71
|
-
create_table :posts do |t|
|
72
|
-
t.timestamps
|
73
|
-
end
|
74
|
-
|
75
|
-
create_table :comments do |t|
|
76
|
-
t.integer :post_id
|
77
|
-
t.timestamps
|
78
|
-
end
|
79
|
-
|
80
|
-
create_table :no_validations do |t|
|
81
|
-
t.timestamps
|
82
|
-
end
|
83
|
-
|
84
|
-
create_table :validate_names do |t|
|
85
|
-
t.string :name
|
86
|
-
end
|
87
|
-
|
88
|
-
create_table :validate_name_twos do |t|
|
89
|
-
t.string :name
|
90
|
-
end
|
91
|
-
|
92
|
-
create_table :address_with_valid_cities do |t|
|
93
|
-
t.string :city
|
94
|
-
end
|
95
|
-
|
96
|
-
create_table :address_with_valid_city_and_states do |t|
|
97
|
-
t.string :city
|
98
|
-
t.string :state
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def mock_fr_module(&block)
|
103
|
-
mod = Module.new
|
104
|
-
mod.extend(FixtureReplacement::ClassMethods)
|
105
|
-
mod.instance_eval(&block)
|
106
|
-
mod
|
107
|
-
end
|
108
|
-
|
109
|
-
def use_module(&block)
|
110
|
-
mod = mock_fr_module(&block)
|
111
|
-
|
112
|
-
obj = Object.new
|
113
|
-
obj.extend mod
|
114
|
-
obj
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'rubygems'
|
3
|
-
require 'sqlite3'
|
4
|
-
require 'active_record'
|
5
|
-
require 'active_support'
|
6
|
-
|
7
|
-
require 'test/unit'
|
8
|
-
|
9
|
-
RAILS_ROOT = "."
|
10
|
-
|
11
|
-
require File.dirname(__FILE__) + "/../spec/spec_helpers"
|
12
|
-
include SpecHelperFunctions
|
13
|
-
|
14
|
-
setup_database_connection
|
15
|
-
|
16
|
-
require File.dirname(__FILE__) + "/../lib/fixture_replacement"
|
17
|
-
require File.dirname(__FILE__) + "/../spec/fixture_replacement/fixtures/classes"
|
18
|
-
|
19
|
-
|
20
|
-
class Test::Unit::TestCase
|
21
|
-
end
|
data/test/unit/user_test.rb
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
-
|
3
|
-
module ::FixtureReplacement
|
4
|
-
|
5
|
-
attributes_for :gender do |g|
|
6
|
-
g.sex = "male"
|
7
|
-
end
|
8
|
-
|
9
|
-
attributes_for :user do |u|
|
10
|
-
u.username = scott
|
11
|
-
u.key = "something"
|
12
|
-
u.gender = new_gender
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
def scott
|
17
|
-
"Scott Taylor"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
|
22
|
-
class UserTest < Test::Unit::TestCase
|
23
|
-
|
24
|
-
def setup
|
25
|
-
extend FixtureReplacement
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_true_should_be_true
|
29
|
-
assert_equal true, true
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_be_able_to_create_with_create_user
|
33
|
-
assert_equal create_user.class, User
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_user_has_default_gender_with_create_user
|
37
|
-
assert create_user.gender.kind_of?(Gender)
|
38
|
-
assert_equal create_user.gender.sex, "male"
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_user_has_default_gender_with_new_user
|
42
|
-
assert new_user.gender.kind_of?(Gender)
|
43
|
-
assert_equal new_user.gender.sex, "male"
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_create_user_should_have_user_key_something
|
47
|
-
assert_equal create_user.key, "something"
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_new_user_should_have_user_key_something
|
51
|
-
assert_equal new_user.key, "something"
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_testcase_should_not_raise_an_error_when_sending_new_user
|
55
|
-
assert self.send(:new_user)
|
56
|
-
end
|
57
|
-
end
|