diff --git a/app/controllers/asciicasts_controller.rb b/app/controllers/asciicasts_controller.rb index 64531c1..9553a4b 100644 --- a/app/controllers/asciicasts_controller.rb +++ b/app/controllers/asciicasts_controller.rb @@ -55,7 +55,8 @@ class AsciicastsController < ApplicationController :notice => 'Asciicast was deleted.' else redirect_to asciicast_path(@asciicast), - :alert => "Oops, we couldn't remove this asciicast. Try again later." + :alert => "Oops, we couldn't remove this asciicast. " \ + "Try again later." end end diff --git a/app/decorators/application_decorator.rb b/app/decorators/application_decorator.rb index bbcac80..7c9d9b0 100644 --- a/app/decorators/application_decorator.rb +++ b/app/decorators/application_decorator.rb @@ -29,4 +29,8 @@ class ApplicationDecorator < Draper::Base def as_json(*args) model.as_json(*args) end + + def markdown(text) + MKD_SAFE_RENDERER.render(text).html_safe + end end diff --git a/app/decorators/asciicast_decorator.rb b/app/decorators/asciicast_decorator.rb index 5cf3027..5c221e4 100644 --- a/app/decorators/asciicast_decorator.rb +++ b/app/decorators/asciicast_decorator.rb @@ -102,7 +102,7 @@ class AsciicastDecorator < ApplicationDecorator def formatted_description text = model.description.to_s - MKD_SAFE_RENDERER.render(text).html_safe + markdown(text) end def author_profile_link(options = {}) @@ -113,7 +113,10 @@ class AsciicastDecorator < ApplicationDecorator img = "" end - h.link_to img + "~#{asciicast.user.nickname}", h.profile_path(asciicast.user) + text = img + "~#{asciicast.user.nickname}" + path = h.profile_path(asciicast.user) + + h.link_to text, path else if asciicast.username.present? "~#{asciicast.username}" diff --git a/app/models/user.rb b/app/models/user.rb index 96184af..11dc3d3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -11,7 +11,8 @@ class User < ActiveRecord::Base validates_uniqueness_of \ :nickname, - :message => "Sorry, but your nickname is already taken, choose different one" + :message => "Sorry, but your nickname is already taken, " \ + "choose different one" has_many :user_tokens, :dependent => :destroy has_many :asciicasts, :dependent => :destroy diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index 03a79d5..a8fb8d8 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -47,7 +47,7 @@ describe FakeController do get :foo - flash[:notice].should == "Please login" + flash[:notice].should == "Please login first" should redirect_to(login_path) end diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb index fb834b5..e2f4085 100644 --- a/spec/controllers/sessions_controller_spec.rb +++ b/spec/controllers/sessions_controller_spec.rb @@ -29,7 +29,7 @@ describe SessionsController do end it "should redirects user to root url" do - flash[:notice].should == "Signed in!" + flash[:notice].should == "Logged in!" should redirect_to(root_url) end end @@ -98,7 +98,7 @@ describe SessionsController do end it "should redirects to root_url" do - flash[:notice].should == "Signed out!" + flash[:notice].should == "Logged out!" should redirect_to(root_url) end end diff --git a/spec/helpers/docs_helper_spec.rb b/spec/helpers/docs_helper_spec.rb deleted file mode 100644 index 8ff5891..0000000 --- a/spec/helpers/docs_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -# Specs in this file have access to a helper object that includes -# the DocsHelper. For example: -# -# describe DocsHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end -describe DocsHelper do - pending "add some examples to (or delete) #{__FILE__}" -end