This file contains hidden or 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
given "logged in" do | |
login | |
end | |
given "anonymous" do end | |
describe "Homepage: url(:home)", :given => "logged in" do | |
before(:each) do | |
@rack = request(:home) | |
end |
This file contains hidden or 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
Scenario: withdraw cash | |
Given I have [starting balance] in my checking account | |
When I withdraw [withdrawal amount] | |
Then I should have [resulting balance] in my my checking account | |
| starting balance | withdrawal amount | resulting balance | | |
| 20 | 7 | 13 | | |
This file contains hidden or 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
GIVENS = {} | |
def given name, &block | |
GIVENS[name] = &block | |
end | |
config.extend_group_on(:given) do |given, group| | |
group.before(:each) do | |
GIVENS[give].call | |
end |
This file contains hidden or 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
module Autotest::Growl | |
def self.growl title, msg, img, pri=0, stick="" | |
system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{stick}" | |
end | |
def self.strip_command_line_format(text) | |
result = text.gsub(/\e\[(\d+)m/,"") | |
result.gsub!("\n","") | |
end | |
This file contains hidden or 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
module OnOptionExample | |
GIVENS = {} | |
def self.given name, &block | |
GIVENS[name] = block | |
end | |
given "@value = 10" do | |
@value = 10 | |
end |
This file contains hidden or 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 'spec' | |
module Spec | |
module Macros | |
end | |
class << self | |
def define_macros | |
Spec::Macros.extend Module.new { yield } | |
end | |
This file contains hidden or 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
Autotest.add_hook :initialize do |at| | |
unless ARGV.empty? | |
if Dir["app"].empty? | |
at.find_directories = ARGV.length == 1 ? ["spec/#{ARGV.first}","lib/#{ARGV.first}"] : ARGV.dup | |
else | |
at.find_directories = ARGV.length == 1 ? ["spec/#{ARGV.first}","app/#{ARGV.first}"] : ARGV.dup | |
end | |
end | |
end |
This file contains hidden or 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
module ControllerMacros | |
module InstanceMethods | |
def should_render template | |
it "should render the #{template} template" do | |
do_request | |
response.should render_template(template) | |
end | |
end | |
This file contains hidden or 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
>> foo = Group.create(:name => 'Foo') | |
=> #<Group id: 4, name: "Foo"> | |
>> bar = Group.find(4) | |
=> #<Group id: 4, name: "Foo"> | |
>> bar.update_attributes(:name => 'Bar') | |
=> true | |
>> bar | |
=> #<Group id: 4, name: "Bar"> | |
>> foo | |
=> #<Group id: 4, name: "Foo"> |
This file contains hidden or 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
Feature: Compile C code into Ruby extensions. | |
In order to automate compilation process. | |
As a Gem developer. | |
I want rake tasks compile source code for me. | |
Scenario: Compile single extension | |
Given a safe project directory | |
And scaffold code for extension 'extension_one' | |
And 'tmp' folder is deleted |