concen 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -2
- data/Gemfile.lock +6 -4
- data/README.md +41 -44
- data/app/views/concen/performances/_runtimes.html.erb +1 -1
- data/app/views/concen/users/index.html.erb +1 -0
- data/concen.gemspec +1 -1
- data/lib/concen/version.rb +1 -1
- data/test/integration/navigation_test.rb +7 -7
- data/test/support/integration_case.rb +5 -5
- data/test/test_helper.rb +1 -0
- data/test/unit/concen_test.rb +5 -7
- data/test/unit/grid_file_test.rb +16 -16
- data/test/unit/page_test.rb +66 -67
- data/test/unit/user_test.rb +24 -26
- metadata +23 -23
data/Gemfile
CHANGED
@@ -5,7 +5,7 @@ gem "sass-rails", "~> 3.1.3"
|
|
5
5
|
|
6
6
|
# gemspec.
|
7
7
|
gem "mustache", "~> 0.99.4"
|
8
|
-
gem "redcarpet", "2.
|
8
|
+
gem "redcarpet", "2.1.0"
|
9
9
|
gem "mongoid", "~> 2.2"
|
10
10
|
gem "mongo", "~> 1.3"
|
11
11
|
gem "bson_ext", "~> 1.4.0"
|
@@ -20,4 +20,4 @@ gem "domainatrix", "~> 0.0.10"
|
|
20
20
|
gem "capybara", ">= 0.4.0"
|
21
21
|
gem "fabrication", "1.1.0"
|
22
22
|
gem "database_cleaner", "0.6.0"
|
23
|
-
gem "
|
23
|
+
gem "turn", "0.8.3"
|
data/Gemfile.lock
CHANGED
@@ -31,6 +31,7 @@ GEM
|
|
31
31
|
activesupport (3.1.0)
|
32
32
|
multi_json (~> 1.0)
|
33
33
|
addressable (2.2.6)
|
34
|
+
ansi (1.3.0)
|
34
35
|
arel (2.2.1)
|
35
36
|
bcrypt-ruby (3.0.0)
|
36
37
|
bson (1.4.0)
|
@@ -60,7 +61,6 @@ GEM
|
|
60
61
|
mime-types (~> 1.16)
|
61
62
|
treetop (~> 1.4.8)
|
62
63
|
mime-types (1.16)
|
63
|
-
minitest (2.6.1)
|
64
64
|
mongo (1.4.0)
|
65
65
|
bson (= 1.4.0)
|
66
66
|
mongo-rails-instrumentation (0.2.4)
|
@@ -102,7 +102,7 @@ GEM
|
|
102
102
|
thor (~> 0.14.6)
|
103
103
|
rake (0.9.2)
|
104
104
|
rdoc (3.9.4)
|
105
|
-
redcarpet (2.
|
105
|
+
redcarpet (2.1.0)
|
106
106
|
rubyzip (0.9.4)
|
107
107
|
sass (3.1.7)
|
108
108
|
sass-rails (3.1.3)
|
@@ -125,6 +125,8 @@ GEM
|
|
125
125
|
treetop (1.4.10)
|
126
126
|
polyglot
|
127
127
|
polyglot (>= 0.3.1)
|
128
|
+
turn (0.8.3)
|
129
|
+
ansi
|
128
130
|
tzinfo (0.3.29)
|
129
131
|
xpath (0.1.4)
|
130
132
|
nokogiri (~> 1.3)
|
@@ -141,12 +143,12 @@ DEPENDENCIES
|
|
141
143
|
domainatrix (~> 0.0.10)
|
142
144
|
fabrication (= 1.1.0)
|
143
145
|
mime-types (~> 1.16)
|
144
|
-
minitest (~> 2.6.1)
|
145
146
|
mongo (~> 1.3)
|
146
147
|
mongo-rails-instrumentation (~> 0.2.4)
|
147
148
|
mongoid (~> 2.2)
|
148
149
|
mustache (~> 0.99.4)
|
149
150
|
rack-gridfs (~> 0.4.1)
|
150
151
|
rails (>= 3.1.0)
|
151
|
-
redcarpet (= 2.
|
152
|
+
redcarpet (= 2.1.0)
|
152
153
|
sass-rails (~> 3.1.3)
|
154
|
+
turn (= 0.8.3)
|
data/README.md
CHANGED
@@ -1,24 +1,18 @@
|
|
1
1
|
# Concen
|
2
2
|
|
3
|
-
Concen is a Rails Engine for
|
3
|
+
Concen is a Rails Engine for managing and monitoring a Rails application from a web interface. It includes content management system, real-time traffic monitoring, and real-time performance monitoring. It's built to be flexible and customizable to fit custom needs.
|
4
4
|
|
5
5
|
## Requirements
|
6
6
|
|
7
7
|
- **Rails 3.1**. Concen only supports Rails 3.1 application.
|
8
|
-
- **MongoDB
|
9
|
-
- **Typekit** (optional). Concen uses [Proxima Nova](http://typekit.com/fonts/proxima-nova) font. This font can be obtained from Typekit.
|
8
|
+
- **MongoDB 2.0.x**. All data are stored in MongoDB database, including all of the files uploaded (stored in GridFS).
|
9
|
+
- **Typekit** (optional). Concen uses [Proxima Nova](http://typekit.com/fonts/proxima-nova) font. This font can be easily obtained from Typekit.
|
10
10
|
|
11
11
|
## Installation
|
12
12
|
|
13
13
|
Add the following to the Gemfile of a Rails application.
|
14
14
|
|
15
|
-
gem "concen", "~> 0.
|
16
|
-
|
17
|
-
Concen uses Compass to generate its stylesheets so include Compass' gem in assets group in the Gemfile. If you face a problem when precompiling the assets, it's most likely because Compass' gem isn't included in the Gemfile.
|
18
|
-
|
19
|
-
group :assets do
|
20
|
-
gem "compass", "~> 0.12.alpha"
|
21
|
-
end
|
15
|
+
gem "concen", "~> 0.2.6"
|
22
16
|
|
23
17
|
Run the rake task to setup Concen.
|
24
18
|
|
@@ -26,11 +20,9 @@ Run the rake task to setup Concen.
|
|
26
20
|
|
27
21
|
Follow the brief guide upon completion of the rake task.
|
28
22
|
|
29
|
-
## Content
|
23
|
+
## Content Management System
|
30
24
|
|
31
|
-
|
32
|
-
|
33
|
-
The CCS itself has a simple text editor and a simple file uploader. Contents these days are not only in the form of text but also images, audios and videos. CCS offers a quick and easy way to capture all of them.
|
25
|
+
Most of the Rails applications will likely need a Content Management System (CMS) at some point or another. It could be for a blog or just static content. For the static content, it is very simple to write in the Rails views. If the programmer was the writer himself, this approach is very straight forward. But often the writers are not programmers. Concen allows the writers to write the content easily from day one. Then, programmers can programatically include this content in the Rails views. The CMS itself has a simple text editor and a simple file uploader. Content can be represented in the form of text and files (images, videos, sounds, etc).
|
34
26
|
|
35
27
|
Back to the Rails application, the developer/programmer could place these contents in the views. For example with the following method call.
|
36
28
|
|
@@ -47,9 +39,9 @@ Generating static content should not be performed for every request because it i
|
|
47
39
|
expires_in 5.minutes, :public => true
|
48
40
|
fresh_when :etag => @article, :public => true
|
49
41
|
|
50
|
-
## Writing Style for Content
|
42
|
+
## Writing Style for Content Management System
|
51
43
|
|
52
|
-
There are no rules enforced for writing content
|
44
|
+
There are no rules enforced for writing content in the CMS. But there are certain writing styles that will help writing content more convenient and manageable.
|
53
45
|
|
54
46
|
Here is an example with single-segment content.
|
55
47
|
|
@@ -134,47 +126,52 @@ If you have used Concen for any of your websites and would like to be listed her
|
|
134
126
|
|
135
127
|
## Versions
|
136
128
|
|
129
|
+
- **0.2.7**:
|
130
|
+
- Better time formatting
|
131
|
+
- Show full name in user list
|
132
|
+
- Update Redcarpet to version 2.1.0
|
133
|
+
|
137
134
|
- **0.2.6**:
|
138
|
-
- Update Redcarpet to version 2.0.0
|
135
|
+
- Update Redcarpet to version 2.0.0
|
139
136
|
|
140
137
|
- **0.2.5**:
|
141
138
|
|
142
|
-
- Temporary fix for Redcarpet's smartypants extension
|
143
|
-
- Minor color changes
|
144
|
-
- Remove Compass dependency
|
145
|
-
- Remove Haml dependency
|
139
|
+
- Temporary fix for Redcarpet's smartypants extension
|
140
|
+
- Minor color changes
|
141
|
+
- Remove Compass dependency
|
142
|
+
- Remove Haml dependency
|
146
143
|
|
147
144
|
- **0.2.4**:
|
148
145
|
|
149
|
-
- Set Mongoid dependency at "~> 2.2" for flexibility
|
150
|
-
- The fields for Concen::Response are now predefined
|
146
|
+
- Set Mongoid dependency at "~> 2.2" for flexibility
|
147
|
+
- The fields for Concen::Response are now predefined
|
151
148
|
|
152
149
|
- **0.2.3**:
|
153
150
|
|
154
|
-
- Update Mongoid version (2.2.2)
|
155
|
-
- UI design enhancements
|
156
|
-
- Tests are now using MiniTest
|
157
|
-
- Add ancestor_slugs field for Page model
|
158
|
-
- Page is given a default title if none is present
|
151
|
+
- Update Mongoid version (2.2.2)
|
152
|
+
- UI design enhancements
|
153
|
+
- Tests are now using MiniTest
|
154
|
+
- Add ancestor_slugs field for Page model
|
155
|
+
- Page is given a default title if none is present
|
159
156
|
|
160
157
|
- **0.2.2**:
|
161
158
|
|
162
|
-
- Update Chronic gem dependency
|
163
|
-
- Fix set_position and reset_position
|
159
|
+
- Update Chronic gem dependency
|
160
|
+
- Fix set_position and reset_position
|
164
161
|
|
165
162
|
- **0.2.1**:
|
166
163
|
|
167
|
-
- Minor bug fixes
|
168
|
-
- Update jQuery to 1.6.4
|
169
|
-
- Update Redcarpet to 2.0.0b5 (fixes for inline HTML bug in Markdown parser)
|
164
|
+
- Minor bug fixes
|
165
|
+
- Update jQuery to 1.6.4
|
166
|
+
- Update Redcarpet to 2.0.0b5 (fixes for inline HTML bug in Markdown parser)
|
170
167
|
|
171
168
|
- **0.2.0**:
|
172
169
|
|
173
|
-
- Rails 3.1 compatibility
|
170
|
+
- Rails 3.1 compatibility
|
174
171
|
|
175
172
|
- **0.1.7**:
|
176
173
|
|
177
|
-
- Fix installation error when using Ruby 1.8.7
|
174
|
+
- Fix installation error when using Ruby 1.8.7
|
178
175
|
|
179
176
|
- **0.1.6**:
|
180
177
|
|
@@ -186,22 +183,22 @@ If you have used Concen for any of your websites and would like to be listed her
|
|
186
183
|
|
187
184
|
- **0.1.4**:
|
188
185
|
|
189
|
-
- Simpler setup process (only in 2 steps)
|
190
|
-
- Brief guide is available upon the completion of setup
|
191
|
-
- Fix a bug in file path drag and drop function
|
186
|
+
- Simpler setup process (only in 2 steps)
|
187
|
+
- Brief guide is available upon the completion of setup
|
188
|
+
- Fix a bug in file path drag and drop function
|
192
189
|
|
193
|
-
- **0.1.3**: Minor bug fixes
|
190
|
+
- **0.1.3**: Minor bug fixes
|
194
191
|
|
195
|
-
- **0.1.2**: Minor bug fixes
|
192
|
+
- **0.1.2**: Minor bug fixes
|
196
193
|
|
197
|
-
- **0.1.1**: Minor bug fixes
|
194
|
+
- **0.1.1**: Minor bug fixes
|
198
195
|
|
199
|
-
- **0.1**: Initial release
|
196
|
+
- **0.1**: Initial release
|
200
197
|
|
201
198
|
## Upcoming Features
|
202
199
|
|
203
|
-
- Time range selection in traffic statistics
|
204
|
-
- Time range selection in performance statistics
|
200
|
+
- Time range selection in traffic statistics
|
201
|
+
- Time range selection in performance statistics
|
205
202
|
|
206
203
|
## License
|
207
204
|
|
@@ -25,6 +25,7 @@
|
|
25
25
|
<% for user in @users %>
|
26
26
|
<tr>
|
27
27
|
<td><%= user.username %></td>
|
28
|
+
<td><%= user.full_name %></td>
|
28
29
|
<td><%= user.email %></td>
|
29
30
|
<td><%= user.created_at.strftime("%d %B %Y") %></td>
|
30
31
|
<td><%= Concen::Page.where(:authors.in => [user.username, user.full_name, user.email]).count %></td>
|
data/concen.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.require_paths = ["lib"]
|
23
23
|
|
24
24
|
s.add_dependency("mustache", "~> 0.99.4")
|
25
|
-
s.add_dependency("redcarpet", "~> 2.
|
25
|
+
s.add_dependency("redcarpet", "~> 2.1.0")
|
26
26
|
s.add_dependency("mongoid", "~> 2.2")
|
27
27
|
s.add_dependency("bson_ext", "~> 1.3")
|
28
28
|
s.add_dependency("mongo-rails-instrumentation", "~> 0.2.4")
|
data/lib/concen/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
class NavigationTest < ActiveSupport::IntegrationCase
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
end
|
1
|
+
# require "test_helper"
|
2
|
+
#
|
3
|
+
# class NavigationTest < ActiveSupport::IntegrationCase
|
4
|
+
# test "truth" do
|
5
|
+
# assert_kind_of Dummy::Application, Rails.application
|
6
|
+
# end
|
7
|
+
# end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Define a bare test case to use with Capybara
|
2
|
-
class ActiveSupport::IntegrationCase < ActiveSupport::TestCase
|
3
|
-
|
4
|
-
|
5
|
-
end
|
1
|
+
# # Define a bare test case to use with Capybara
|
2
|
+
# class ActiveSupport::IntegrationCase < ActiveSupport::TestCase
|
3
|
+
# include Capybara
|
4
|
+
# include Rails.application.routes.url_helpers
|
5
|
+
# end
|
data/test/test_helper.rb
CHANGED
@@ -5,6 +5,7 @@ require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
|
5
5
|
require File.expand_path("../fabricators.rb", __FILE__)
|
6
6
|
require "rails/test_help"
|
7
7
|
require "database_cleaner"
|
8
|
+
require "turn"
|
8
9
|
|
9
10
|
ActionMailer::Base.delivery_method = :test
|
10
11
|
ActionMailer::Base.perform_deliveries = true
|
data/test/unit/concen_test.rb
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
require "test_helper"
|
2
|
-
require "minitest/spec"
|
3
|
-
require "minitest/autorun"
|
4
2
|
|
5
|
-
|
6
|
-
|
3
|
+
class ConcenTest < ActiveSupport::TestCase
|
4
|
+
def setup
|
7
5
|
DatabaseCleaner.clean
|
8
6
|
end
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
|
8
|
+
test "must be a Module" do
|
9
|
+
assert_kind_of Module, Concen
|
12
10
|
end
|
13
11
|
end
|
data/test/unit/grid_file_test.rb
CHANGED
@@ -1,47 +1,47 @@
|
|
1
1
|
require "test_helper"
|
2
|
-
require "minitest/spec"
|
3
|
-
require "minitest/autorun"
|
4
2
|
|
5
|
-
|
6
|
-
|
3
|
+
class GridFileTest < ActiveSupport::TestCase
|
4
|
+
def setup
|
7
5
|
DatabaseCleaner.clean
|
8
6
|
end
|
9
|
-
|
10
|
-
|
7
|
+
|
8
|
+
test "can store file in GridFS" do
|
11
9
|
page = Fabricate "concen/page"
|
12
10
|
grid_file = page.grid_files.build
|
13
11
|
grid_file.store File.read("#{Rails.root}/public/404.html"), "404.html"
|
14
|
-
|
12
|
+
assert_equal File.read("#{Rails.root}/public/404.html"), grid_file.read
|
15
13
|
end
|
16
14
|
|
17
|
-
|
15
|
+
test "must delete file from GridFS when page is deleted" do
|
18
16
|
page = Fabricate "concen/page"
|
19
17
|
grid_file = page.grid_files.build
|
20
18
|
grid_file.store File.read("#{Rails.root}/public/404.html"), "404.html"
|
21
19
|
grid_id = grid_file.grid_id.dup
|
22
20
|
page.destroy
|
23
21
|
grid = Mongo::Grid.new Mongoid.database
|
24
|
-
|
22
|
+
assert_raise(Mongo::GridFileNotFound) { grid.get(grid_id).read }
|
25
23
|
end
|
26
24
|
|
27
|
-
|
25
|
+
test "must delete associated grid_file when page is deleted" do
|
28
26
|
page = Fabricate "concen/page"
|
29
27
|
grid_file = page.grid_files.build
|
30
28
|
grid_file.store File.read("#{Rails.root}/public/404.html"), "404.html"
|
29
|
+
refute_nil page.grid_files.where(:_id => grid_file.id).first
|
31
30
|
page.destroy
|
31
|
+
assert_nil page.grid_files.where(:_id => grid_file.id).first
|
32
32
|
end
|
33
|
-
|
34
|
-
|
33
|
+
|
34
|
+
test "must store correct original_filename" do
|
35
35
|
page = Fabricate "concen/page"
|
36
36
|
grid_file = page.grid_files.build
|
37
37
|
grid_file.store File.read("#{Rails.root}/public/404.html"), "404.html"
|
38
|
-
|
38
|
+
assert_equal "404.html", grid_file.original_filename
|
39
39
|
end
|
40
|
-
|
41
|
-
|
40
|
+
|
41
|
+
test "must include id in filename" do
|
42
42
|
page = Fabricate "concen/page"
|
43
43
|
grid_file = page.grid_files.build
|
44
44
|
grid_file.store File.read("#{Rails.root}/public/404.html"), "404.html"
|
45
|
-
grid_file.filename.
|
45
|
+
assert grid_file.filename.include?(grid_file.grid_id.to_s)
|
46
46
|
end
|
47
47
|
end
|
data/test/unit/page_test.rb
CHANGED
@@ -1,164 +1,163 @@
|
|
1
1
|
require "test_helper"
|
2
|
-
require "minitest/spec"
|
3
|
-
require "minitest/autorun"
|
4
2
|
|
5
|
-
|
6
|
-
|
3
|
+
class ConcenTest < ActiveSupport::TestCase
|
4
|
+
def setup
|
7
5
|
DatabaseCleaner.clean
|
8
6
|
end
|
9
|
-
|
10
|
-
|
7
|
+
|
8
|
+
test "can create page" do
|
11
9
|
page = Fabricate "concen/page"
|
12
|
-
page.id
|
10
|
+
refute_nil page.id
|
13
11
|
end
|
14
12
|
|
15
|
-
|
13
|
+
test "can create child page" do
|
16
14
|
page = Fabricate "concen/page"
|
17
15
|
child_page = page.children.create :title => "1984"
|
18
|
-
child_page.id
|
19
|
-
|
16
|
+
refute_nil child_page.id
|
17
|
+
assert_equal child_page.parent.id, page.id
|
20
18
|
end
|
21
19
|
|
22
|
-
|
20
|
+
test "must parse title from raw_text" do
|
23
21
|
page = Fabricate "concen/page", :title => nil, :raw_text => "Title: Page Title"
|
24
|
-
|
22
|
+
assert_equal "Page Title", page.title
|
25
23
|
end
|
26
24
|
|
27
|
-
|
25
|
+
test "must get default title when none is present" do
|
28
26
|
page = Fabricate "concen/page", :title => nil
|
29
|
-
|
27
|
+
assert_equal "Untitled 1", page.title
|
30
28
|
end
|
31
29
|
|
32
|
-
|
30
|
+
test "validates uniqueness of title" do
|
33
31
|
parent_page = Fabricate "concen/page", :title => "Parent"
|
34
32
|
child_page_1 = parent_page.children.create :title => "Child"
|
35
33
|
child_page_2 = parent_page.children.build :title => "Child"
|
36
|
-
|
37
|
-
child_page_2.errors[:title].first
|
34
|
+
assert_raise(Mongoid::Errors::Validations) { child_page_2.save! }
|
35
|
+
assert_equal "is already taken", child_page_2.errors[:title].first
|
38
36
|
end
|
39
37
|
|
40
|
-
|
38
|
+
test "must parse publish_time from raw_text" do
|
41
39
|
raw_text = "Title: Page Title 2\n\nPublish Time: now"
|
42
40
|
page = Fabricate "concen/page", :title => nil, :raw_text => raw_text
|
43
|
-
page.publish_time
|
44
|
-
page.raw_text
|
41
|
+
refute_nil page.publish_time
|
42
|
+
refute_equal raw_text, page.raw_text
|
43
|
+
assert page.raw_text.include?(Time.now.utc.strftime("%Y-%m-%d"))
|
45
44
|
end
|
46
45
|
|
47
|
-
|
46
|
+
test "must parse multi content from raw_text and conver to html correctly" do
|
48
47
|
raw_text = File.read "#{File.dirname(__FILE__)}/../support/raw_text/multi_content.txt"
|
49
48
|
html = File.read("#{File.dirname(__FILE__)}/../support/raw_text/multi_content.html")
|
50
49
|
page = Fabricate "concen/page", :title => nil, :raw_text => raw_text
|
51
|
-
page.content
|
52
|
-
|
53
|
-
page.content_in_html("part_1")
|
54
|
-
page.content_in_html("part_2")
|
55
|
-
(page.content_in_html("part_1") + page.content_in_html("part_2"))
|
50
|
+
refute_nil page.content
|
51
|
+
assert_equal ["part_1", "part_2"], page.content.keys
|
52
|
+
refute_nil page.content_in_html("part_1")
|
53
|
+
refute_nil page.content_in_html("part_2")
|
54
|
+
assert_equal html, (page.content_in_html("part_1") + page.content_in_html("part_2"))
|
56
55
|
end
|
57
56
|
|
58
|
-
|
57
|
+
test "must parse content with SmartyPants supported entities and convert to html correctly" do
|
59
58
|
raw_text_smartypants = File.read "#{File.dirname(__FILE__)}/../support/raw_text/smartypants.txt"
|
60
59
|
raw_text_smartypants_escape = File.read "#{File.dirname(__FILE__)}/../support/raw_text/smartypants_escape.txt"
|
61
|
-
raw_text_smartypants
|
62
|
-
raw_text_smartypants_escape
|
60
|
+
refute_nil raw_text_smartypants
|
61
|
+
refute_nil raw_text_smartypants_escape
|
63
62
|
|
64
63
|
page1 = Fabricate "concen/page", :title => nil, :raw_text => raw_text_smartypants
|
65
|
-
|
66
|
-
|
64
|
+
assert_equal page1.content_in_html("main"), page1.content_in_html
|
65
|
+
assert_equal File.read("#{File.dirname(__FILE__)}/../support/raw_text/smartypants.html"), page1.content_in_html
|
67
66
|
|
68
67
|
page2 = Fabricate "concen/page", :title => nil, :raw_text => raw_text_smartypants_escape
|
69
|
-
|
70
|
-
|
68
|
+
assert_equal page2.content_in_html("main"), page2.content_in_html
|
69
|
+
assert_equal File.read("#{File.dirname(__FILE__)}/../support/raw_text/smartypants_escape.html"), page2.content_in_html
|
71
70
|
end
|
72
71
|
|
73
|
-
|
72
|
+
test "must parse content with code blocks and convert to html correctly" do
|
74
73
|
raw_text_code_blocks = File.read "#{File.dirname(__FILE__)}/../support/raw_text/code_blocks.txt"
|
75
|
-
raw_text_code_blocks
|
74
|
+
refute_nil raw_text_code_blocks
|
76
75
|
|
77
76
|
page = Fabricate "concen/page", :title => nil, :raw_text => raw_text_code_blocks
|
78
|
-
|
79
|
-
|
77
|
+
assert_equal page.content_in_html("main"), page.content_in_html
|
78
|
+
assert_equal File.read("#{File.dirname(__FILE__)}/../support/raw_text/code_blocks.html"), page.content_in_html
|
80
79
|
end
|
81
80
|
|
82
|
-
|
81
|
+
test "must parse content with inline HTML and convert to html correctly" do
|
83
82
|
raw_text_code_blocks = File.read "#{File.dirname(__FILE__)}/../support/raw_text/inline_html.txt"
|
84
|
-
raw_text_code_blocks
|
83
|
+
refute_nil raw_text_code_blocks
|
85
84
|
|
86
85
|
page = Fabricate "concen/page", :title => nil, :raw_text => raw_text_code_blocks
|
87
|
-
|
88
|
-
|
86
|
+
assert_equal page.content_in_html("main"), page.content_in_html
|
87
|
+
assert_equal File.read("#{File.dirname(__FILE__)}/../support/raw_text/inline_html.html"), page.content_in_html
|
89
88
|
end
|
90
89
|
|
91
|
-
|
90
|
+
test "has slug automatically generated" do
|
92
91
|
page1 = Fabricate "concen/page", :title => "Something New"
|
93
|
-
|
92
|
+
assert_equal "something-new", page1.slug
|
94
93
|
|
95
94
|
page2 = Fabricate.build "concen/page", :title => nil
|
96
95
|
page2.raw_text = File.read "#{File.dirname(__FILE__)}/../support/raw_text/title.txt"
|
97
96
|
page2.save
|
98
|
-
|
97
|
+
assert_equal "something-new", page2.slug
|
99
98
|
end
|
100
99
|
|
101
|
-
|
100
|
+
test "must be able to set slug from raw_text" do
|
102
101
|
page = Fabricate.build "concen/page", :title => nil
|
103
102
|
page.raw_text = File.read "#{File.dirname(__FILE__)}/../support/raw_text/slug.txt"
|
104
103
|
page.save
|
105
|
-
|
104
|
+
assert_equal "something-else", page.slug
|
106
105
|
end
|
107
106
|
|
108
|
-
|
107
|
+
test "has authors" do
|
109
108
|
page = Fabricate.build "concen/page", :authors => ["user1", "user2", "user3"]
|
110
|
-
page.authors.count
|
109
|
+
assert_equal 3, page.authors.count
|
111
110
|
end
|
112
111
|
|
113
|
-
|
112
|
+
test "must get correct author_as_user" do
|
114
113
|
user = Fabricate "concen/user"
|
115
114
|
page = Fabricate.build "concen/page", :authors => [user.username, "user2"]
|
116
|
-
page.authors.count
|
117
|
-
page.authors_as_user.count
|
118
|
-
page.authors_as_user.
|
115
|
+
assert_equal 2, page.authors.count
|
116
|
+
assert_equal 1, page.authors_as_user.count
|
117
|
+
assert page.authors_as_user.include?(user.reload)
|
119
118
|
end
|
120
119
|
|
121
|
-
|
120
|
+
test "must get the correct slug" do
|
122
121
|
page = Fabricate "concen/page", :title => "New Title"
|
123
|
-
|
122
|
+
assert_equal "new-title", page.slug
|
124
123
|
page.write_attribute :slug, "new-slug"
|
125
124
|
page.save
|
126
|
-
|
125
|
+
assert_equal "new-slug", page.slug
|
127
126
|
end
|
128
127
|
|
129
|
-
|
128
|
+
test "must set/reset position correctly" do
|
130
129
|
page = Fabricate "concen/page"
|
131
130
|
child_page_1 = page.children.create :title => "Position 1"
|
132
|
-
child_page_1.position
|
131
|
+
assert_equal 1, child_page_1.position
|
133
132
|
|
134
133
|
child_page_2 = page.children.create :title => "Position 2"
|
135
|
-
child_page_2.position
|
134
|
+
assert_equal 2, child_page_2.position
|
136
135
|
|
137
136
|
child_page_3 = page.children.create :title => "Position 3"
|
138
|
-
child_page_3.position
|
137
|
+
assert_equal 3, child_page_3.position
|
139
138
|
|
140
139
|
child_page_2.destroy
|
141
|
-
child_page_3.reload.position
|
140
|
+
assert_equal 2, child_page_3.reload.position
|
142
141
|
end
|
143
142
|
|
144
|
-
|
143
|
+
test "must have ancestor_slugs" do
|
145
144
|
page_1 = Fabricate "concen/page", :title => "A"
|
146
145
|
|
147
146
|
page_2 = page_1.children.create :title => "B"
|
148
|
-
|
147
|
+
assert_equal ["a"], page_2.ancestor_slugs
|
149
148
|
|
150
149
|
page_3 = page_2.children.create :title => "C"
|
151
|
-
|
150
|
+
assert_equal ["a", "b"], page_3.ancestor_slugs
|
152
151
|
end
|
153
152
|
|
154
|
-
|
153
|
+
test "must have level" do
|
155
154
|
page_1 = Fabricate "concen/page", :title => "A"
|
156
|
-
page_1.level
|
155
|
+
assert_equal 0, page_1.level
|
157
156
|
|
158
157
|
page_2 = page_1.children.create :title => "B"
|
159
|
-
page_2.level
|
158
|
+
assert_equal 1, page_2.level
|
160
159
|
|
161
160
|
page_3 = page_2.children.create :title => "C"
|
162
|
-
page_3.level
|
161
|
+
assert_equal 2, page_3.level
|
163
162
|
end
|
164
163
|
end
|
data/test/unit/user_test.rb
CHANGED
@@ -1,50 +1,48 @@
|
|
1
1
|
require "test_helper"
|
2
|
-
require "minitest/spec"
|
3
|
-
require "minitest/autorun"
|
4
2
|
|
5
|
-
|
6
|
-
|
3
|
+
class UserTest < ActiveSupport::TestCase
|
4
|
+
def setup
|
7
5
|
DatabaseCleaner.clean
|
8
6
|
end
|
9
|
-
|
10
|
-
|
7
|
+
|
8
|
+
test "can create user" do
|
11
9
|
user = Fabricate "concen/user"
|
12
|
-
user.id
|
10
|
+
assert_not_nil user.id
|
13
11
|
end
|
14
12
|
|
15
|
-
|
13
|
+
test "has password_digest" do
|
16
14
|
user = Fabricate "concen/user"
|
17
|
-
user.password_digest
|
15
|
+
assert_not_nil user.password_digest
|
18
16
|
end
|
19
17
|
|
20
|
-
|
18
|
+
test "has auth_token" do
|
21
19
|
user = Fabricate "concen/user"
|
22
|
-
user.auth_token
|
20
|
+
assert_not_nil user.auth_token
|
23
21
|
end
|
24
22
|
|
25
|
-
|
23
|
+
test "has username" do
|
26
24
|
user = Fabricate.build "concen/user", :username => nil
|
27
|
-
|
28
|
-
|
25
|
+
assert_raise(Mongoid::Errors::Validations) { user.save! }
|
26
|
+
assert_equal "can't be blank", user.errors[:username].first
|
29
27
|
end
|
30
|
-
|
31
|
-
|
28
|
+
|
29
|
+
test "has email" do
|
32
30
|
user = Fabricate.build "concen/user", :email => nil
|
33
|
-
|
34
|
-
|
31
|
+
assert_raise(Mongoid::Errors::Validations) { user.save! }
|
32
|
+
assert_equal "can't be blank", user.errors[:email].first
|
35
33
|
end
|
36
|
-
|
37
|
-
|
34
|
+
|
35
|
+
test "has full_name" do
|
38
36
|
user = Fabricate.build("concen/user", :full_name => nil)
|
39
|
-
|
40
|
-
|
37
|
+
assert_raise(Mongoid::Errors::Validations) { user.save! }
|
38
|
+
assert_equal "can't be blank", user.errors[:full_name].first
|
41
39
|
end
|
42
|
-
|
43
|
-
|
40
|
+
|
41
|
+
test "must authenticate user" do
|
44
42
|
password = {:password => "newpassword", :password_confirmation => "newpassword"}
|
45
43
|
user = Fabricate "concen/user", password
|
46
44
|
authenticated_user = user.authenticate("newpassword")
|
47
|
-
|
48
|
-
|
45
|
+
refute_equal false, authenticated_user
|
46
|
+
assert_instance_of Concen::User, authenticated_user
|
49
47
|
end
|
50
48
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mustache
|
16
|
-
requirement: &
|
16
|
+
requirement: &70205435655000 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,21 +21,21 @@ dependencies:
|
|
21
21
|
version: 0.99.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70205435655000
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: redcarpet
|
27
|
-
requirement: &
|
27
|
+
requirement: &70205435649660 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 2.
|
32
|
+
version: 2.1.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70205435649660
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: mongoid
|
38
|
-
requirement: &
|
38
|
+
requirement: &70205435649180 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '2.2'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70205435649180
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bson_ext
|
49
|
-
requirement: &
|
49
|
+
requirement: &70205435648720 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '1.3'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70205435648720
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: mongo-rails-instrumentation
|
60
|
-
requirement: &
|
60
|
+
requirement: &70205435648260 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.2.4
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70205435648260
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rack-gridfs
|
71
|
-
requirement: &
|
71
|
+
requirement: &70205435647780 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.4.1
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70205435647780
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: chronic
|
82
|
-
requirement: &
|
82
|
+
requirement: &70205435647120 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 0.6.3
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70205435647120
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: mime-types
|
93
|
-
requirement: &
|
93
|
+
requirement: &70205435646440 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '1.16'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70205435646440
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: bcrypt-ruby
|
104
|
-
requirement: &
|
104
|
+
requirement: &70205435645540 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: 3.0.0
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70205435645540
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: domainatrix
|
115
|
-
requirement: &
|
115
|
+
requirement: &70205435644880 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
@@ -120,7 +120,7 @@ dependencies:
|
|
120
120
|
version: 0.0.10
|
121
121
|
type: :runtime
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70205435644880
|
124
124
|
description: A Rails Engine to control and monitor Rails application from a web interface.
|
125
125
|
It includes content capturing system, real-time traffic monitoring, and real-time
|
126
126
|
performance monitoring. It is built to be flexible and customizable.
|