DG, MS, IZ; status messages now functional
This commit is contained in:
parent
85e6eb2132
commit
29c6f9fa0f
8 changed files with 30 additions and 17 deletions
|
|
@ -20,13 +20,13 @@ class StatusMessagesController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
@status_message = StatusMessage.find(params[:id])
|
||||
@status_message = StatusMessage.first(:conditions => {:id => params[:id]})
|
||||
@status_message.destroy
|
||||
flash[:notice] = "Successfully destroyed status message."
|
||||
redirect_to status_messages_url
|
||||
end
|
||||
|
||||
def show
|
||||
@status_message = StatusMessage.find(params[:id])
|
||||
@status_message = StatusMessage.first(:conditions => {:id => params[:id]})
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@
|
|||
|
||||
%body
|
||||
#container
|
||||
/ - if user_signed_in?
|
||||
/ = link_to "log out", destroy_user_session_path
|
||||
/ - else
|
||||
/ = link_to "login", new_user_session_path
|
||||
- if user_signed_in?
|
||||
= link_to "log out", destroy_user_session_path
|
||||
- else
|
||||
= link_to "login", new_user_session_path
|
||||
|
||||
- flash.each do |name, msg|
|
||||
= content_tag :div, msg, :id => "flash_#{name}"
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ Diaspora::Application.routes.draw do |map|
|
|||
|
||||
|
||||
resources :users
|
||||
resources :status_messages
|
||||
match 'dashboard', :to => 'status_messages#index'
|
||||
|
||||
|
||||
# The priority is based upon order of creation:
|
||||
|
|
@ -69,6 +71,6 @@ Diaspora::Application.routes.draw do |map|
|
|||
# Note: This route will make all actions in every controller accessible via GET requests.
|
||||
# match ':controller(/:action(/:id(.:format)))'
|
||||
|
||||
root :to => "users#index"
|
||||
root :to => 'status_messages#index'
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,13 @@
|
|||
require File.dirname(__FILE__) + '/../spec_helper'
|
||||
|
||||
describe StatusMessagesController do
|
||||
fixtures :all
|
||||
before do
|
||||
#TODO(dan) Mocking Warden; this is a temp fix
|
||||
request.env['warden'] = mock_model(Warden, :authenticate => @user, :authenticate! => @user)
|
||||
StatusMessage.create(:message => "yodels.")
|
||||
end
|
||||
|
||||
#fixtures :all
|
||||
render_views
|
||||
|
||||
it "index action should render index template" do
|
||||
|
|
@ -28,13 +34,13 @@ describe StatusMessagesController do
|
|||
|
||||
it "destroy action should destroy model and redirect to index action" do
|
||||
status_message = StatusMessage.first
|
||||
delete :destroy, :id => status_message
|
||||
delete :destroy, :id => status_message.id
|
||||
response.should redirect_to(status_messages_url)
|
||||
StatusMessage.exists?(status_message.id).should be_false
|
||||
StatusMessage.first(:conditions => {:id => status_message.id }).nil?.should be true
|
||||
end
|
||||
|
||||
it "show action should render show template" do
|
||||
get :show, :id => StatusMessage.first
|
||||
get :show, :id => StatusMessage.first.id
|
||||
response.should render_template(:show)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
require File.dirname(__FILE__) + '/../spec_helper'
|
||||
|
||||
describe UsersController do
|
||||
#render_views
|
||||
#fixtures here?
|
||||
before do
|
||||
#TODO(dan) Mocking Warden; this is a temp fix
|
||||
request.env['warden'] = mock_model(Warden, :authenticate => @user, :authenticate! => @user)
|
||||
end
|
||||
render_views
|
||||
#fixtures :all
|
||||
|
||||
it 'should, after logging in redirect to the dashboard page' do
|
||||
pending
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
require File.dirname(__FILE__) + '/../spec_helper'
|
||||
|
||||
describe StatusMessage do
|
||||
it "should have a message and an owner" do
|
||||
it "should have a message" do
|
||||
n = StatusMessage.new
|
||||
n.valid?.should be false
|
||||
n.message = "wales"
|
||||
|
|
|
|||
|
|
@ -21,11 +21,12 @@ Rspec.configure do |config|
|
|||
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||
config.before(:each) do
|
||||
Mongoid.master.collections.select { |c| c.name != 'system.indexes' }.each(&:drop)
|
||||
|
||||
end
|
||||
|
||||
|
||||
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||
# examples within a transaction, comment the following line or assign false
|
||||
# instead of true.
|
||||
config.use_transactional_fixtures = true
|
||||
config.use_transactional_fixtures = false
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue