Skip to content

Commit d39e127

Browse files
committed
Helpers spec
1 parent 32ffa20 commit d39e127

5 files changed

Lines changed: 34 additions & 3 deletions

File tree

spec/controllers/mailer_controller_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@
8888
ActionMailer::Base.deliveries.last.body.to_s.should match @message.body
8989
end
9090
end
91+
92+
describe 'empty message' do
93+
it "returns exception" do
94+
post :create
95+
expect(subject).to render_template(:new)
96+
end
97+
end
9198
end
9299

93100
context 'when user is not a moderator' do

spec/controllers/questions_controller_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require 'spec_helper'
22

33
describe QuestionsController do
4-
54
describe "GET index" do
65
context "with format atom" do
76
it "responds with success" do

spec/controllers/rel_controller_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
require 'spec_helper'
22

33
describe Api::RelsController do
4-
54
let(:slug){Fabricate(:rel)}
65

7-
86
describe "GET index" do
97
it "responds with success" do
108
get :index

spec/controllers/user_controller_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,11 @@
5050
expect(flash[:notice]).to eq("You're no longer following #{mozart.username}")
5151
end
5252
end
53+
54+
describe 'Deleted user' do
55+
it 'should create new deleted user' do
56+
get :deleted_user
57+
response.should be_success
58+
end
59+
end
5360
end
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
require "spec_helper"
2+
3+
describe ProgramsHelper do
4+
let(:simple) { Fabricate(:program) }
5+
let(:complicated) { Fabricate(:program, :author_username => nil) }
6+
7+
describe "#program_link" do
8+
it "returns author's program path if author username exists" do
9+
helper.program_link(simple).should == "#{link_to(simple.title.titleize,
10+
user_program_path(simple.author_username, simple))}".html_safe
11+
end
12+
13+
it "returns url by program's slug if author username doesn't exist" do
14+
helper.program_link(complicated).should == "#{link_to(complicated.title.titleize,
15+
url_for(:controller => '/programs',
16+
:action => 'show',
17+
:id => complicated.slug))}".html_safe
18+
end
19+
end
20+
end

0 commit comments

Comments
 (0)