Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simple implementation of series and step methods without reporting.
- Loading branch information
Showing
5 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
dir = File.dirname(__FILE__) | ||
require "#{dir}/series/example_group_methods" | ||
require "#{dir}/series/series_methods" | ||
|
||
module Spec | ||
ExampleGroup.class_eval do | ||
extend Spec::Series::ExampleGroupMethods | ||
include Spec::Series::SeriesMethods | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Spec | ||
module Series | ||
module ExampleGroupMethods | ||
def self.included(mod) | ||
p mod | ||
puts "#{__FILE__}:#{__LINE__}" | ||
end | ||
|
||
def series(*args, &block) | ||
it(*args, &block) | ||
end | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Spec | ||
module Series | ||
module SeriesMethods | ||
def step(description) | ||
yield | ||
end | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
require "#{File.dirname(__FILE__)}/spec_helper" | ||
|
||
describe "A Series" do | ||
already_run = false | ||
|
||
it "can run a series" do | ||
return if already_run | ||
already_run = true | ||
example_group = self.class | ||
|
||
steps_run = [] | ||
example_group.instance_eval do | ||
series "can run multiple steps" do | ||
step "one" do | ||
steps_run << 1 | ||
end | ||
step "two" do | ||
steps_run << 2 | ||
end | ||
step "three" do | ||
steps_run << 3 | ||
end | ||
end | ||
end | ||
|
||
err, output = StringIO.new, StringIO.new | ||
example_group.run(Spec::Runner::Options.new(err, output)) | ||
steps_run.should == [1,2,3] | ||
end | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require "rubygems" | ||
require "spec" | ||
require "spec/autorun" | ||
require "rr" | ||
$:.unshift(File.expand_path("#{File.dirname(__FILE__)}/../lib")) | ||
require "rspec/series" | ||
ARGV.push("-b", "-fn") | ||
|
||
Spec::Runner.configure do |config| | ||
config.mock_with RR::Adapters::Rspec | ||
end |