diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-05-28 11:18:12 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-05-28 11:23:07 +0100 |
commit | 774b8d159c8095977148cc2f6d7902c2636cccbd (patch) | |
tree | 6f0859985e01316fcd565589516ea550c348e901 /spec/models/user_spec.rb | |
parent | 2cbd12b49db28e46ab507f948039a7d81f84ca0a (diff) |
Return a string from user.name always to avoid any complications with other functions calling gsub on the result. SafeBuffer won't work with gsub until Rails 3.2 https://github.com/rails/rails/commit/b4a6e2f8442ceda118367f9a61c38af754be1cbfhotfix/0.9.0.5
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r-- | spec/models/user_spec.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index e31c3f1b5..ec1236a5d 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -27,11 +27,22 @@ describe User, "showing the name" do @user.name.should == 'Some Name' end - it 'should show if user has been banned' do - @user.ban_text = "Naughty user" - @user.name.should == 'Some Name (Account suspended)' + describe 'if user has been banned' do + + before do + @user.ban_text = "Naughty user" + end + + it 'should show an "Account suspended" suffix' do + @user.name.should == 'Some Name (Account suspended)' + end + + it 'should return a string when the user has been banned, not a SafeBuffer' do + @user.name.type.should == String + end end + end describe User, " when authenticating" do |