diff --git a/Gemfile b/Gemfile index 1050e3b2a..c08ae6b7e 100644 --- a/Gemfile +++ b/Gemfile @@ -10,8 +10,6 @@ group :test do gem "vcr" gem "webmock" gem "timecop" - gem "test-unit-rails" - gem "ruby-prof" end group :assets do diff --git a/Gemfile.lock b/Gemfile.lock index f155e1220..1b9ccc57f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,12 +52,6 @@ GEM net-ssh-gateway (>= 1.1.0) capistrano-unicorn (0.1.10) capistrano - capybara (2.2.0) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (~> 2.0) chronic (0.9.1) coderay (1.0.9) crack (0.4.1) @@ -154,7 +148,6 @@ GEM json (~> 1.4) ref (1.0.5) rmagick (2.13.2) - rr (1.1.2) ruby-prof (0.13.0) safe_yaml (0.9.5) sanitize (2.0.6) @@ -186,25 +179,6 @@ GEM statistics2 (0.54) term-ansicolor (1.2.2) tins (~> 0.8) - test-unit (2.5.5) - test-unit-activesupport (1.0.1) - activesupport - test-unit - test-unit-capybara (1.0.4) - capybara (>= 2.1.0) - json - test-unit (>= 2.5.3) - test-unit-notify (1.0.1) - test-unit (>= 2.4.9) - test-unit-rails (1.0.2) - rails - test-unit-activesupport - test-unit-capybara - test-unit-notify - test-unit-rr - test-unit-rr (1.0.3) - rr (>= 1.1.1) - test-unit (>= 2.5.2) therubyracer (0.11.4) libv8 (~> 3.11.8.12) ref @@ -235,8 +209,6 @@ GEM activesupport (>= 2.3.4) chronic (>= 0.6.3) xml-simple (1.1.2) - xpath (2.0.0) - nokogiri (~> 1.3) PLATFORMS ruby @@ -273,7 +245,6 @@ DEPENDENCIES simplecov statistics2 term-ansicolor - test-unit-rails therubyracer timecop uglifier (>= 1.0.3) diff --git a/app/logical/d_text.rb b/app/logical/d_text.rb index bd72020ca..7db38e7f5 100644 --- a/app/logical/d_text.rb +++ b/app/logical/d_text.rb @@ -198,11 +198,17 @@ class DText when /\[code\](?!\])/ flags[:code] = true + stack << "pre" '
'
 
       when /\[\/code\](?!\])/
         flags[:code] = false
-        '
' + if stack.last == "pre" + stack.pop + "" + else + "" + end when /\[expand(?:\=([^\]]*))?\](?!\])/ stack << "expandable" diff --git a/app/models/pool.rb b/app/models/pool.rb index 386fc1413..86c483297 100644 --- a/app/models/pool.rb +++ b/app/models/pool.rb @@ -125,8 +125,12 @@ class Pool < ActiveRecord::Base name.gsub(/\s+/, "_") end - def self.normalize_post_ids(post_ids) - post_ids.scan(/\d+/).uniq.join(" ") + def self.normalize_post_ids(post_ids, unique) + hoge = post_ids.scan(/\d+/) + if unique + hoge = hoge.uniq + end + hoge.join(" ") end def self.find_by_name(name) @@ -139,6 +143,14 @@ class Pool < ActiveRecord::Base end end + def is_series? + category == "series" + end + + def is_collection? + category == "collection" + end + def initialize_is_active self.is_deleted = false if is_deleted.nil? self.is_active = true if is_active.nil? @@ -165,7 +177,7 @@ class Pool < ActiveRecord::Base end def normalize_post_ids - self.post_ids = self.class.normalize_post_ids(post_ids) + self.post_ids = self.class.normalize_post_ids(post_ids, is_collection?) end def revert_to!(version) diff --git a/test/unit/dtext_test.rb b/test/unit/dtext_test.rb index f5737393b..4fbde0e30 100644 --- a/test/unit/dtext_test.rb +++ b/test/unit/dtext_test.rb @@ -38,7 +38,7 @@ class DTextTest < ActiveSupport::TestCase end def test_spoilers_with_no_closing_tag_1 - assert_equal("
\n

this is a spoiler with no closing tag

\n

new text

\n
", p("[spoiler]this is a spoiler with no closing tag\n\nnew text")) + assert_equal("

this is a spoiler with no closing tag

new text

", p("[spoiler]this is a spoiler with no closing tag\n\nnew text")) end def test_spoilers_with_no_closing_tag_2 @@ -50,7 +50,7 @@ class DTextTest < ActiveSupport::TestCase end def test_spoilers_nested - assert_equal("
\n

this is

\n

a nested

\n

spoiler

\n
", p("[spoiler]this is [spoiler]a nested[/spoiler] spoiler[/spoiler]")) + assert_equal("

this is

a nested

spoiler

", p("[spoiler]this is [spoiler]a nested[/spoiler] spoiler[/spoiler]")) end def test_paragraphs @@ -74,7 +74,7 @@ class DTextTest < ActiveSupport::TestCase end def test_quote_blocks_nested - assert_equal("
\n

a

\n

b

\n

c

\n
", p("[quote]\na\n[quote]\nb\n[/quote]\nc\n[/quote]")) + assert_equal("

a

b

c

", p("[quote]\na\n[quote]\nb\n[/quote]\nc\n[/quote]")) end def test_code