Skip to content
Browse files

Move fixtures out of spec dir, so rspec is green

  • Loading branch information...
1 parent d0cba63 commit 811e114532fe4fc72c95bff4437ed8be740396c0 Your Name committed Oct 28, 2011
View
0 spec/fixture/ambiguous.feature → examples/ambiguous.feature
File renamed without changes.
View
0 spec/fixture/backgrounds.feature → examples/backgrounds.feature
File renamed without changes.
View
0 spec/fixture/interpolation.feature → examples/interpolation.feature
File renamed without changes.
View
0 spec/fixture/pending.feature → examples/pending.feature
File renamed without changes.
View
0 spec/fixture/simple_feature.feature → examples/simple_feature.feature
File renamed without changes.
View
53 examples/steps.rb
@@ -0,0 +1,53 @@
+step "there is a monster" do
+ @monster = 1
+end
+
+step "there is a strong monster" do
+ @monster = 2
+end
+
+step "I attack it" do
+ @monster -= 1
+end
+
+step "it should die" do
+ @monster.should eq(0)
+end
+
+step "this is ambiguous" do
+end
+
+step "this is ambiguous" do
+end
+
+step "there is a monster called :name" do |name|
+ @monster_name = name
+end
+
+step 'it should be called "John Smith"' do
+ @monster_name.should == "John Smith"
+end
+
+step 'it should be called "John"' do
+ @monster_name.should == "John"
+end
+
+step "there are :count monkeys with :color hair" do |count, color|
+ @monkeys = Array.new(count) { color }
+end
+
+step "there should be 3 monkeys with blue hair" do
+ @monkeys.should == [:blue, :blue, :blue]
+end
+
+placeholder :count do
+ match /\d+/ do |count|
+ count.to_i
+ end
+end
+
+placeholder :color do
+ match /blue|green|red/ do |color|
+ color.to_sym
+ end
+end
View
0 spec/fixture/tags.feature → examples/tags.feature
File renamed without changes.
View
44 spec/integration_spec.rb
@@ -0,0 +1,44 @@
+require 'spec_helper'
+
+describe 'The CLI', :type => :integration do
+ describe 'rspec -fs examples/simple_feature.feature' do
+ it "shows the correct description" do
+ result.should include('A simple feature')
+ result.should include('is a simple feature')
+ end
+
+ it "passes" do
+ result.should include('1 example, 0 failures')
+ end
+ end
+
+ describe 'rspec -fs examples/ambiguous.feature' do
+ it "fails" do
+ result.should include('1 example, 1 failure')
+ end
+ end
+
+ describe 'rspec -fs examples/backgrounds.feature' do
+ it "passes" do
+ result.should include('1 example, 0 failures')
+ end
+ end
+
+ describe 'rspec -fs examples/interpolation.feature' do
+ it "passes" do
+ result.should include('3 examples, 0 failures')
+ end
+ end
+
+ describe 'rspec -fs examples/pending.feature' do
+ it "is marked as pending" do
+ result.should include('1 example, 0 failures, 1 pending')
+ end
+ end
+
+ describe 'rspec -fs examples/tags.feature' do
+ it "passes" do
+ result.should include('2 examples, 0 failures')
+ end
+ end
+end
View
59 spec/spec_helper.rb
@@ -1,53 +1,20 @@
-step "there is a monster" do
- @monster = 1
-end
-
-step "there is a strong monster" do
- @monster = 2
-end
-
-step "I attack it" do
- @monster -= 1
-end
-
-step "it should die" do
- @monster.should eq(0)
-end
-
-step "this is ambiguous" do
-end
-
-step "this is ambiguous" do
-end
-
-step "there is a monster called :name" do |name|
- @monster_name = name
-end
-
-step 'it should be called "John Smith"' do
- @monster_name.should == "John Smith"
-end
-
-step 'it should be called "John"' do
- @monster_name.should == "John"
-end
-
-step "there are :count monkeys with :color hair" do |count, color|
- @monkeys = Array.new(count) { color }
-end
+module IntegrationHelpers
+ def command
+ example.metadata[:example_group][:description_args].first
+ end
-step "there should be 3 monkeys with blue hair" do
- @monkeys.should == [:blue, :blue, :blue]
-end
+ def run_command
+ %x(#{command})
+ end
-placeholder :count do
- match /\d+/ do |count|
- count.to_i
+ def result
+ @result ||= run_command
end
end
-placeholder :color do
- match /blue|green|red/ do |color|
- color.to_sym
+RSpec.configure do |config|
+ config.include IntegrationHelpers, :type => :integration
+ config.before(:each, :turnip => true) do
+ require File.expand_path('../examples/steps', File.dirname(__FILE__))
end
end

0 comments on commit 811e114

Please sign in to comment.
Something went wrong with that request. Please try again.