public
Last active — forked from dhh/gist:893027

rspec vs Test::Unit

  • Download Gist
gistfile1.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
describe "GET current" do
before do
@request.cookies['hidden_notices'] = "1,#{notices(:permanent).id}"
get :current, :format => 'js'
end
 
it { should respond_with(:success) }
it { should set_cookie(:hidden_notices).to("#{notices(:permanent).id}") }
it { should render_template('notices/current') }
end
end
 
# vs
 
test "GET current (or preferably an explanation WHY we are testing it)" do
@request.cookies['hidden_notices'] = "1,#{notices(:permanent).id}"
get :current, :format => 'js'
 
assert respond_with(:success)
assert_equal "#{notices(:permanent).id}", cookies[:hidden_notices]
assert_template 'notices/current'
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.