steak 1.0.0.rc.2 → 1.0.0.rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -162,6 +162,7 @@ You'd do it this way:
162
162
  - Issues: http://github.com/cavalle/steak/issues
163
163
  - Group: http://groups.google.com/group/steakrb
164
164
  - IRC channel: #steakrb on freenode
165
+ - Twitter: http://twitter.com/steakrb
165
166
  - Tutorial: http://jeffkreeftmeijer.com/2010/steak-because-cucumber-is-for-vegetarians/
166
167
  - Hashtag: #steakrb
167
168
  - More resources: http://wiki.github.com/cavalle/steak/resources
data/lib/rspec-1/steak.rb CHANGED
@@ -3,8 +3,8 @@ module Spec::Example::ExampleGroupMethods
3
3
  alias background before
4
4
  end
5
5
 
6
- module Spec::DSL::Main
7
- alias feature describe
6
+ class << self
7
+ alias feature describe
8
8
  end
9
9
 
10
10
  if defined?(Spec::Rails)
data/lib/rspec-2/steak.rb CHANGED
@@ -9,14 +9,17 @@ module Steak
9
9
  end
10
10
  end
11
11
  end
12
- end
13
12
 
14
- module RSpec::Core::ObjectExtensions
15
- def feature(*args, &block)
16
- args << {} unless args.last.is_a?(Hash)
17
- args.last.update :type => :acceptance, :steak => true
18
- describe(*args, &block)
13
+ module DSL
14
+ def feature(*args, &block)
15
+ args << {} unless args.last.is_a?(Hash)
16
+ args.last.update :type => :acceptance, :steak => true, :caller => caller
17
+ describe(*args, &block)
18
+ end
19
19
  end
20
20
  end
21
21
 
22
- RSpec.configuration.include Steak::AcceptanceExampleGroup, :type => :acceptance
22
+ extend Steak::DSL
23
+
24
+ RSpec.configuration.include Steak::AcceptanceExampleGroup, :type => :acceptance
25
+
@@ -5,7 +5,6 @@ require 'tempfile'
5
5
 
6
6
  module RSpec_1
7
7
  module Factories
8
-
9
8
  def create_spec(options)
10
9
  options = {:content => options} unless options.is_a?(Hash)
11
10
  path = (options[:path] || current_dir) + "/#{String.random}_spec.rb"
@@ -44,10 +43,15 @@ module RSpec_1
44
43
 
45
44
  module HelperMethods
46
45
  def run(cmd)
47
- `rvm 1.8.7-p249@steak-rspec-1 exec #{cmd} 2>&1`.tap do |o|
48
- puts o if ENV['TRACE']
46
+ puts cmd if trace?
47
+ `rvm 1.8.7@steak-rspec-1 exec #{cmd} 2>&1`.tap do |o|
48
+ puts o if trace? and o
49
49
  end
50
50
  end
51
+
52
+ def trace?
53
+ ENV['TRACE']
54
+ end
51
55
 
52
56
  def run_spec(file_path)
53
57
  run "spec #{file_path}"
@@ -61,30 +65,26 @@ module RSpec_1
61
65
  File.expand_path(File.dirname(__FILE__) + "/../../../")
62
66
  end
63
67
  end
68
+
69
+ def self.gemset_create(gemset, *gems)
70
+ `rvm gemset create #{gemset}`
71
+ gems.each do |name|
72
+ `rvm #{gemset} gem search #{name} -i || rvm #{gemset} gem install #{name}`
73
+ end
74
+ end
64
75
 
65
76
  RSpec.configure do |config|
66
77
  config.include Factories, :example_group => { :file_path => /rspec-1/}
67
78
  config.include HelperMethods, :example_group => { :file_path => /rspec-1/}
