This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ControllerTest < ActionController::TestCase | |
context 'on create' do | |
setup do | |
TheModel.stubs(:new).returns(@the_model) | |
@the_model.expects(:save) | |
post :create | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#call restful URL in ruby. | |
require 'net/http' | |
Net::HTTP.start('localhost', '3000') { |http| puts http.get('/resource/and_args').body} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
//please pardon the MSTest. | |
namespace TestProject | |
{ | |
[TestClass] | |
public class UnitTest | |
{ | |
[TestMethod] |
NewerOlder