fixed tests
This commit is contained in:
@@ -40,7 +40,6 @@ private
|
|||||||
end
|
end
|
||||||
|
|
||||||
def cookie_password_hash_valid?
|
def cookie_password_hash_valid?
|
||||||
puts "cookie_password_hash=#{cookies[:cookie_password_hash]}"
|
|
||||||
cookies[:cookie_password_hash] && User.authenticate_cookie_hash(cookies[:user_name], cookies[:cookie_password_hash])
|
cookies[:cookie_password_hash] && User.authenticate_cookie_hash(cookies[:user_name], cookies[:cookie_password_hash])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -439,6 +439,7 @@ CREATE TABLE advertisements (
|
|||||||
width integer NOT NULL,
|
width integer NOT NULL,
|
||||||
height integer NOT NULL,
|
height integer NOT NULL,
|
||||||
file_name character varying(255) NOT NULL,
|
file_name character varying(255) NOT NULL,
|
||||||
|
is_work_safe boolean DEFAULT false NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone
|
||||||
);
|
);
|
||||||
@@ -541,6 +542,7 @@ CREATE TABLE artist_versions (
|
|||||||
other_names text,
|
other_names text,
|
||||||
group_name character varying(255),
|
group_name character varying(255),
|
||||||
url_string text,
|
url_string text,
|
||||||
|
is_banned boolean DEFAULT false NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone
|
||||||
);
|
);
|
||||||
@@ -1935,7 +1937,7 @@ CREATE TABLE notes (
|
|||||||
height integer NOT NULL,
|
height integer NOT NULL,
|
||||||
is_active boolean DEFAULT true NOT NULL,
|
is_active boolean DEFAULT true NOT NULL,
|
||||||
body text NOT NULL,
|
body text NOT NULL,
|
||||||
text_index tsvector NOT NULL,
|
body_index tsvector NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone
|
||||||
);
|
);
|
||||||
@@ -2228,6 +2230,7 @@ CREATE TABLE posts (
|
|||||||
pool_string text DEFAULT ''::text NOT NULL,
|
pool_string text DEFAULT ''::text NOT NULL,
|
||||||
last_noted_at timestamp without time zone,
|
last_noted_at timestamp without time zone,
|
||||||
last_commented_at timestamp without time zone,
|
last_commented_at timestamp without time zone,
|
||||||
|
fav_count integer DEFAULT 0 NOT NULL,
|
||||||
tag_string text DEFAULT ''::text NOT NULL,
|
tag_string text DEFAULT ''::text NOT NULL,
|
||||||
tag_index tsvector,
|
tag_index tsvector,
|
||||||
tag_count integer DEFAULT 0 NOT NULL,
|
tag_count integer DEFAULT 0 NOT NULL,
|
||||||
@@ -2356,9 +2359,10 @@ CREATE TABLE tag_subscriptions (
|
|||||||
tag_query character varying(255) NOT NULL,
|
tag_query character varying(255) NOT NULL,
|
||||||
post_ids text NOT NULL,
|
post_ids text NOT NULL,
|
||||||
is_public boolean DEFAULT true NOT NULL,
|
is_public boolean DEFAULT true NOT NULL,
|
||||||
|
last_accessed_at timestamp without time zone,
|
||||||
|
is_opted_in boolean DEFAULT false NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone
|
||||||
last_accessed_at timestamp without time zone
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -2430,11 +2434,11 @@ CREATE TABLE uploads (
|
|||||||
uploader_ip_addr inet NOT NULL,
|
uploader_ip_addr inet NOT NULL,
|
||||||
tag_string text NOT NULL,
|
tag_string text NOT NULL,
|
||||||
status character varying(255) DEFAULT 'pending'::character varying NOT NULL,
|
status character varying(255) DEFAULT 'pending'::character varying NOT NULL,
|
||||||
|
backtrace text,
|
||||||
post_id integer,
|
post_id integer,
|
||||||
md5_confirmation character varying(255),
|
md5_confirmation character varying(255),
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone
|
||||||
backtrace text
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -3232,6 +3236,13 @@ CREATE INDEX index_artist_urls_on_artist_id ON artist_urls USING btree (artist_i
|
|||||||
CREATE INDEX index_artist_urls_on_normalized_url ON artist_urls USING btree (normalized_url);
|
CREATE INDEX index_artist_urls_on_normalized_url ON artist_urls USING btree (normalized_url);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_artist_urls_on_url; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_artist_urls_on_url ON artist_urls USING btree (url);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_artist_versions_on_artist_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_artist_versions_on_artist_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@@ -3274,6 +3285,13 @@ CREATE UNIQUE INDEX index_artists_on_name ON artists USING btree (name);
|
|||||||
CREATE INDEX index_artists_on_other_names_index ON artists USING gin (other_names_index);
|
CREATE INDEX index_artists_on_other_names_index ON artists USING gin (other_names_index);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_bans_on_banner_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_bans_on_banner_id ON bans USING btree (banner_id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_bans_on_expires_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_bans_on_expires_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@@ -3288,6 +3306,20 @@ CREATE INDEX index_bans_on_expires_at ON bans USING btree (expires_at);
|
|||||||
CREATE INDEX index_bans_on_user_id ON bans USING btree (user_id);
|
CREATE INDEX index_bans_on_user_id ON bans USING btree (user_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_comment_votes_on_comment_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_comment_votes_on_comment_id ON comment_votes USING btree (comment_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_comment_votes_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_comment_votes_on_created_at ON comment_votes USING btree (created_at);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_comment_votes_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_comment_votes_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@@ -4807,6 +4839,13 @@ CREATE INDEX index_note_versions_on_updater_id ON note_versions USING btree (upd
|
|||||||
CREATE INDEX index_note_versions_on_updater_ip_addr ON note_versions USING btree (updater_ip_addr);
|
CREATE INDEX index_note_versions_on_updater_ip_addr ON note_versions USING btree (updater_ip_addr);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_notes_on_body_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_notes_on_body_index ON notes USING gin (body_index);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_notes_on_creator_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_notes_on_creator_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@@ -4821,13 +4860,6 @@ CREATE INDEX index_notes_on_creator_id ON notes USING btree (creator_id);
|
|||||||
CREATE INDEX index_notes_on_post_id ON notes USING btree (post_id);
|
CREATE INDEX index_notes_on_post_id ON notes USING btree (post_id);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: index_notes_on_text_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE INDEX index_notes_on_text_index ON notes USING gin (text_index);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_pool_versions_on_pool_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_pool_versions_on_pool_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@@ -4835,6 +4867,20 @@ CREATE INDEX index_notes_on_text_index ON notes USING gin (text_index);
|
|||||||
CREATE INDEX index_pool_versions_on_pool_id ON pool_versions USING btree (pool_id);
|
CREATE INDEX index_pool_versions_on_pool_id ON pool_versions USING btree (pool_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_pool_versions_on_updater_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_pool_versions_on_updater_id ON pool_versions USING btree (updater_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_pool_versions_on_updater_ip_addr; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_pool_versions_on_updater_ip_addr ON pool_versions USING btree (updater_ip_addr);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_pools_on_creator_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_pools_on_creator_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@@ -4926,6 +4972,20 @@ CREATE INDEX index_post_versions_on_updater_id ON post_versions USING btree (upd
|
|||||||
CREATE INDEX index_post_versions_on_updater_ip_addr ON post_versions USING btree (updater_ip_addr);
|
CREATE INDEX index_post_versions_on_updater_ip_addr ON post_versions USING btree (updater_ip_addr);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_post_votes_on_post_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_post_votes_on_post_id ON post_votes USING btree (post_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_post_votes_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_post_votes_on_user_id ON post_votes USING btree (user_id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_posts_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_posts_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@@ -5003,6 +5063,20 @@ CREATE INDEX index_posts_on_source ON posts USING btree (source);
|
|||||||
CREATE INDEX index_posts_on_tags_index ON posts USING gin (tag_index);
|
CREATE INDEX index_posts_on_tags_index ON posts USING gin (tag_index);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_posts_on_uploader_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_posts_on_uploader_id ON posts USING btree (uploader_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_posts_on_uploader_ip_addr; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_posts_on_uploader_ip_addr ON posts USING btree (uploader_ip_addr);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_tag_aliases_on_antecedent_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_tag_aliases_on_antecedent_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@@ -5052,6 +5126,20 @@ CREATE INDEX index_tag_subscriptions_on_name ON tag_subscriptions USING btree (n
|
|||||||
CREATE UNIQUE INDEX index_tags_on_name ON tags USING btree (name);
|
CREATE UNIQUE INDEX index_tags_on_name ON tags USING btree (name);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_uploads_on_uploader_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_uploads_on_uploader_id ON uploads USING btree (uploader_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_uploads_on_uploader_ip_addr; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_uploads_on_uploader_ip_addr ON uploads USING btree (uploader_ip_addr);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_user_feedback_on_creator_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_user_feedback_on_creator_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@@ -5175,7 +5263,7 @@ CREATE TRIGGER trigger_forum_topics_on_update
|
|||||||
CREATE TRIGGER trigger_notes_on_update
|
CREATE TRIGGER trigger_notes_on_update
|
||||||
BEFORE INSERT OR UPDATE ON notes
|
BEFORE INSERT OR UPDATE ON notes
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
EXECUTE PROCEDURE tsvector_update_trigger('text_index', 'pg_catalog.english', 'body');
|
EXECUTE PROCEDURE tsvector_update_trigger('body_index', 'pg_catalog.english', 'body');
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|||||||
18
db/seeds.rb
18
db/seeds.rb
@@ -50,7 +50,7 @@ if Comment.count == 0
|
|||||||
puts "Creating comments"
|
puts "Creating comments"
|
||||||
Post.all.each do |post|
|
Post.all.each do |post|
|
||||||
rand(30).times do
|
rand(30).times do
|
||||||
Comment.create(:post_id => post.id, :body => rand(1_000_000).to_s)
|
Comment.create(:post_id => post.id, :body => Time.now.to_f.to_s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -61,7 +61,7 @@ if Note.count == 0
|
|||||||
puts "Creating notes"
|
puts "Creating notes"
|
||||||
Post.all.each do |post|
|
Post.all.each do |post|
|
||||||
rand(10).times do
|
rand(10).times do
|
||||||
note = Note.create(:post_id => post.id, :x => 0, :y => 0, :width => 100, :height => 100, :body => rand(1_000_000).to_s)
|
note = Note.create(:post_id => post.id, :x => 0, :y => 0, :width => 100, :height => 100, :body => Time.now.to_f.to_s)
|
||||||
|
|
||||||
rand(30).times do |i|
|
rand(30).times do |i|
|
||||||
note.update_attributes(:body => (i * i).to_s)
|
note.update_attributes(:body => (i * i).to_s)
|
||||||
@@ -106,7 +106,7 @@ if Pool.count == 0
|
|||||||
|
|
||||||
1.upto(20) do |i|
|
1.upto(20) do |i|
|
||||||
pool = Pool.create(:name => i.to_s)
|
pool = Pool.create(:name => i.to_s)
|
||||||
33.times do |j|
|
rand(33).times do |j|
|
||||||
pool.add!(Post.order("random()").first)
|
pool.add!(Post.order("random()").first)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -124,6 +124,18 @@ else
|
|||||||
puts "Skipping favorites"
|
puts "Skipping favorites"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if ForumTopic.count == 0
|
||||||
|
puts "Creating forum posts"
|
||||||
|
|
||||||
|
100.times do |i|
|
||||||
|
topic = ForumTopic.create(:title => Time.now.to_f.to_s)
|
||||||
|
|
||||||
|
rand(100).times do |j|
|
||||||
|
post = ForumPost.create(:topic_id => topic.id, :body => Time.now.to_f.to_s)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if TagSubscription.count == 0
|
if TagSubscription.count == 0
|
||||||
puts "Creating tag subscriptions"
|
puts "Creating tag subscriptions"
|
||||||
TagSubscription.create(:name => "0", :tag_query => Tag.order("random()").first.name)
|
TagSubscription.create(:name => "0", :tag_query => Tag.order("random()").first.name)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
rake db:drop db:create
|
bundle exec rake db:drop db:create
|
||||||
createlang plpgsql danbooru2
|
createlang plpgsql danbooru2
|
||||||
rake db:migrate
|
bundle exec rake db:migrate
|
||||||
rake db:seed
|
bundle exec rake db:seed
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class PostAppealTest < ActiveSupport::TestCase
|
|||||||
@post_appeal = PostAppeal.create(:post => @post, :reason => "aaa")
|
@post_appeal = PostAppeal.create(:post => @post, :reason => "aaa")
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal(["Creator has already appealed this post"], @post_appeal.errors.full_messages)
|
assert_equal(["You have already appealed this post"], @post_appeal.errors.full_messages)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not be able to appeal more than 5 posts in 24 hours" do
|
should "not be able to appeal more than 5 posts in 24 hours" do
|
||||||
@@ -37,7 +37,7 @@ class PostAppealTest < ActiveSupport::TestCase
|
|||||||
assert_difference("PostAppeal.count", 0) do
|
assert_difference("PostAppeal.count", 0) do
|
||||||
@post_appeal.save
|
@post_appeal.save
|
||||||
end
|
end
|
||||||
assert_equal(["Creator can appeal 5 posts a day"], @post_appeal.errors.full_messages)
|
assert_equal(["You can appeal 5 posts a day"], @post_appeal.errors.full_messages)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not be able to appeal an active post" do
|
should "not be able to appeal an active post" do
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class PostFlagTest < ActiveSupport::TestCase
|
|||||||
@post_flag = PostFlag.create(:post => @post, :reason => "aaa")
|
@post_flag = PostFlag.create(:post => @post, :reason => "aaa")
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal(["Creator has already flagged this post"], @post_flag.errors.full_messages)
|
assert_equal(["You have already flagged this post"], @post_flag.errors.full_messages)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not be able to flag more than 10 posts in 24 hours" do
|
should "not be able to flag more than 10 posts in 24 hours" do
|
||||||
@@ -37,7 +37,7 @@ class PostFlagTest < ActiveSupport::TestCase
|
|||||||
assert_difference("PostFlag.count", 0) do
|
assert_difference("PostFlag.count", 0) do
|
||||||
@post_flag.save
|
@post_flag.save
|
||||||
end
|
end
|
||||||
assert_equal(["Creator can flag 10 posts a day"], @post_flag.errors.full_messages)
|
assert_equal(["You can flag 10 posts a day"], @post_flag.errors.full_messages)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not be able to flag a deleted post" do
|
should "not be able to flag a deleted post" do
|
||||||
|
|||||||
@@ -14,6 +14,17 @@ class PostTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "Deletion:" do
|
context "Deletion:" do
|
||||||
|
context "Annihilating a post" do
|
||||||
|
setup do
|
||||||
|
@post = Factory.create(:post)
|
||||||
|
@post.annihilate!
|
||||||
|
end
|
||||||
|
|
||||||
|
should "destroy the record" do
|
||||||
|
assert_equal(0, Post.where("id = ?", @post.id).count)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "Deleting a post" do
|
context "Deleting a post" do
|
||||||
should "update the fast count" do
|
should "update the fast count" do
|
||||||
post = Factory.create(:post, :tag_string => "aaa")
|
post = Factory.create(:post, :tag_string => "aaa")
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class TagAliasTest < ActiveSupport::TestCase
|
|||||||
ta = FactoryGirl.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "ccc")
|
ta = FactoryGirl.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "ccc")
|
||||||
post1.reload
|
post1.reload
|
||||||
post2.reload
|
post2.reload
|
||||||
assert_equal("ccc bbb", post1.tag_string)
|
assert_equal("bbb ccc", post1.tag_string)
|
||||||
assert_equal("ccc ddd", post2.tag_string)
|
assert_equal("ccc ddd", post2.tag_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class TagImplicationTest < ActiveSupport::TestCase
|
|||||||
ti1 = FactoryGirl.create(:tag_implication, :antecedent_name => "aaa", :consequent_name => "xxx")
|
ti1 = FactoryGirl.create(:tag_implication, :antecedent_name => "aaa", :consequent_name => "xxx")
|
||||||
ti2 = FactoryGirl.create(:tag_implication, :antecedent_name => "aaa", :consequent_name => "yyy")
|
ti2 = FactoryGirl.create(:tag_implication, :antecedent_name => "aaa", :consequent_name => "yyy")
|
||||||
p1.reload
|
p1.reload
|
||||||
assert_equal("aaa yyy xxx bbb ccc", p1.tag_string)
|
assert_equal("aaa bbb ccc xxx yyy", p1.tag_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "record the implication's creator in the tag history" do
|
should "record the implication's creator in the tag history" do
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ class TagTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
should "strip out invalid characters when scanning" do
|
should "strip out invalid characters when scanning" do
|
||||||
assert_equal(%w(aaa bbb), Tag.scan_tags("aaa bbb"))
|
assert_equal(%w(aaa bbb), Tag.scan_tags("aaa bbb"))
|
||||||
assert_equal(%w(-b_b_b_), Tag.scan_tags("-B,B;B* -b_b_b_"))
|
assert_equal(%w(-bb;b* -b_b_b_), Tag.scan_tags("-B,B;B* -b_b_b_"))
|
||||||
end
|
end
|
||||||
|
|
||||||
should "cast values" do
|
should "cast values" do
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ class UploadTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
post = Post.last
|
post = Post.last
|
||||||
assert_equal("hoge foo", post.tag_string)
|
assert_equal("foo hoge", post.tag_string)
|
||||||
assert_equal("s", post.rating)
|
assert_equal("s", post.rating)
|
||||||
assert_equal(@upload.uploader_id, post.uploader_id)
|
assert_equal(@upload.uploader_id, post.uploader_id)
|
||||||
assert_equal("127.0.0.1", post.uploader_ip_addr)
|
assert_equal("127.0.0.1", post.uploader_ip_addr)
|
||||||
@@ -167,7 +167,7 @@ class UploadTest < ActiveSupport::TestCase
|
|||||||
assert_nothing_raised {@upload.process!}
|
assert_nothing_raised {@upload.process!}
|
||||||
end
|
end
|
||||||
post = Post.last
|
post = Post.last
|
||||||
assert_equal("hoge foo", post.tag_string)
|
assert_equal("foo hoge", post.tag_string)
|
||||||
assert_equal("s", post.rating)
|
assert_equal("s", post.rating)
|
||||||
assert_equal(@upload.uploader_id, post.uploader_id)
|
assert_equal(@upload.uploader_id, post.uploader_id)
|
||||||
assert_equal("127.0.0.1", post.uploader_ip_addr)
|
assert_equal("127.0.0.1", post.uploader_ip_addr)
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class UserTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
should "limit comment votes" do
|
should "limit comment votes" do
|
||||||
|
Danbooru.config.stubs(:member_comment_limit).returns(10)
|
||||||
assert(@user.can_comment_vote?)
|
assert(@user.can_comment_vote?)
|
||||||
10.times do
|
10.times do
|
||||||
comment = Factory.create(:comment)
|
comment = Factory.create(:comment)
|
||||||
@@ -176,7 +177,7 @@ class UserTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
context "cookie password hash" do
|
context "cookie password hash" do
|
||||||
setup do
|
setup do
|
||||||
@user = Factory.create(:user, :password_hash => "1234")
|
@user = Factory.create(:user, :name => "albert", :password_hash => "1234")
|
||||||
end
|
end
|
||||||
|
|
||||||
should "be correct" do
|
should "be correct" do
|
||||||
|
|||||||
Reference in New Issue
Block a user