Skip to content

Instantly share code, notes, and snippets.

View dchelimsky's full-sized avatar

David Chelimsky dchelimsky

  • Retired
  • Chicago, IL, USA
View GitHub Profile
class Adder
def initialize(*args)
@args = args
@block = lambda {|*args|
args.inject(0) {|a, sum| sum += a}
}
end
def add
instance_exec(*@args, &@block)
Scenario Outline: Religious menus
Given the customer is "<Religion>"
When he asks for the menu
Then he should be presented with the appropriate selection from <Pork>, <Lamb>, or <Veal>
Scenarios:
| Religion | Pork | Lamb | Veal |
| Christian | Y | Y | Y |
| Jewish | | Y | Y |
| Muslim | | Y | Y |
Scenario Outline: Religious menus
Given the customer is "<Religion>"
When he asks for the menu
Then he should be presented with the appropriate options
Scenarios:
| Religion | Pork | Lamb | Veal |
| Christian | Y | Y | Y |
| Jewish | | Y | Y |
| Muslim | | Y | Y |
# excerpted from spec/spec/matchers/raise_error_spec.rb
it "passes the error to the block" do
error = nil
lambda { non_existent_method }.should raise_error {|e|
error = e
}
error.should be_an_instance_of(NameError)
end
#These all pass the specs in post_create_with_stubble_spec.rb, but not necessarily the other ones
def create
@registration = Registration.new(params[:registration])
if @registration.save
redirect_to registrations_path
else
render :action => 'new'
end
end
import flash.utils.ByteArray;
import ru.inspirit.net.MultipartURLLoader;
var byteArray:ByteArray = new ByteArray();
byteArray.position = 0;
var ml:MultipartURLLoader = new MultipartURLLoader();
ml.addEventListener(Event.COMPLETE, onReady);
function onReady(e:Event):void
import flash.events.*;
import flash.net.URLRequest;
import flash.display.Loader;
import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.utils.ByteArray;
import ru.inspirit.net.MultipartURLLoader;
import com.adobe.images.JPGEncoder;
describe Scorecard::Score::BusinessCapacityScore,"benchmark" do
before do
@business_capacity = Scorecard::Score::BusinessCapacityScore.new
@business_capacity.ues = false
@stream_fields = @business_capacity.assistance_type_stream_fields
end
@stream_fields.each do |stream_label|
it "should get the stream: #{stream_label}" do
describe Customer, "last billing address" do
before do
@customer = Customer.generate!
@customer = Address.new
end
it "should be settable and gettable" do
@customer.last_billing_address = @account_address
@customer.last_billing_address.should == @account_address
end
...
1)
Test::Unit::AssertionFailedError in 'A controller example running in integration mode support custom routes'
The generated path <"/custom_route_spec/custom_route"> did not match <"/custom_route">
/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec-rails/spec/spec/rails/example/shared_routing_example_group_examples.rb:7:
2)
Test::Unit::AssertionFailedError in 'A controller example running in integration mode support existing routes with additional parameters'
found extras <{:param=>"1"}>, not <{}>
/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec-rails/spec/spec/rails/example/shared_routing_example_group_examples.rb:17: