fembem-forem 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +14 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +21 -0
- data/Gemfile.lock +139 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +34 -0
- data/app/assets/images/forem/.gitkeep +0 -0
- data/app/assets/javascripts/forem/application.js +9 -0
- data/app/assets/stylesheets/forem/application.css +7 -0
- data/app/controllers/forem/application_controller.rb +14 -0
- data/app/controllers/forem/posts_controller.rb +24 -0
- data/app/controllers/forem/topics_controller.rb +27 -0
- data/app/helpers/forem/application_helper.rb +4 -0
- data/app/models/forem/post.rb +6 -0
- data/app/models/forem/topic.rb +22 -0
- data/app/views/forem/posts/_form.html.erb +4 -0
- data/app/views/forem/posts/_post.html.erb +6 -0
- data/app/views/forem/posts/new.html.erb +5 -0
- data/app/views/forem/topics/_form.html.erb +11 -0
- data/app/views/forem/topics/index.html.erb +26 -0
- data/app/views/forem/topics/new.html.erb +2 -0
- data/app/views/forem/topics/show.html.erb +6 -0
- data/app/views/layouts/forem/application.html.erb +18 -0
- data/bin/erubis +16 -0
- data/bin/rackup +16 -0
- data/bin/rails +16 -0
- data/bin/rake +16 -0
- data/bin/rake2thor +16 -0
- data/bin/rdoc +16 -0
- data/bin/ri +16 -0
- data/bin/thor +16 -0
- data/bin/tilt +16 -0
- data/bin/tt +16 -0
- data/config/routes.rb +9 -0
- data/db/migrate/20130722031947_create_forem_topics.rb +10 -0
- data/db/migrate/20130722033925_create_forem_posts.rb +11 -0
- data/db/migrate/20130722051123_add_posts_count_to_forem_topics.rb +5 -0
- data/fembem-forem.gemspec +28 -0
- data/lib/forem/engine.rb +19 -0
- data/lib/forem/version.rb +3 -0
- data/lib/forem.rb +8 -0
- data/lib/tasks/forem_tasks.rake +4 -0
- data/script/rails +6 -0
- data/spec/configuration_spec.rb +17 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/fake_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/user.rb +5 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config/application.rb +45 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +11 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +30 -0
- data/spec/dummy/config/environments/production.rb +60 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/forem.rb +1 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +7 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/migrate/20130722071025_create_users.rb +9 -0
- data/spec/dummy/db/schema.rb +38 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/integration/posts_spec.rb +60 -0
- data/spec/integration/topics_spec.rb +42 -0
- data/spec/spec_helper.rb +13 -0
- data/spec/support/capybara.rb +7 -0
- data/spec/support/dummy_login.rb +20 -0
- data/spec/support/load_routes.rb +6 -0
- metadata +219 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "posts" do
|
|
4
|
+
before do
|
|
5
|
+
@user = User.create!(:login => "some_guy")
|
|
6
|
+
@topic = Forem::Topic.new(:subject => "First topic!", :user => @user)
|
|
7
|
+
@topic.posts.build(:text => "First post!")
|
|
8
|
+
@topic.save!
|
|
9
|
+
end
|
|
10
|
+
context "unauthenticated users" do
|
|
11
|
+
before do
|
|
12
|
+
sign_out!
|
|
13
|
+
end
|
|
14
|
+
it "cannot access the new action" do
|
|
15
|
+
visit new_topic_post_path(@topic)
|
|
16
|
+
page.current_url.should eql(sign_in_url)
|
|
17
|
+
end
|
|
18
|
+
it "should see the post count and last post details" do
|
|
19
|
+
visit topics_path
|
|
20
|
+
within "#topics tbody td#posts_count" do
|
|
21
|
+
page.should have_content("1")
|
|
22
|
+
end
|
|
23
|
+
within "#topics tbody td#last_post" do
|
|
24
|
+
page.should have_content("last post was less than a minute ago by some_guy")
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
context "authenticated users" do
|
|
30
|
+
before do
|
|
31
|
+
sign_in!
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "reply to a topic" do
|
|
35
|
+
visit topics_path
|
|
36
|
+
click_link "First topic!"
|
|
37
|
+
|
|
38
|
+
within ".forem_topic #posts .forem_post" do
|
|
39
|
+
click_link "Reply"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
fill_in "Text", :with => "First reply!"
|
|
43
|
+
click_button "Create Post"
|
|
44
|
+
|
|
45
|
+
within "#flash_notice" do
|
|
46
|
+
page.should have_content("Post has been created!")
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
within ".forem_topic #posts .forem_post:last" do
|
|
50
|
+
page.should have_content("First reply!")
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
within ".forem_topic #posts .forem_post:last .user" do
|
|
54
|
+
page.should have_content("forem_user")
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "topics" do
|
|
4
|
+
|
|
5
|
+
context "authenticated users" do
|
|
6
|
+
before do
|
|
7
|
+
sign_in!
|
|
8
|
+
end
|
|
9
|
+
it "creating a new one" do
|
|
10
|
+
visit topics_path
|
|
11
|
+
click_link "New Topic"
|
|
12
|
+
fill_in "Subject", :with => "First topic!"
|
|
13
|
+
fill_in "Text", :with => "First post!"
|
|
14
|
+
click_button "Create Topic"
|
|
15
|
+
within "#flash_notice" do
|
|
16
|
+
page.should have_content("Topic has been created!")
|
|
17
|
+
end
|
|
18
|
+
within ".forem_topic #posts .forem_post" do
|
|
19
|
+
page.should have_content("First post!")
|
|
20
|
+
end
|
|
21
|
+
within ".forem_topic #posts .forem_post .user" do
|
|
22
|
+
page.should have_content("forem_user")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
context "unauthenticated users" do
|
|
28
|
+
before do
|
|
29
|
+
sign_out!
|
|
30
|
+
end
|
|
31
|
+
it "cannot see the 'New Topic' link" do
|
|
32
|
+
visit topics_path
|
|
33
|
+
page.should_not have_content("New Topic")
|
|
34
|
+
end
|
|
35
|
+
it "cannot begin to create a new topic" do
|
|
36
|
+
visit new_topic_path
|
|
37
|
+
page.current_url.should eql(sign_in_url)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Configure Rails Environment
|
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
|
3
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
|
4
|
+
require 'rspec/rails'
|
|
5
|
+
Rails.backtrace_cleaner.remove_silencers!
|
|
6
|
+
|
|
7
|
+
# Load support files
|
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
|
9
|
+
|
|
10
|
+
RSpec.configure do |config|
|
|
11
|
+
config.use_transactional_fixtures = true
|
|
12
|
+
end
|
|
13
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
def sign_out!
|
|
2
|
+
ApplicationController.class_eval <<-STRING
|
|
3
|
+
def current_user
|
|
4
|
+
nil
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
helper_method :current_user
|
|
8
|
+
STRING
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def sign_in!(options={})
|
|
12
|
+
ApplicationController.class_eval <<-STRING
|
|
13
|
+
def current_user
|
|
14
|
+
User.find_or_create_by_login("forem_user")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
helper_method :current_user
|
|
18
|
+
STRING
|
|
19
|
+
end
|
|
20
|
+
|
metadata
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: fembem-forem
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- Jim
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2013-07-22 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: rails
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
18
|
+
requirements:
|
|
19
|
+
- - ~>
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: 3.1.3
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ~>
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: 3.1.3
|
|
30
|
+
- !ruby/object:Gem::Dependency
|
|
31
|
+
name: sqlite3
|
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
none: false
|
|
34
|
+
requirements:
|
|
35
|
+
- - ! '>='
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
type: :development
|
|
39
|
+
prerelease: false
|
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
42
|
+
requirements:
|
|
43
|
+
- - ! '>='
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '0'
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: rspec-rails
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
none: false
|
|
50
|
+
requirements:
|
|
51
|
+
- - ~>
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '2.5'
|
|
54
|
+
type: :development
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
58
|
+
requirements:
|
|
59
|
+
- - ~>
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '2.5'
|
|
62
|
+
- !ruby/object:Gem::Dependency
|
|
63
|
+
name: capybara
|
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
|
65
|
+
none: false
|
|
66
|
+
requirements:
|
|
67
|
+
- - ! '>='
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '0'
|
|
70
|
+
type: :development
|
|
71
|
+
prerelease: false
|
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
+
none: false
|
|
74
|
+
requirements:
|
|
75
|
+
- - ! '>='
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: '0'
|
|
78
|
+
- !ruby/object:Gem::Dependency
|
|
79
|
+
name: launchy
|
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
|
81
|
+
none: false
|
|
82
|
+
requirements:
|
|
83
|
+
- - ! '>='
|
|
84
|
+
- !ruby/object:Gem::Version
|
|
85
|
+
version: '0'
|
|
86
|
+
type: :development
|
|
87
|
+
prerelease: false
|
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
+
none: false
|
|
90
|
+
requirements:
|
|
91
|
+
- - ! '>='
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: '0'
|
|
94
|
+
description: Description of Forem.
|
|
95
|
+
email:
|
|
96
|
+
- jim@jim.com
|
|
97
|
+
executables: []
|
|
98
|
+
extensions: []
|
|
99
|
+
extra_rdoc_files: []
|
|
100
|
+
files:
|
|
101
|
+
- .gitignore
|
|
102
|
+
- .ruby-gemset
|
|
103
|
+
- .ruby-version
|
|
104
|
+
- Gemfile
|
|
105
|
+
- Gemfile.lock
|
|
106
|
+
- MIT-LICENSE
|
|
107
|
+
- README.rdoc
|
|
108
|
+
- Rakefile
|
|
109
|
+
- app/assets/images/forem/.gitkeep
|
|
110
|
+
- app/assets/javascripts/forem/application.js
|
|
111
|
+
- app/assets/stylesheets/forem/application.css
|
|
112
|
+
- app/controllers/forem/application_controller.rb
|
|
113
|
+
- app/controllers/forem/posts_controller.rb
|
|
114
|
+
- app/controllers/forem/topics_controller.rb
|
|
115
|
+
- app/helpers/forem/application_helper.rb
|
|
116
|
+
- app/models/forem/post.rb
|
|
117
|
+
- app/models/forem/topic.rb
|
|
118
|
+
- app/views/forem/posts/_form.html.erb
|
|
119
|
+
- app/views/forem/posts/_post.html.erb
|
|
120
|
+
- app/views/forem/posts/new.html.erb
|
|
121
|
+
- app/views/forem/topics/_form.html.erb
|
|
122
|
+
- app/views/forem/topics/index.html.erb
|
|
123
|
+
- app/views/forem/topics/new.html.erb
|
|
124
|
+
- app/views/forem/topics/show.html.erb
|
|
125
|
+
- app/views/layouts/forem/application.html.erb
|
|
126
|
+
- bin/erubis
|
|
127
|
+
- bin/rackup
|
|
128
|
+
- bin/rails
|
|
129
|
+
- bin/rake
|
|
130
|
+
- bin/rake2thor
|
|
131
|
+
- bin/rdoc
|
|
132
|
+
- bin/ri
|
|
133
|
+
- bin/thor
|
|
134
|
+
- bin/tilt
|
|
135
|
+
- bin/tt
|
|
136
|
+
- config/routes.rb
|
|
137
|
+
- db/migrate/20130722031947_create_forem_topics.rb
|
|
138
|
+
- db/migrate/20130722033925_create_forem_posts.rb
|
|
139
|
+
- db/migrate/20130722051123_add_posts_count_to_forem_topics.rb
|
|
140
|
+
- fembem-forem.gemspec
|
|
141
|
+
- lib/forem.rb
|
|
142
|
+
- lib/forem/engine.rb
|
|
143
|
+
- lib/forem/version.rb
|
|
144
|
+
- lib/tasks/forem_tasks.rake
|
|
145
|
+
- script/rails
|
|
146
|
+
- spec/configuration_spec.rb
|
|
147
|
+
- spec/dummy/Rakefile
|
|
148
|
+
- spec/dummy/app/assets/javascripts/application.js
|
|
149
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
|
150
|
+
- spec/dummy/app/controllers/application_controller.rb
|
|
151
|
+
- spec/dummy/app/controllers/fake_controller.rb
|
|
152
|
+
- spec/dummy/app/helpers/application_helper.rb
|
|
153
|
+
- spec/dummy/app/mailers/.gitkeep
|
|
154
|
+
- spec/dummy/app/models/.gitkeep
|
|
155
|
+
- spec/dummy/app/models/user.rb
|
|
156
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
|
157
|
+
- spec/dummy/config.ru
|
|
158
|
+
- spec/dummy/config/application.rb
|
|
159
|
+
- spec/dummy/config/boot.rb
|
|
160
|
+
- spec/dummy/config/database.yml
|
|
161
|
+
- spec/dummy/config/environment.rb
|
|
162
|
+
- spec/dummy/config/environments/development.rb
|
|
163
|
+
- spec/dummy/config/environments/production.rb
|
|
164
|
+
- spec/dummy/config/environments/test.rb
|
|
165
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
|
166
|
+
- spec/dummy/config/initializers/forem.rb
|
|
167
|
+
- spec/dummy/config/initializers/inflections.rb
|
|
168
|
+
- spec/dummy/config/initializers/mime_types.rb
|
|
169
|
+
- spec/dummy/config/initializers/secret_token.rb
|
|
170
|
+
- spec/dummy/config/initializers/session_store.rb
|
|
171
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
|
172
|
+
- spec/dummy/config/locales/en.yml
|
|
173
|
+
- spec/dummy/config/routes.rb
|
|
174
|
+
- spec/dummy/db/migrate/20130722071025_create_users.rb
|
|
175
|
+
- spec/dummy/db/schema.rb
|
|
176
|
+
- spec/dummy/lib/assets/.gitkeep
|
|
177
|
+
- spec/dummy/log/.gitkeep
|
|
178
|
+
- spec/dummy/public/404.html
|
|
179
|
+
- spec/dummy/public/422.html
|
|
180
|
+
- spec/dummy/public/500.html
|
|
181
|
+
- spec/dummy/public/favicon.ico
|
|
182
|
+
- spec/dummy/script/rails
|
|
183
|
+
- spec/integration/posts_spec.rb
|
|
184
|
+
- spec/integration/topics_spec.rb
|
|
185
|
+
- spec/spec_helper.rb
|
|
186
|
+
- spec/support/capybara.rb
|
|
187
|
+
- spec/support/dummy_login.rb
|
|
188
|
+
- spec/support/load_routes.rb
|
|
189
|
+
homepage: http://www.jim.com
|
|
190
|
+
licenses: []
|
|
191
|
+
post_install_message:
|
|
192
|
+
rdoc_options: []
|
|
193
|
+
require_paths:
|
|
194
|
+
- lib
|
|
195
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
196
|
+
none: false
|
|
197
|
+
requirements:
|
|
198
|
+
- - ! '>='
|
|
199
|
+
- !ruby/object:Gem::Version
|
|
200
|
+
version: '0'
|
|
201
|
+
segments:
|
|
202
|
+
- 0
|
|
203
|
+
hash: -228315219
|
|
204
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
|
+
none: false
|
|
206
|
+
requirements:
|
|
207
|
+
- - ! '>='
|
|
208
|
+
- !ruby/object:Gem::Version
|
|
209
|
+
version: '0'
|
|
210
|
+
segments:
|
|
211
|
+
- 0
|
|
212
|
+
hash: -228315219
|
|
213
|
+
requirements: []
|
|
214
|
+
rubyforge_project:
|
|
215
|
+
rubygems_version: 1.8.25
|
|
216
|
+
signing_key:
|
|
217
|
+
specification_version: 3
|
|
218
|
+
summary: Summary of Forem.
|
|
219
|
+
test_files: []
|