fixed test:units rake task

This commit is contained in:
albert
2010-03-18 18:29:41 -04:00
parent e46bfb3d76
commit 06a959a9fd
5 changed files with 136 additions and 27 deletions

10
Gemfile
View File

@@ -1,14 +1,14 @@
# Edit this Gemfile to bundle your application's dependencies.
source 'http://gemcutter.org'
gem "rails", "3.0.0.beta"
gem "pg"
gem "memcache-client", :require => "memcache"
gem "imagesize", :require => "image_size"
group :test do
gem "shoulda"
gem "factory_girl"
gem "mocha"
gem "faker"
end
gem "rails", "3.0.0.beta"
gem "pg"
gem "memcache-client", :require => "memcache"
gem "imagesize", :require => "image_size"

View File

@@ -20,7 +20,7 @@ class UsersController < ApplicationController
end
def create
@user = User.new(params[:user])
@user = User.new(params[:user].merge(:ip_addr => request.remote_ip))
flash[:notice] = "You have succesfully created a new account." if @user.save
respond_with(@user)
end

View File

@@ -257,7 +257,6 @@ ALTER SEQUENCE artists_id_seq OWNED BY artists.id;
CREATE TABLE bans (
id integer NOT NULL,
user_id integer,
ip_addr inet,
reason text NOT NULL,
banner_id integer NOT NULL,
expires_at timestamp without time zone NOT NULL,
@@ -762,6 +761,71 @@ CREATE SEQUENCE forum_topics_id_seq
ALTER SEQUENCE forum_topics_id_seq OWNED BY forum_topics.id;
--
-- Name: ip_bans; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE ip_bans (
id integer NOT NULL,
creator_id integer NOT NULL,
ip_addr inet NOT NULL,
reason text NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone
);
--
-- Name: ip_bans_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE ip_bans_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- Name: ip_bans_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE ip_bans_id_seq OWNED BY ip_bans.id;
--
-- Name: janitor_trials; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE janitor_trials (
id integer NOT NULL,
user_id integer NOT NULL,
promoted_at timestamp without time zone,
created_at timestamp without time zone,
updated_at timestamp without time zone
);
--
-- Name: janitor_trials_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE janitor_trials_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- Name: janitor_trials_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE janitor_trials_id_seq OWNED BY janitor_trials.id;
--
-- Name: jobs; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
@@ -1292,8 +1356,6 @@ ALTER SEQUENCE unapprovals_id_seq OWNED BY unapprovals.id;
CREATE TABLE uploads (
id integer NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
source character varying(255),
file_path character varying(255),
content_type character varying(255),
@@ -1302,7 +1364,10 @@ CREATE TABLE uploads (
uploader_ip_addr inet NOT NULL,
tag_string text NOT NULL,
status character varying(255) DEFAULT 'pending'::character varying NOT NULL,
post_id integer
post_id integer,
md5_confirmation character varying(255),
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -1370,13 +1435,15 @@ CREATE TABLE users (
name character varying(255) NOT NULL,
password_hash character varying(255) NOT NULL,
email character varying(255),
invited_by integer,
email_verification_key character varying(255),
inviter_id integer,
is_banned boolean DEFAULT false NOT NULL,
is_privileged boolean DEFAULT false NOT NULL,
is_contributor boolean DEFAULT false NOT NULL,
is_janitor boolean DEFAULT false NOT NULL,
is_moderator boolean DEFAULT false NOT NULL,
is_admin boolean DEFAULT false NOT NULL,
base_upload_limit integer DEFAULT 10 NOT NULL,
last_logged_in_at timestamp without time zone,
last_forum_read_at timestamp without time zone,
has_mail boolean DEFAULT false NOT NULL,
@@ -1385,7 +1452,8 @@ CREATE TABLE users (
always_resize_images boolean DEFAULT false NOT NULL,
default_image_size character varying(255) DEFAULT 'medium'::character varying NOT NULL,
favorite_tags text,
blacklisted_tags text
blacklisted_tags text,
time_zone character varying(255) DEFAULT 'Eastern Time (US & Canada)'::character varying NOT NULL
);
@@ -1626,6 +1694,20 @@ ALTER TABLE forum_posts ALTER COLUMN id SET DEFAULT nextval('forum_posts_id_seq'
ALTER TABLE forum_topics ALTER COLUMN id SET DEFAULT nextval('forum_topics_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ip_bans ALTER COLUMN id SET DEFAULT nextval('ip_bans_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE janitor_trials ALTER COLUMN id SET DEFAULT nextval('janitor_trials_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
@@ -1927,6 +2009,22 @@ ALTER TABLE ONLY forum_topics
ADD CONSTRAINT forum_topics_pkey PRIMARY KEY (id);
--
-- Name: ip_bans_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY ip_bans
ADD CONSTRAINT ip_bans_pkey PRIMARY KEY (id);
--
-- Name: janitor_trials_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY janitor_trials
ADD CONSTRAINT janitor_trials_pkey PRIMARY KEY (id);
--
-- Name: jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
@@ -2163,13 +2261,6 @@ CREATE INDEX index_artists_on_other_names_index ON artists USING gin (other_name
CREATE INDEX index_bans_on_expires_at ON bans USING btree (expires_at);
--
-- Name: index_bans_on_ip_addr; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_bans_on_ip_addr ON bans USING btree (ip_addr);
--
-- Name: index_bans_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@@ -2394,6 +2485,20 @@ CREATE INDEX index_forum_topics_on_creator_id ON forum_topics USING btree (creat
CREATE INDEX index_forum_topics_on_text_index ON forum_topics USING gin (text_index);
--
-- Name: index_ip_bans_on_ip_addr; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_ip_bans_on_ip_addr ON ip_bans USING btree (ip_addr);
--
-- Name: index_janitor_trials_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_janitor_trials_on_user_id ON janitor_trials USING btree (user_id);
--
-- Name: index_note_versions_on_note_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@@ -2802,4 +2907,8 @@ INSERT INTO schema_migrations (version) VALUES ('20100224171915');
INSERT INTO schema_migrations (version) VALUES ('20100224172146');
INSERT INTO schema_migrations (version) VALUES ('20100307073438');
INSERT INTO schema_migrations (version) VALUES ('20100307073438');
INSERT INTO schema_migrations (version) VALUES ('20100309211553');
INSERT INTO schema_migrations (version) VALUES ('20100318213503');

View File

@@ -1,18 +1,18 @@
Factory.define(:tag) do |f|
f.name {Faker::Name.first_name.downcase}
f.post_count 0
f.category Tag.categories.general
f.category {Tag.categories.general}
f.related_tags ""
end
Factory.define(:artist_tag, :parent => :tag) do |f|
f.category Tag.categories.artist
f.category {Tag.categories.artist}
end
Factory.define(:copyright_tag, :parent => :tag) do |f|
f.category Tag.categories.copyright
f.category {Tag.categories.copyright}
end
Factory.define(:character_tag, :parent => :tag) do |f|
f.category Tag.categories.character
f.category {Tag.categories.character}
end

View File

@@ -1,9 +1,9 @@
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'shoulda'
ENV["RAILS_ENV"] = "test"
require 'factory_girl'
require 'shoulda'
require 'mocha'
require 'faker'
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'rails/test_help'
Dir[File.expand_path(File.dirname(__FILE__) + "/factories/*.rb")].each {|file| require file}