Skip to content

Commit c659af3

Browse files
committed
Starting out writing features for rboard. Fixed endless subscriptions index page redirection
1 parent 475be9c commit c659af3

37 files changed

+1356
-14
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "vendor/plugins/cucumber"]
2+
path = vendor/plugins/cucumber
3+
url = git://github.com/aslakhellesoy/cucumber.git

app/controllers/subscriptions_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
class SubscriptionsController < ApplicationController
22
before_filter :find_topic, :only => [:create]
33
before_filter :login_required
4-
before_filter :store_location, :only => [:index]
54
before_filter :can_not_subscribe?
5+
before_filter :store_location, :only => [:index]
66

77
def index
88
@subscriptions = current_user.subscriptions.all(:joins => :topic, :order => "updated_at DESC")

app/models/post.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Post < ActiveRecord::Base
1515
validates_length_of :text, :minimum => 4
1616
validates_presence_of :text
1717

18-
unless THINKING_SPHINX
18+
unless SEARCHING
1919
define_index do
2020
indexes text
2121
set_property :delta => true

app/models/topic.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Topic < ActiveRecord::Base
3333
after_create :increment_counters
3434
before_destroy :decrement_counters
3535

36-
unless THINKING_SPHINX
36+
unless SEARCHING
3737
define_index do
3838
indexes subject
3939
end

app/views/layouts/application.html.erb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
<%= link_to t(:Edit_Profile), [:edit, current_user] %> |
3131
<%= link_to t(:Member_List), users_path %> |
3232
<%= link_to t(:x_new_messages, :count => @current_user.unread_messages.size), messages_path %> |
33-
<%= link_to t(:Subscriptions), subscriptions_path %> |
33+
<% if current_user.can?(:subscribe) %>
34+
<%= link_to t(:Subscriptions), subscriptions_path %> |
35+
<% end %>
3436
<%= link_to t(:Logout), logout_path %>
3537
<% end %>
3638
</div>

app/views/topics/_form.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<% fields_for @post do |post| %>
88
<tr>
9-
<td valign='top'><%= f.label 'text', t(:Text) %></td>
9+
<td valign='top'><%= post.label 'text', t(:Text) %></td>
1010
<td><%= post.text_area "text", :cols => "80" %></td>
1111
</tr>
1212
<% end %>

config/environment.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
if File.readlines(database).empty?
1414
raise "Your database.yml file is empty. Please add your database information."
1515
end
16-
Rails::Initializer.run do |config|
16+
CONFIG = Rails::Initializer.run do |config|
1717

1818
config.gem 'chronic'
1919
config.gem 'RedCloth'
@@ -49,7 +49,7 @@
4949
STANDALONE = true
5050

5151
## Set this to false if you don't want to use thinking sphinx.
52-
THINKING_SPHINX = true
52+
SEARCHING = true
5353

5454
# Change this if your locale is not english
5555
# I18n.default_locale = "en"

config/environments/cucumber.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
config.cache_classes = true # This must be true for Cucumber to operate correctly!
2+
3+
# Log error messages when you accidentally call methods on nil.
4+
config.whiny_nils = true
5+
6+
# Show full error reports and disable caching
7+
config.action_controller.consider_all_requests_local = true
8+
config.action_controller.perform_caching = false
9+
10+
# Disable request forgery protection in test environment
11+
config.action_controller.allow_forgery_protection = false
12+
13+
# Tell Action Mailer not to deliver emails to the real world.
14+
# The :test delivery method accumulates sent emails in the
15+
# ActionMailer::Base.deliveries array.
16+
config.action_mailer.delivery_method = :test

features/forums.feature

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Feature: Manage forums
2+
In order to restrict people to the right forums
3+
Administrators
4+
want to ensure people are shown only the right forums
5+
6+
Scenario: Viewing forums index
7+
Given I am on the forums page
8+
Then I should see "Public Forum"
9+
10+
Scenario: Viewing the public forum
11+
Given I am on the forums page
12+
When I follow "Public Forum"
13+
Then I should see "Viewing forum: Public Forum"
14+
15+
Scenario: Registered users should be able to post new topics
16+
Given I am logged in as "registered_user"
17+
And I am on the forums page
18+
When I follow "Public Forum"
19+
When I follow "New Topic"
20+
When I fill in "subject" with "Tribute"
21+
When I fill in "Text" with "This is just a tribute"
22+
When I press "Create"
23+
Then I should see "rBoard -> Public Forum -> Tribute"
24+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Given /^I am logged in as "([^\"]*)"$/ do |user|
2+
Given "I am on the login page"
3+
When "I fill in \"login\" with \"#{user}\""
4+
When "I fill in \"password\" with \"password\""
5+
When "I press \"Login\""
6+
Then "I should see \"Logged in successfully.\""
7+
end

0 commit comments

Comments
 (0)