Skip to content

Commit

Permalink
featurefix
Browse files Browse the repository at this point in the history
  • Loading branch information
radar committed Oct 25, 2009
1 parent 2150823 commit 2421753
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 58 deletions.
2 changes: 1 addition & 1 deletion app/models/post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def find_latest_post
def finished!
unless finished?
self.finished = true
update_latest_post(post)
Post.update_latest_post(self)
save!
end
end
Expand Down
15 changes: 0 additions & 15 deletions app/views/layouts/attachments.html.erb

This file was deleted.

12 changes: 0 additions & 12 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,9 @@
t.integer "category_id"
t.boolean "active", :default => true
t.boolean "open", :default => true
t.integer "old_id"
end

add_index "forums", ["category_id"], :name => "index_forums_on_category_id"
add_index "forums", ["old_id"], :name => "index_forums_on_old_id"
add_index "forums", ["open"], :name => "index_forums_on_open"
add_index "forums", ["parent_id"], :name => "index_forums_on_parent_id"
add_index "forums", ["posts_count"], :name => "index_forums_on_posts_count"
Expand Down Expand Up @@ -202,23 +200,18 @@
t.boolean "delta"
t.boolean "deleted", :default => false
t.integer "ip_id"
t.integer "old_id"
t.boolean "finished", :default => false
end

add_index "posts", ["id", "topic_id"], :name => "index_posts_on_id_and_topic_id"
add_index "posts", ["ip_id"], :name => "index_posts_on_ip_id"
add_index "posts", ["old_id"], :name => "index_posts_on_old_id"

create_table "ranks", :force => true do |t|
t.string "name"
t.integer "posts_required"
t.boolean "custom", :default => false
t.integer "old_id"
end

add_index "ranks", ["old_id"], :name => "index_ranks_on_old_id"

create_table "read_topics", :force => true do |t|
t.integer "user_id"
t.integer "topic_id"
Expand Down Expand Up @@ -261,13 +254,11 @@
t.integer "ip_id"
t.boolean "moved", :default => false
t.integer "moved_to_id"
t.integer "old_id"
t.boolean "finished", :default => false
end

add_index "topics", ["id", "forum_id"], :name => "index_topics_on_id_and_forum_id"
add_index "topics", ["ip_id"], :name => "index_topics_on_ip_id"
add_index "topics", ["old_id"], :name => "index_topics_on_old_id"

create_table "user_levels", :id => false, :force => true do |t|
t.string "name"
Expand Down Expand Up @@ -309,13 +300,10 @@
t.string "avatar_content_type"
t.integer "avatar_file_size"
t.string "identifier"
t.integer "old_id"
t.string "phpbb_crypted_password"
end

add_index "users", ["id", "user_level_id"], :name => "index_users_on_id_and_user_level_id"
add_index "users", ["login"], :name => "index_users_on_login"
add_index "users", ["login_time"], :name => "index_users_on_login_time"
add_index "users", ["old_id"], :name => "index_users_on_old_id"

end
3 changes: 2 additions & 1 deletion features/admin_forums.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Feature: Forums

Scenario: Administrators should be able to create new forums
Given I am logged in as "administrator"
When I am on the admin forums page
When I follow "Administration Section"
And I follow "Forums"
And I follow "New Forum"
And I fill in "Title" with "Test Forum"
And I fill in "Description" with "Testing!"
Expand Down
3 changes: 2 additions & 1 deletion features/groups.feature → features/admin_groups.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Feature: Managing groups
Scenario: Managing users
Given I am logged in as "administrator"
Then I should see "administrator"
Given I am on the administrator's group page
When I follow "Administration Section"
And I follow "Groups"
Then I should see "Administrators"
When I follow "members_for_registered_users"
Then I should see "registered_user"
Expand Down
9 changes: 6 additions & 3 deletions features/attachments.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Feature: Attachments
Background:
Given there is the usual setup
Given I am logged in as "registered_user"

Scenario: Attaching files to a new post
Given I am on the homepage
When I follow "Public Forum"

Scenario: Attaching files to a new topic
And I follow "New Topic"
And I fill in "Subject" with "Look Ma, Attachments!"
And I fill in "Text" with "Woah! Look at those attachments!"
Expand All @@ -26,4 +26,7 @@ Feature: Attachments
When I press "Post"
Then I should see "Look Ma, Attachments!"
And I should see "1 attachment"
And I should see "fugu.png"
And I should see "fugu.png"

Scenario: Attaching files to a new reply
Then show me the page
4 changes: 2 additions & 2 deletions features/categories.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Scenario: Administrators should be able to create new categories
When I am on the homepage
When I follow "Administration Section"
And I follow "Categories"
And I follow "edit_category_1"
And I follow "Edit"
And I fill in "Name" with "Private Category"
And I fill in "Description" with "Testing!"
And I press "Update"
Expand All @@ -30,7 +30,7 @@ Scenario: Categories should be valid when updates
When I am on the homepage
When I follow "Administration Section"
And I follow "Categories"
And I follow "edit_category_1"
And I follow "Edit"
And I fill in "Name" with ""
And I fill in "Description" with "Testing!"
And I press "Update"
Expand Down
8 changes: 4 additions & 4 deletions features/forums.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Feature: Forums
Given there is the usual setup

Scenario: Viewing forums index as an anonymous user
Given I am on the forums page
Given I am on the homepage
Then I should see "Public Forum"

Scenario: Viewing the public forum as an anonymous user
Given I am on the forums page
Given I am on the homepage
When I follow "Public Forum"
Then I should see "Viewing forum: Public Forum"

Expand All @@ -26,13 +26,13 @@ Feature: Forums
Given I am logged in as "registered_user"
And there is an inactive forum
And I can see inactive forums
And I am on the forums page
And I am on the homepage
Then I should see "Hidden Forum"

Scenario: Registered users should not be able to post in closed forums
Given I am logged in as "registered_user"
And there is a closed forum
And I am on the forums page
And I am on the homepage
When I follow "Closed Forum"
Then I should not see "New Topic"
When I follow "Closed Forum's Topic"
Expand Down
10 changes: 0 additions & 10 deletions features/posts.feature

This file was deleted.

6 changes: 4 additions & 2 deletions features/step_definitions/forums_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
Given /^there is a closed forum$/ do
f = Forum.create!(:title => "Closed Forum", :description => "This is a closed forum", :open => false)
t = f.topics.build(:subject => "Closed Forum's Topic", :user => User.first)
t.posts.build(:text => "I live in the Closed Forum. All by myself.", :user => User.first)
t.save!
p = t.posts.build(:text => "I live in the Closed Forum. All by myself.", :user => User.first)
t.finished!
p.finished!

end
2 changes: 1 addition & 1 deletion features/subscriptions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Feature: Managing Subscriptions

Scenario: User who has posted to a topic should be subscribed to it
Given I am logged in as "registered_user"
And I am on the forums page
And I am on the homepage
When I follow "Public Forum"
When I follow "New Topic"
When I fill in "subject" with "Tribute"
Expand Down
1 change: 1 addition & 0 deletions features/support/blueprints/permissions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
can_start_new_topics true
can_use_attachments true
can_subscribe true
can_see_forum true
group { Group.ensure("Registered Users") }
end

Expand Down
3 changes: 3 additions & 0 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'cucumber/rails/world'

# Ensure the database is clean.
[Category, Forum, Topic, Post, User, Permission, Group].map(&:delete_all)

# If you set this to true, each scenario will run in a database transaction.
# You can still turn off transactions on a per-scenario basis, simply tagging
# a feature or scenario with the @no-txn tag.
Expand Down
2 changes: 2 additions & 0 deletions features/support/paths.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def path_to(page_name)
'/'
when /the login page/
login_path
when /the forum page for "(.*?)"/
forum_path(Forum.find_by_title($1))

# Add more mappings here.
# Here is a more fancy example:
Expand Down
6 changes: 0 additions & 6 deletions features/topics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ Feature: Topics
And I fill in "Text" with "This is just a tribute"
And I press "Create"
Then I should see "rBoard -> Public Category -> Public Forum -> Tribute"

Scenario: Registered users should not be able to post new topics in closed forums
Given I am logged in as "registered_user"
And there is a closed forum
And I am on the new topic page for "Closed Forum"
Then I should see "This forum is closed, and you are unable to post here."

Scenario: Administrators should be able to create and sticky a topic
Given I am logged in as "administrator"
Expand Down

0 comments on commit 2421753

Please sign in to comment.