Skip to content

Instantly share code, notes, and snippets.

View zeedunk's full-sized avatar

Zac Duncan zeedunk

  • Simple
  • Portland, OR
View GitHub Profile
class ControllerTest < ActionController::TestCase
context 'on create' do
setup do
@the_model = stub
TheModel.stubs(:new).returns(@the_model)
post :create
end
should 'save the new model' do
class ControllerTest < ActionController::TestCase
context 'on create' do
setup do
TheModel.stubs(:new).returns(@the_model)
@the_model.expects(:save)
post :create
end
#call restful URL in ruby.
require 'net/http'
Net::HTTP.start('localhost', '3000') { |http| puts http.get('/resource/and_args').body}
require File.expand_path(File.dirname(__FILE__) + '/edgecase')
# Greed is a dice game where you roll up to five dice to accumulate
# points. The following "score" function will be used calculate the
# score of a single roll of the dice.
#
# A greed roll is scored as follows:
#
# * A set of three ones is 1000 points
#
require 'edgecase'
# Greed is a dice game where you roll up to five dice to accumulate
# points. The following "score" function will be used calculate the
# score of a single roll of the dice.
#
# A greed roll is scored as follows:
#
# * A set of three ones is 1000 points
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Foo
{
[TestClass]
public class ReduceExamples
{
[TestMethod]
public void Aggregate_Is_A_Poorly_Named_Version_Of_Reduce()
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
//please pardon the MSTest.
namespace TestProject
{
[TestClass]
public class UnitTest
{
[TestMethod]