68
- config.before :all, :example_group => { :file_path => /rspec-1/} do
69
- FileUtils.rm_rf current_dir
70
- FileUtils.mkdir_p current_dir
71
- File.open(current_dir + "/Gemfile", "w") do |file|
72
- file.write <<-Gemfile
73
- source "http://rubygems.org"
74
- gem "rspec-rails", "~> 1.3.0"
75
- gem "rails", "~> 2.3.8"
76
- gem "webrat"
77
- gem "capybara"
78
- Gemfile
79
- end
80
- Dir.chdir current_dir do
81
- `rvm gemset create steak-rspec-1`
82
- `gem install bundler`
83
- `bundle install`
84
- end
79
+ config.before :suite do
80
+ gemset_create "1.8.7@steak-rspec-1", "rspec-rails -v '~> 1.3.0'",
81
+ "rails -v '~> 2.3.8'",
82
+ "webrat",
83
+ "capybara",
84
+ "sqlite3-ruby",
85
+ "rake"
85
86
  end
86
87
  end
87
-
88
88
  end
89
89
 
90
90
  class String
@@ -47,4 +47,30 @@ feature "Acceptance spec execution", %q{
47
47
  output = run_spec spec_file
48
48
  output.should =~ /1 example, 0 failures/
49
49
  end
50
+
51
+ scenario "Steak should not pollute Object methods namespace" do
52
+ spec_file = create_spec <<-SPEC
53
+ require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
54
+
55
+ class Wadus
56
+ def call_feature
57
+ feature
58
+ end
59
+
60
+ def method_missing(meth, *args, &blk)
61
+ return "Hello!"
62
+ end
63
+ end
64
+
65
+ feature "Wadus class" do
66
+ scenario "should not be polluted by Steak" do
67
+ w = Wadus.new
68
+ w.should_not respond_to(:feature)
69
+ w.call_feature.should == "Hello!"
70
+ end
71
+ end
72
+ SPEC
73
+ output = run_spec spec_file
74
+ output.should =~ /1 example, 0 failures/
75
+ end
50
76
  end
@@ -55,6 +55,7 @@ feature "Acceptance spec execution", %q{
55
55
  scenario "should have acceptance metadata" do
56
56
  example.metadata[:type].should == :acceptance
57
57
  example.metadata[:steak].should be_true
58
+ example.metadata[:file_path].should == __FILE__
58
59
  end
59
60
  end
60
61
  SPEC
@@ -75,4 +76,46 @@ feature "Acceptance spec execution", %q{
75
76
  output = run_spec spec_file
76
77
  output.should =~ /1 example, 0 failures/
77
78
  end
79
+
80
+ scenario "Feature-level file path metadata filtering" do
81
+ spec_file = create_spec <<-SPEC
82
+ require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
83
+ RSpec.configuration.before(:each, :example_group => {:file_path => __FILE__}) do
84
+ @executed = true
85
+ end
86
+ feature "Minimal spec" do
87
+ scenario "should have run the before block" do
88
+ @executed.should be_true
89
+ end
90
+ end
91
+ SPEC
92
+ output = run_spec spec_file
93
+ output.should =~ /1 example, 0 failures/
94
+ end
95
+
96
+ scenario "Steak should not pollute Object methods namespace" do
97
+ spec_file = create_spec <<-SPEC
98
+ require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
99
+
100
+ class Wadus
101
+ def call_feature
102
+ feature
103
+ end
104
+
105
+ def method_missing(meth, *args, &blk)
106
+ return "Hello!"
107
+ end
108
+ end
109
+
110
+ feature "Wadus class" do
111
+ scenario "should not be polluted by Steak" do
112
+ w = Wadus.new
113
+ w.should_not respond_to(:feature)
114
+ w.call_feature.should == "Hello!"
115
+ end
116
+ end
117
+ SPEC
118
+ output = run_spec spec_file
119
+ output.should =~ /1 example, 0 failures/
120
+ end
78
121
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steak
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424049
4
+ hash: 15424051
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
10
  - rc
11
- - 2
12
- version: 1.0.0.rc.2
11
+ - 3
12
+ version: 1.0.0.rc.3
13
13
  platform: ruby
14
14
  authors:
15
15
  - "Luismi Cavall\xC3\xA9"
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-10-29 00:00:00 +02:00
20
+ date: 2010-11-17 00:00:00 +01:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency