ticketee-forem 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +144 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +17 -0
- data/app/assets/images/.gitkeep +0 -0
- data/app/assets/javascripts/application.js +11 -0
- data/app/assets/javascripts/forem/posts.js +2 -0
- data/app/assets/javascripts/forem/topics.js +2 -0
- data/app/assets/stylesheets/application.css +7 -0
- data/app/assets/stylesheets/forem/posts.css +4 -0
- data/app/assets/stylesheets/forem/topics.css +4 -0
- data/app/controllers/forem/application_controller.rb +12 -0
- data/app/controllers/forem/posts_controller.rb +23 -0
- data/app/controllers/forem/topics_controller.rb +24 -0
- data/app/helpers/forem/application_helper.rb +4 -0
- data/app/helpers/forem/posts_helper.rb +4 -0
- data/app/helpers/forem/topics_helper.rb +4 -0
- data/app/models/forem/post.rb +5 -0
- data/app/models/forem/topic.rb +15 -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 +28 -0
- data/app/views/forem/topics/new.html.erb +2 -0
- data/app/views/forem/topics/show.html.erb +6 -0
- data/bin/autospec +16 -0
- data/bin/edit_json.rb +16 -0
- data/bin/erubis +16 -0
- data/bin/htmldiff +16 -0
- data/bin/launchy +16 -0
- data/bin/ldiff +16 -0
- data/bin/nokogiri +16 -0
- data/bin/prettify_json.rb +16 -0
- data/bin/rackup +16 -0
- data/bin/rails +16 -0
- data/bin/rake +16 -0
- data/bin/rake2thor +16 -0
- data/bin/rspec +16 -0
- data/bin/run_celerity_server.rb +16 -0
- data/bin/thor +16 -0
- data/bin/tilt +16 -0
- data/bin/tt +16 -0
- data/config/routes.rb +5 -0
- data/db/migrate/20110607015955_create_forem_topics.rb +10 -0
- data/db/migrate/20110607021318_create_forem_posts.rb +11 -0
- data/db/migrate/20110607035012_add_posts_count_to_forem_topics.rb +5 -0
- data/lib/forem.rb +4 -0
- data/lib/forem/engine.rb +10 -0
- data/lib/forem/user_extension.rb +8 -0
- data/lib/tasks/forem_tasks.rake +4 -0
- data/script/rails +6 -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 +7 -0
- data/spec/dummy/app/views/layouts/application.html.erb +18 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +49 -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 +24 -0
- data/spec/dummy/config/environments/production.rb +52 -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/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 +12 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20110607020624_create_forem_topics.rb +10 -0
- data/spec/dummy/db/migrate/20110607021444_create_forem_posts.rb +11 -0
- data/spec/dummy/db/migrate/20110607035916_add_posts_count_to_forem_topics.rb +5 -0
- data/spec/dummy/db/migrate/20110607055250_create_users.rb +9 -0
- data/spec/dummy/db/schema.rb +37 -0
- data/spec/dummy/db/test.sqlite3 +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/dummy/test/fixtures/users.yml +7 -0
- data/spec/dummy/test/unit/user_test.rb +7 -0
- data/spec/integration/posts_spec.rb +63 -0
- data/spec/integration/topics_spec.rb +46 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/support/capybara.rb +8 -0
- data/spec/support/dummy_login.rb +19 -0
- data/spec/support/load_routes.rb +6 -0
- data/ticketee-forem.gemspec +16 -0
- metadata +195 -0
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1,63 @@
|
|
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
|
+
|
11
|
+
context "unauthenticated users" do
|
12
|
+
before do
|
13
|
+
sign_out!
|
14
|
+
end
|
15
|
+
|
16
|
+
it "cannot access the new action" do
|
17
|
+
visit new_topic_post_path(@topic)
|
18
|
+
page.current_url.should eql(sign_in_url)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should see the post count and last post details" do
|
22
|
+
visit topics_path
|
23
|
+
save_and_open_page
|
24
|
+
within "#topics tbody td#posts_count" do
|
25
|
+
page.should have_content("1")
|
26
|
+
end
|
27
|
+
|
28
|
+
within "#topics tbody td#last_post" do
|
29
|
+
page.should have_content("last post was less than a minute ago by some_guy")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "authenticated users" do
|
35
|
+
before do
|
36
|
+
sign_in!
|
37
|
+
end
|
38
|
+
|
39
|
+
it "reply to a topic" do
|
40
|
+
visit topics_path
|
41
|
+
click_link "First topic!"
|
42
|
+
|
43
|
+
within ".forem_topic #posts .forem_post" do
|
44
|
+
click_link "Reply"
|
45
|
+
end
|
46
|
+
|
47
|
+
fill_in "Text", :with => "First reply!"
|
48
|
+
click_button "Create Post"
|
49
|
+
|
50
|
+
within "#flash_notice" do
|
51
|
+
page.should have_content("Post has been created!")
|
52
|
+
end
|
53
|
+
|
54
|
+
within ".forem_topic #posts .forem_post:last" do
|
55
|
+
page.should have_content("First reply!")
|
56
|
+
end
|
57
|
+
|
58
|
+
within ".forem_topic #posts .forem_post:last .user" do
|
59
|
+
page.should have_content("forem_user")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "topics" do
|
4
|
+
context "authenticated users" do
|
5
|
+
before do
|
6
|
+
sign_in!
|
7
|
+
end
|
8
|
+
|
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
|
+
|
16
|
+
within "#flash_notice" do
|
17
|
+
page.should have_content("Topic has been created!")
|
18
|
+
end
|
19
|
+
|
20
|
+
within ".forem_topic #posts .forem_post" do
|
21
|
+
page.should have_content("First post!")
|
22
|
+
end
|
23
|
+
|
24
|
+
within ".forem_topic #posts .forem_post .user" do
|
25
|
+
page.should have_content("forem_user")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context "unauthenticated users" do
|
31
|
+
before do
|
32
|
+
sign_out!
|
33
|
+
end
|
34
|
+
|
35
|
+
it "cannot see the 'New Topic' link" do
|
36
|
+
visit topics_path
|
37
|
+
page.should_not have_content("New Topic")
|
38
|
+
end
|
39
|
+
|
40
|
+
it "cannot begin to create a new topic" do
|
41
|
+
visit new_topic_path
|
42
|
+
page.current_url.should eql(sign_in_url)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require 'rspec/rails'
|
6
|
+
|
7
|
+
Rails.backtrace_cleaner.remove_silencers!
|
8
|
+
|
9
|
+
# Load support files
|
10
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
config.use_transactional_fixtures = true
|
14
|
+
end
|
@@ -0,0 +1,19 @@
|
|
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
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Provide a simple gemspec so you can easily use your
|
2
|
+
# project in your rails apps through git.
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "ticketee-forem"
|
5
|
+
s.summary = "Insert Forem summary."
|
6
|
+
s.description = "Insert Forem description."
|
7
|
+
s.files = `git ls-files`.split("\n")
|
8
|
+
s.version = "0.0.1"
|
9
|
+
s.authors = ["radarlistener@gmail.com"]
|
10
|
+
|
11
|
+
# s.add_dependency "rails", "3.1.0"
|
12
|
+
|
13
|
+
s.add_development_dependency "sqlite3"
|
14
|
+
s.add_development_dependency "rspec-rails", "~> 2.5"
|
15
|
+
s.add_development_dependency "capybara"
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ticketee-forem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- radarlistener@gmail.com
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-06-09 00:00:00 +10:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: sqlite3
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :development
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-rails
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: "2.5"
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: capybara
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
type: :development
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id003
|
49
|
+
description: Insert Forem description.
|
50
|
+
email:
|
51
|
+
executables: []
|
52
|
+
|
53
|
+
extensions: []
|
54
|
+
|
55
|
+
extra_rdoc_files: []
|
56
|
+
|
57
|
+
files:
|
58
|
+
- .gitignore
|
59
|
+
- Gemfile
|
60
|
+
- Gemfile.lock
|
61
|
+
- MIT-LICENSE
|
62
|
+
- README.rdoc
|
63
|
+
- Rakefile
|
64
|
+
- app/assets/images/.gitkeep
|
65
|
+
- app/assets/javascripts/application.js
|
66
|
+
- app/assets/javascripts/forem/posts.js
|
67
|
+
- app/assets/javascripts/forem/topics.js
|
68
|
+
- app/assets/stylesheets/application.css
|
69
|
+
- app/assets/stylesheets/forem/posts.css
|
70
|
+
- app/assets/stylesheets/forem/topics.css
|
71
|
+
- app/controllers/forem/application_controller.rb
|
72
|
+
- app/controllers/forem/posts_controller.rb
|
73
|
+
- app/controllers/forem/topics_controller.rb
|
74
|
+
- app/helpers/forem/application_helper.rb
|
75
|
+
- app/helpers/forem/posts_helper.rb
|
76
|
+
- app/helpers/forem/topics_helper.rb
|
77
|
+
- app/models/forem/post.rb
|
78
|
+
- app/models/forem/topic.rb
|
79
|
+
- app/views/forem/posts/_form.html.erb
|
80
|
+
- app/views/forem/posts/_post.html.erb
|
81
|
+
- app/views/forem/posts/new.html.erb
|
82
|
+
- app/views/forem/topics/_form.html.erb
|
83
|
+
- app/views/forem/topics/index.html.erb
|
84
|
+
- app/views/forem/topics/new.html.erb
|
85
|
+
- app/views/forem/topics/show.html.erb
|
86
|
+
- bin/autospec
|
87
|
+
- bin/edit_json.rb
|
88
|
+
- bin/erubis
|
89
|
+
- bin/htmldiff
|
90
|
+
- bin/launchy
|
91
|
+
- bin/ldiff
|
92
|
+
- bin/nokogiri
|
93
|
+
- bin/prettify_json.rb
|
94
|
+
- bin/rackup
|
95
|
+
- bin/rails
|
96
|
+
- bin/rake
|
97
|
+
- bin/rake2thor
|
98
|
+
- bin/rspec
|
99
|
+
- bin/run_celerity_server.rb
|
100
|
+
- bin/thor
|
101
|
+
- bin/tilt
|
102
|
+
- bin/tt
|
103
|
+
- config/routes.rb
|
104
|
+
- db/migrate/20110607015955_create_forem_topics.rb
|
105
|
+
- db/migrate/20110607021318_create_forem_posts.rb
|
106
|
+
- db/migrate/20110607035012_add_posts_count_to_forem_topics.rb
|
107
|
+
- lib/forem.rb
|
108
|
+
- lib/forem/engine.rb
|
109
|
+
- lib/forem/user_extension.rb
|
110
|
+
- lib/tasks/forem_tasks.rake
|
111
|
+
- script/rails
|
112
|
+
- spec/dummy/Rakefile
|
113
|
+
- spec/dummy/app/assets/javascripts/application.js
|
114
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
115
|
+
- spec/dummy/app/controllers/application_controller.rb
|
116
|
+
- spec/dummy/app/controllers/fake_controller.rb
|
117
|
+
- spec/dummy/app/helpers/application_helper.rb
|
118
|
+
- spec/dummy/app/mailers/.gitkeep
|
119
|
+
- spec/dummy/app/models/.gitkeep
|
120
|
+
- spec/dummy/app/models/user.rb
|
121
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
122
|
+
- spec/dummy/config.ru
|
123
|
+
- spec/dummy/config/application.rb
|
124
|
+
- spec/dummy/config/boot.rb
|
125
|
+
- spec/dummy/config/database.yml
|
126
|
+
- spec/dummy/config/environment.rb
|
127
|
+
- spec/dummy/config/environments/development.rb
|
128
|
+
- spec/dummy/config/environments/production.rb
|
129
|
+
- spec/dummy/config/environments/test.rb
|
130
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
131
|
+
- spec/dummy/config/initializers/inflections.rb
|
132
|
+
- spec/dummy/config/initializers/mime_types.rb
|
133
|
+
- spec/dummy/config/initializers/secret_token.rb
|
134
|
+
- spec/dummy/config/initializers/session_store.rb
|
135
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
136
|
+
- spec/dummy/config/locales/en.yml
|
137
|
+
- spec/dummy/config/routes.rb
|
138
|
+
- spec/dummy/db/development.sqlite3
|
139
|
+
- spec/dummy/db/migrate/20110607020624_create_forem_topics.rb
|
140
|
+
- spec/dummy/db/migrate/20110607021444_create_forem_posts.rb
|
141
|
+
- spec/dummy/db/migrate/20110607035916_add_posts_count_to_forem_topics.rb
|
142
|
+
- spec/dummy/db/migrate/20110607055250_create_users.rb
|
143
|
+
- spec/dummy/db/schema.rb
|
144
|
+
- spec/dummy/db/test.sqlite3
|
145
|
+
- spec/dummy/log/.gitkeep
|
146
|
+
- spec/dummy/public/404.html
|
147
|
+
- spec/dummy/public/422.html
|
148
|
+
- spec/dummy/public/500.html
|
149
|
+
- spec/dummy/public/favicon.ico
|
150
|
+
- spec/dummy/script/rails
|
151
|
+
- spec/dummy/test/fixtures/users.yml
|
152
|
+
- spec/dummy/test/unit/user_test.rb
|
153
|
+
- spec/integration/posts_spec.rb
|
154
|
+
- spec/integration/topics_spec.rb
|
155
|
+
- spec/spec_helper.rb
|
156
|
+
- spec/support/capybara.rb
|
157
|
+
- spec/support/dummy_login.rb
|
158
|
+
- spec/support/load_routes.rb
|
159
|
+
- ticketee-forem.gemspec
|
160
|
+
has_rdoc: true
|
161
|
+
homepage:
|
162
|
+
licenses: []
|
163
|
+
|
164
|
+
post_install_message:
|
165
|
+
rdoc_options: []
|
166
|
+
|
167
|
+
require_paths:
|
168
|
+
- lib
|
169
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
170
|
+
none: false
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
hash: 1965753861854763928
|
175
|
+
segments:
|
176
|
+
- 0
|
177
|
+
version: "0"
|
178
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
|
+
none: false
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
hash: 1965753861854763928
|
184
|
+
segments:
|
185
|
+
- 0
|
186
|
+
version: "0"
|
187
|
+
requirements: []
|
188
|
+
|
189
|
+
rubyforge_project:
|
190
|
+
rubygems_version: 1.6.2
|
191
|
+
signing_key:
|
192
|
+
specification_version: 3
|
193
|
+
summary: Insert Forem summary.
|
194
|
+
test_files: []
|
195
|
+
|