diff --git a/Gemfile b/Gemfile
index c08ae6b7e..1050e3b2a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -10,6 +10,8 @@ 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 1b9ccc57f..f155e1220 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -52,6 +52,12 @@ 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)
@@ -148,6 +154,7 @@ 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)
@@ -179,6 +186,25 @@ 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
@@ -209,6 +235,8 @@ GEM
activesupport (>= 2.3.4)
chronic (>= 0.6.3)
xml-simple (1.1.2)
+ xpath (2.0.0)
+ nokogiri (~> 1.3)
PLATFORMS
ruby
@@ -245,6 +273,7 @@ DEPENDENCIES
simplecov
statistics2
term-ansicolor
+ test-unit-rails
therubyracer
timecop
uglifier (>= 1.0.3)
diff --git a/app/assets/stylesheets/common/020_base.css.scss b/app/assets/stylesheets/common/020_base.css.scss
index a4e4c8927..0e74c5104 100644
--- a/app/assets/stylesheets/common/020_base.css.scss
+++ b/app/assets/stylesheets/common/020_base.css.scss
@@ -122,3 +122,8 @@ table tfoot {
color: #666;
font-style: italic;
}
+
+.tn {
+ font-size: 0.8em;
+ color: gray;
+}
diff --git a/app/assets/stylesheets/specific/notes.css.scss b/app/assets/stylesheets/specific/notes.css.scss
index 337cc074a..7579f22a1 100644
--- a/app/assets/stylesheets/specific/notes.css.scss
+++ b/app/assets/stylesheets/specific/notes.css.scss
@@ -18,11 +18,6 @@ div#note-container {
line-height: normal;
}
- p.tn {
- font-size: 0.8em;
- color: gray;
- }
-
> :last-child {
margin-bottom: 0;
}
diff --git a/app/logical/d_text.rb b/app/logical/d_text.rb
index 8112fa4a3..bd72020ca 100644
--- a/app/logical/d_text.rb
+++ b/app/logical/d_text.rb
@@ -19,6 +19,7 @@ class DText
str.gsub!(/\[i\](.+?)\[\/i\]/i, '\1')
str.gsub!(/\[s\](.+?)\[\/s\]/i, '\1')
str.gsub!(/\[u\](.+?)\[\/u\]/i, '\1')
+ str.gsub!(/\[tn\](.+?)\[\/tn\]/i, '
\1
') str = parse_links(str) str = parse_aliased_wiki_links(str) diff --git a/db/structure.sql b/db/structure.sql index 38465995c..6d5aeaa1b 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -4364,10 +4364,10 @@ CREATE INDEX index_comments_on_body_index ON comments USING gin (body_index); -- --- Name: index_comments_on_creator_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_comments_on_creator_id_and_post_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- -CREATE INDEX index_comments_on_creator_id ON comments USING btree (creator_id); +CREATE INDEX index_comments_on_creator_id_and_post_id ON comments USING btree (creator_id, post_id); -- @@ -5897,10 +5897,10 @@ 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_and_post_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- -CREATE INDEX index_notes_on_creator_id ON notes USING btree (creator_id); +CREATE INDEX index_notes_on_creator_id_and_post_id ON notes USING btree (creator_id, post_id); -- @@ -6558,4 +6558,6 @@ INSERT INTO schema_migrations (version) VALUES ('20131006193238'); INSERT INTO schema_migrations (version) VALUES ('20131117150705'); -INSERT INTO schema_migrations (version) VALUES ('20131118153503'); \ No newline at end of file +INSERT INTO schema_migrations (version) VALUES ('20131118153503'); + +INSERT INTO schema_migrations (version) VALUES ('20131130190411'); \ No newline at end of file diff --git a/test/performance/browsing_test.rb b/test/performance/browsing_test.rb deleted file mode 100644 index a3dc38d9e..000000000 --- a/test/performance/browsing_test.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'test_helper' -require 'rails/performance_test_help' - -# Profiling results for each test method are written to tmp/performance. -class BrowsingTest < ActionController::PerformanceTest - def test_homepage - get '/' - end -end diff --git a/test/performance/dtext_test.rb b/test/performance/dtext_test.rb new file mode 100644 index 000000000..9e2c7f530 --- /dev/null +++ b/test/performance/dtext_test.rb @@ -0,0 +1,35 @@ +require 'test_helper' +require 'rails/performance_test_help' + +class DtextTest < ActionDispatch::PerformanceTest + self.profile_options = { + :runs => 5 + } + # Refer to the documentation for all available options + # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory] + # :output => 'tmp/performance', :formats => [:flat] } + + def setup + base_text = <<-EOS + [b]Lorem ipsum[/b] dolor sit amet, "consectetur":http://www.google.com adipisicing elit, sed do eiusmod + tempor incididunt ut labore et [[dolore]] [[magna|MAGNA]] aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco {{laboris}} nisi ut aliquip ex ea commodo + h1. consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non + [quote]proident, sunt in culpa qui officia deserunt mollit anim id est laborum.[/quote] + + * list of items + ** list of items + *** list of items + ** list of items user #1234 + * list of items post #1234 + + [spoiler]this is a spoiler[/spoiler] + EOS + @text = base_text * 1000 + end + + def test_parse + DText.parse(@text) + end +end