right_develop 1.2.0 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock DELETED
@@ -1,98 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- right_develop (1.2.0)
5
- actionpack (>= 2.3.0, < 4.0)
6
- builder (~> 3.0)
7
- cucumber (~> 1.0)
8
- rake (>= 0.8.7, < 0.10)
9
- right_support (~> 2.0)
10
- rspec (>= 1.3, < 3.0)
11
- trollop (>= 1.0, < 3.0)
12
-
13
- GEM
14
- remote: https://rubygems.org/
15
- specs:
16
- actionpack (2.3.17)
17
- activesupport (= 2.3.17)
18
- rack (~> 1.1.0)
19
- activesupport (2.3.17)
20
- archive-tar-minitar (0.5.2)
21
- builder (3.2.0)
22
- columnize (0.3.6)
23
- cucumber (1.2.3)
24
- builder (>= 2.1.2)
25
- diff-lcs (>= 1.1.3)
26
- gherkin (~> 2.11.6)
27
- multi_json (~> 1.3)
28
- diff-lcs (1.2.1)
29
- flexmock (0.8.11)
30
- gherkin (2.11.6)
31
- json (>= 1.7.6)
32
- git (1.2.5)
33
- jeweler (1.8.4)
34
- bundler (~> 1.0)
35
- git (>= 1.2.5)
36
- rake
37
- rdoc
38
- json (1.7.7)
39
- libxml-ruby (2.4.0)
40
- linecache (0.46)
41
- rbx-require-relative (> 0.0.4)
42
- linecache19 (0.5.12)
43
- ruby_core_source (>= 0.1.4)
44
- multi_json (1.6.1)
45
- nokogiri (1.5.6)
46
- rack (1.1.6)
47
- rake (0.9.6)
48
- rbx-require-relative (0.0.9)
49
- rdoc (4.0.0)
50
- json (~> 1.4)
51
- right_support (2.6.17)
52
- rspec (2.13.0)
53
- rspec-core (~> 2.13.0)
54
- rspec-expectations (~> 2.13.0)
55
- rspec-mocks (~> 2.13.0)
56
- rspec-core (2.13.1)
57
- rspec-expectations (2.13.0)
58
- diff-lcs (>= 1.1.3, < 2.0)
59
- rspec-mocks (2.13.0)
60
- ruby-debug (0.10.4)
61
- columnize (>= 0.1)
62
- ruby-debug-base (~> 0.10.4.0)
63
- ruby-debug-base (0.10.4)
64
- linecache (>= 0.3)
65
- ruby-debug-base19 (0.11.25)
66
- columnize (>= 0.3.1)
67
- linecache19 (>= 0.5.11)
68
- ruby_core_source (>= 0.1.4)
69
- ruby-debug19 (0.11.6)
70
- columnize (>= 0.3.1)
71
- linecache19 (>= 0.5.11)
72
- ruby-debug-base19 (>= 0.11.19)
73
- ruby_core_source (0.1.5)
74
- archive-tar-minitar (>= 0.5.2)
75
- syntax (1.0.0)
76
- trollop (2.0)
77
-
78
- PLATFORMS
79
- ruby
80
-
81
- DEPENDENCIES
82
- actionpack (>= 2.3.0, < 4.0)
83
- activesupport
84
- builder (~> 3.0)
85
- cucumber (~> 1.0)
86
- flexmock (~> 0.8.7)
87
- jeweler (~> 1.8.3)
88
- libxml-ruby (~> 2.4.0)
89
- nokogiri (~> 1.5)
90
- rake (>= 0.8.7, < 0.10)
91
- rdoc (>= 2.4.2)
92
- right_develop!
93
- right_support (~> 2.0)
94
- rspec (>= 1.3, < 3.0)
95
- ruby-debug (>= 0.10)
96
- ruby-debug19 (>= 0.11.6)
97
- syntax (~> 1.0.0)
98
- trollop (>= 1.0, < 3.0)
@@ -1,27 +0,0 @@
1
- Feature: Cucumber 1.x support
2
- In order to facilitate TDD and enhance code quality
3
- RightDevelop should provide CI tasks with Cucumber with JUnit XML output
4
- So any Ruby project can have a beautiful, info-rich Jenkins project
5
-
6
- Background:
7
- Given a Ruby application
8
- And a Gemfile
9
- And a gem dependency on 'rake ~> 0.9'
10
- And a gem dependency on 'cucumber ~> 1.0'
11
- And the Rakefile contains a RightDevelop::CI::RakeTask
12
-
13
- Scenario: passing Cucumber features
14
- Given a trivial Cucumber feature
15
- When I install the bundle
16
- And I rake 'ci:cucumber'
17
- Then the command should succeed
18
- And the output should contain '** Execute ci:cucumber'
19
- And the directory 'measurement/cucumber' should contain files
20
-
21
- Scenario: failing Cucumber features
22
- Given a trivial failing Cucumber feature
23
- When I install the bundle
24
- And I rake 'ci:cucumber'
25
- Then the command should fail
26
- And the output should contain '** Execute ci:cucumber'
27
- And the directory 'measurement/cucumber' should contain files
@@ -1,27 +0,0 @@
1
- Feature: basic Rake integration
2
- In order to promote predictable, reliable Continuous Integration
3
- RightDevelop should expose a "ci:" Rake namespace
4
-
5
- Background:
6
- Given a Ruby application
7
- And a Gemfile
8
- And a gem dependency on 'rake ~> 0.9'
9
-
10
- Scenario: list Rake tasks
11
- Given the Rakefile contains a RightDevelop::CI::RakeTask
12
- When I install the bundle
13
- And I rake '-T'
14
- And the output should contain 'ci:cucumber'
15
- And the output should contain 'ci:spec'
16
-
17
- Scenario: override namespace
18
- Given the Rakefile contains:
19
- """
20
- RightDevelop::CI::RakeTask.new do |task|
21
- task.ci_namespace = :funkalicious
22
- end
23
- """
24
- When I install the bundle
25
- And I rake '-T'
26
- Then the output should contain 'funkalicious:cucumber'
27
- Then the output should contain 'funkalicious:spec'
@@ -1,67 +0,0 @@
1
- Feature: RSpec 1.x support
2
- In order to facilitate TDD and enhance code quality
3
- RightDevelop should provide a Rake CI harness with JUnit XML output
4
- So any Ruby project can have a beautiful, info-rich Jenkins project
5
-
6
- Background:
7
- Given a Ruby application
8
- And a Gemfile
9
- And a gem dependency on 'rake ~> 0.9'
10
- And a gem dependency on 'rspec ~> 1.0'
11
- And the Rakefile contains a RightDevelop::CI::RakeTask
12
-
13
- Scenario: passing examples
14
- Given a trivial RSpec spec
15
- When I install the bundle
16
- And I rake 'ci:spec'
17
- Then the command should succeed
18
- And the file 'measurement/rspec/rspec.xml' should mention 2 passing test cases
19
- And the file 'measurement/rspec/rspec.xml' should mention 0 failing test cases
20
-
21
- Scenario: failing examples
22
- Given a trivial failing RSpec spec
23
- When I install the bundle
24
- And I rake 'ci:spec'
25
- Then the command should fail
26
- And the file 'measurement/rspec/rspec.xml' should mention 2 passing test cases
27
- And the file 'measurement/rspec/rspec.xml' should mention 1 failing test case
28
-
29
- Scenario: override input file pattern
30
- Given an RSpec spec named 'passing_spec.rb' with content:
31
- """
32
- describe String do
33
- it 'is cool' do
34
- 'cool'.should == 'cool'
35
- end
36
- end
37
- """
38
- And an RSpec spec named 'failing_spec.rb' with content:
39
- """
40
- describe String do
41
- it 'is uncool' do
42
- 'cool'.should == 'uncool'
43
- end
44
- end
45
- """
46
- And the Rakefile contains:
47
- """
48
- RightDevelop::CI::RakeTask.new do |task|
49
- task.rspec_pattern = 'spec/passing_spec.rb'
50
- end
51
- """
52
- When I install the bundle
53
- And I rake 'ci:spec'
54
- Then the command should succeed
55
-
56
- Scenario: override output file location
57
- Given a trivial RSpec spec
58
- And the Rakefile contains:
59
- """
60
- RightDevelop::CI::RakeTask.new do |task|
61
- task.rspec_output = 'awesome.xml'
62
- end
63
- """
64
- When I install the bundle
65
- And I rake 'ci:spec'
66
- Then the command should succeed
67
- And the file 'measurement/rspec/awesome.xml' should exist
@@ -1,67 +0,0 @@
1
- Feature: RSpec 2.x support
2
- In order to facilitate TDD and enhance code quality
3
- RightDevelop should provide a Rake CI harness with JUnit XML output
4
- So any Ruby project can have a beautiful, info-rich Jenkins project
5
-
6
- Background:
7
- Given a Ruby application
8
- And a Gemfile
9
- And a gem dependency on 'rake ~> 0.9'
10
- And a gem dependency on 'rspec ~> 2.0'
11
- And the Rakefile contains a RightDevelop::CI::RakeTask
12
-
13
- Scenario: passing examples
14
- And a trivial RSpec spec
15
- When I install the bundle
16
- And I rake 'ci:spec'
17
- Then the command should succeed
18
- And the file 'measurement/rspec/rspec.xml' should mention 2 passing test cases
19
- And the file 'measurement/rspec/rspec.xml' should mention 0 failing test cases
20
-
21
- Scenario: failing examples
22
- And a trivial failing RSpec spec
23
- When I install the bundle
24
- And I rake 'ci:spec'
25
- Then the command should fail
26
- And the file 'measurement/rspec/rspec.xml' should mention 2 passing test cases
27
- And the file 'measurement/rspec/rspec.xml' should mention 1 failing test case
28
-
29
- Scenario: override input file pattern
30
- Given an RSpec spec named 'passing_spec.rb' with content:
31
- """
32
- describe String do
33
- it 'is cool' do
34
- 'cool'.should == 'cool'
35
- end
36
- end
37
- """
38
- And an RSpec spec named 'failing_spec.rb' with content:
39
- """
40
- describe String do
41
- it 'is uncool' do
42
- 'cool'.should == 'uncool'
43
- end
44
- end
45
- """
46
- And the Rakefile contains:
47
- """
48
- RightDevelop::CI::RakeTask.new do |task|
49
- task.rspec_pattern = 'spec/passing_spec.rb'
50
- end
51
- """
52
- When I install the bundle
53
- And I rake 'ci:spec'
54
- Then the command should succeed
55
-
56
- Scenario: override output file location
57
- Given a trivial RSpec spec
58
- And the Rakefile contains:
59
- """
60
- RightDevelop::CI::RakeTask.new do |task|
61
- task.rspec_output = 'awesome.xml'
62
- end
63
- """
64
- When I install the bundle
65
- And I rake 'ci:spec'
66
- Then the command should succeed
67
- And the file 'measurement/rspec/awesome.xml' should exist
@@ -1,27 +0,0 @@
1
- When /^a client makes a (buggy )?request to '(.*)'$/ do |buggy, path|
2
- t = RightDevelop::Net::HTTPClient::DEFAULT_OPTIONS[:timeout]
3
- o = RightDevelop::Net::HTTPClient::DEFAULT_OPTIONS[:open_timeout]
4
- When "a client makes a #{buggy}request to '#{path}' with timeout #{t} and open_timeout #{o}"
5
- end
6
-
7
-
8
- When /^a client makes a (buggy )?request to '(.*)' with timeout (\d+) and open_timeout (\d+)$/ do |buggy, path, timeout, open_timeout|
9
- buggy = !(buggy.nil? || buggy.empty?)
10
-
11
- @mock_servers.should_not be_nil
12
- @mock_servers.size.should == 1
13
-
14
- timeout = timeout.to_i
15
- open_timeout = open_timeout.to_i
16
- url = @mock_servers.first.url
17
-
18
- @http_client = RightDevelop::Net::HTTPClient.new(:timeout=>timeout, :open_timeout=>open_timeout)
19
- @request_t0 = Time.now
20
- begin
21
- raise ArgumentError, "Fall down go boom!" if buggy
22
- @http_client.get("#{url}#{path}", {:timeout => timeout, :open_timeout => open_timeout})
23
- rescue Exception => e
24
- @request_error = e
25
- end
26
- @request_t1 = Time.now
27
- end
@@ -1,93 +0,0 @@
1
- # Rails' constantize method to convert passed in policy to the actual class
2
- def constantize(camel_cased_word)
3
- names = camel_cased_word.split('::')
4
- names.shift if names.empty? || names.first.empty?
5
-
6
- constant = Object
7
- names.each do |name|
8
- constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
9
- end
10
- constant
11
- end
12
-
13
- Given /^(\w+) balancing policy$/ do |policy|
14
- @health_check = Proc.new do |endpoint|
15
- begin
16
- RightDevelop::Net::HTTPClient.new.get(endpoint, {:timeout => 1, :open_timeout => 1})
17
- true
18
- rescue Exception => e
19
- false
20
- end
21
- end
22
-
23
- @options ||= { :policy => constantize("RightDevelop::Net::LB::" + policy), :health_check => @health_check }
24
- end
25
-
26
- When /^a client makes a (buggy )?load-balanced request to '(.*)'$/ do |buggy, path|
27
- t = RightDevelop::Net::HTTPClient::DEFAULT_OPTIONS[:timeout]
28
- o = RightDevelop::Net::HTTPClient::DEFAULT_OPTIONS[:open_timeout]
29
- step "a client makes a #{buggy}load-balanced request to '#{path}' with timeout #{t} and open_timeout #{o}"
30
- end
31
-
32
- When /^a client makes a (buggy )?load-balanced request to '(.*)' with timeout (\d+) and open_timeout (\d+)$/ do |buggy, path, timeout, open_timeout|
33
- buggy = !(buggy.nil? || buggy.empty?)
34
-
35
- @mock_servers.should_not be_nil
36
- @mock_servers.empty?.should be_false
37
-
38
- timeout = timeout.to_i
39
- open_timeout = open_timeout.to_i
40
- urls = @mock_servers.map { |s| s.url }
41
- @request_balancer = RightDevelop::Net::RequestBalancer.new(urls)
42
- @request_attempts = 0
43
- @request_t0 = Time.now
44
- @http_client = RightDevelop::Net::HTTPClient.new
45
- begin
46
- @request_balancer.request do |url|
47
- @request_attempts += 1
48
- raise ArgumentError, "Fall down go boom!" if buggy
49
- @http_client.get("#{url}#{path}", {:timeout => timeout, :open_timeout => open_timeout})
50
- end
51
- rescue Exception => e
52
- @request_error = e
53
- end
54
- @request_t1 = Time.now
55
- end
56
-
57
- Then /^the request should (\w+ ?\w*)$/ do |behavior|
58
- case behavior
59
- when 'complete'
60
- error_expected = false
61
- when 'raise'
62
- error_expected = true
63
- when /raise (\w+)/
64
- error_expected = true
65
- error_class_expected = /raise (\w+)/.match(behavior)[1]
66
- else
67
- raise ArgumentError, "Unknown request behavior #{behavior}"
68
- end
69
-
70
- if !error_expected && @request_error
71
- puts '!' * 80
72
- puts @request_error.class.inspect
73
- puts @request_error.class.superclass.inspect
74
- puts '!' * 80
75
- end
76
- @request_error.should be_nil unless error_expected
77
- @request_error.should_not be_nil if error_expected
78
- @request_error.class.name.should =~ Regexp.new(error_class_expected) if error_class_expected
79
- end
80
-
81
- Then /^the request should (\w+ ?\w*) in less than (\d+) seconds?$/ do |behavior, time|
82
- step "the request should #{behavior}"
83
- #allow 10% margin of error due to Ruby/OS scheduler variance
84
- (@request_t1.to_f - @request_t0.to_f).should <= (time.to_f * 1.10)
85
- end
86
-
87
- Then /^the request should be attempted once$/ do
88
- @request_attempts.should == 1
89
- end
90
-
91
- Then /^the request should be attempted ([0-9]+) times$/ do |n|
92
- @request_attempts.should == n.to_i
93
- end
@@ -1,206 +0,0 @@
1
- require 'nokogiri'
2
-
3
- Given /^a Ruby application$/ do
4
- ruby_app_root.should_not be_nil
5
- end
6
-
7
- Given /^a Gemfile$/ do
8
- gemfile = ruby_app_path('Gemfile')
9
- unless File.exist?(gemfile)
10
- basedir = File.expand_path('../../..', __FILE__)
11
- File.open(gemfile, 'w') do |file|
12
- file.puts "gem 'right_develop', :path=>'#{basedir}'"
13
- end
14
- end
15
- end
16
-
17
- Given /^a gem dependency on '(.*)'$/ do |dependency|
18
- step 'a Gemfile'
19
- gem, version = dependency.split(/\s+/, 2)
20
- gemfile = ruby_app_path('Gemfile')
21
- File.open(gemfile, 'a') do |file|
22
- file.puts "gem '#{gem}', '#{version}'"
23
- end
24
- end
25
-
26
- Given /^a Rakefile$/ do
27
- rakefile = ruby_app_path('Rakefile')
28
- unless File.exist?(rakefile)
29
- File.open(rakefile, 'w') do |file|
30
- file.puts "# Auto-generated by #{__FILE__}"
31
- end
32
- end
33
- end
34
-
35
- Given /^the Rakefile contains a RightDevelop::CI::RakeTask$/ do
36
- step 'a Rakefile'
37
- rakefile = ruby_app_path('Rakefile')
38
- File.open(rakefile, 'w') do |file|
39
- file.puts "require 'right_develop'"
40
- file.puts "RightDevelop::CI::RakeTask.new"
41
- end
42
- end
43
-
44
- Given /^the Rakefile contains a RightDevelop::CI::RakeTask with parameter '(.*)'$/ do |ns|
45
- step 'a Rakefile'
46
- rakefile = ruby_app_path('Rakefile')
47
- File.open(rakefile, 'w') do |file|
48
- file.puts "require 'right_develop'"
49
- file.puts "RightDevelop::CI::RakeTask.new(#{ns})"
50
- end
51
- end
52
-
53
- Given /^the Rakefile contains:$/ do |content|
54
- step 'a Rakefile'
55
- rakefile = ruby_app_path('Rakefile')
56
- File.open(rakefile, 'w') do |file|
57
- file.puts "require 'right_develop'"
58
- content.split("\n").each do |line|
59
- file.puts line
60
- end
61
- end
62
- end
63
-
64
- Given /^a trivial (failing )?RSpec spec$/ do |failing|
65
- spec_dir = ruby_app_path('spec')
66
- spec = ruby_app_path('spec', 'trivial_spec.rb')
67
- FileUtils.mkdir_p(spec_dir)
68
- File.open(spec, 'w') do |file|
69
- file.puts "describe String do"
70
- file.puts " it 'has a size' do"
71
- file.puts " 'joe'.size.should == 3"
72
- file.puts " end"
73
- file.puts
74
- file.puts " it 'is stringy' do"
75
- file.puts " pending"
76
- file.puts " end"
77
- unless failing.nil?
78
- file.puts
79
- file.puts "it 'meets an impossible ideal' do"
80
- file.puts " raise NotImplementedError, 'inconceivable!'"
81
- file.puts "end"
82
- end
83
- file.puts "end"
84
- end
85
- end
86
-
87
- Given /^an RSpec spec named '([A-Za-z0-9_.]+)' with content:$/ do |name, content|
88
- spec_dir = ruby_app_path('spec')
89
- spec = ruby_app_path('spec', name)
90
- FileUtils.mkdir_p(spec_dir)
91
- File.open(spec, 'w') do |file|
92
- content.split("\n").each do |line|
93
- file.puts line
94
- end
95
- end
96
- end
97
-
98
- Given /^a trivial (failing )?Cucumber feature$/ do |failing|
99
- features_dir = ruby_app_path('features')
100
- steps_dir = ruby_app_path('features', 'step_definitions')
101
- feature = ruby_app_path('features', 'trivial.feature')
102
- steps = ruby_app_path('features', 'step_definitions', 'trivial_steps.rb')
103
- FileUtils.mkdir_p(features_dir)
104
- FileUtils.mkdir_p(steps_dir)
105
-
106
- unless File.exist?(steps)
107
- File.open(steps, 'w') do |file|
108
- file.puts "When /^the night has come and the land is dark$/ do; end"
109
- file.puts "When /^the moon is the only light we see$/ do; end"
110
- file.puts "Then /^I won't be afraid.*$/ do; end"
111
- file.puts "Then /^as long as you stand.*by me$/ do; end"
112
- file.puts "Then /^you run away as fast as you can$/ do; raise NotImplementedError; end"
113
- end
114
- end
115
- unless File.exist?(feature)
116
- File.open(feature, 'w') do |file|
117
- file.puts "Feature: Song Lyrics from the 1950s"
118
- file.puts
119
- file.puts " Scenario: Stand By Me"
120
- file.puts " When the night has come and the land is dark"
121
- file.puts " And the moon is the only light we see"
122
- file.puts " Then I won't be afraid, oh, I won't be afraid"
123
- if failing.nil?
124
- file.puts " And as long as you stand, stand by me"
125
- else
126
- file.puts " And you run away as fast as you can"
127
- end
128
- end
129
- end
130
- end
131
-
132
- When /^I install the bundle$/ do
133
- ruby_app_shell('bundle install')
134
- end
135
-
136
- When /^I rake '(.*)'$/ do |task|
137
- @ruby_app_output = ruby_app_shell("bundle exec rake #{task} --trace ", :ignore_errors => true)
138
- end
139
-
140
- When /^I debug the app shell$/ do
141
- STDOUT.puts "Opening shell in a separate window."
142
- if RUBY_PLATFORM =~ /darwin/
143
- ruby_app_shell("open -a Terminal .")
144
- else
145
- raise "Don't know how to open an app shell for #{RUBY_PLATFORM}; please contribute your knowledge to #{__FILE__}"
146
- end
147
- STDOUT.puts "Press Enter to continue Cucumber execution..."
148
- STDOUT.flush
149
- STDIN.readline
150
- end
151
-
152
- Then /^the output should contain '(.*)'$/ do |expected_output|
153
- @ruby_app_output.should include(expected_output)
154
- end
155
-
156
- Then /^the output should not contain '(.*)'$/ do |expected_output|
157
- @ruby_app_output.should_not include(expected_output)
158
- end
159
-
160
- Then /^the directory '(.*)' should contain files/ do |dir|
161
- dir = ruby_app_path(dir)
162
- File.directory?(dir).should be_true
163
- Dir[File.join(dir, '*')].should_not be_empty
164
- end
165
-
166
- Then /^the file '(.*)' should (not )?exist?$/ do |file, negatory|
167
- file = ruby_app_path(file)
168
-
169
- if negatory.nil? || negatory.empty?
170
- Pathname.new(file).should exist
171
- else
172
- Pathname.new(file).should_not exist
173
- end
174
- end
175
-
176
- Then /^the file '(.*)' should mention ([0-9]) (passing|failing) test cases?$/ do |file, n, pass_fail|
177
- file = ruby_app_path(file)
178
- n = Integer(n)
179
-
180
- Pathname.new(file).should exist
181
-
182
- doc = Nokogiri.XML(File.open(file, 'r'))
183
-
184
- all_testcases = doc.css('testcase').size
185
- failing_testcases = doc.css('testcase failure').size
186
- passing_testcases = all_testcases - failing_testcases
187
-
188
- case pass_fail
189
- when 'passing'
190
- passing_testcases.should == n
191
- when 'failing'
192
- failing_testcases.should == n
193
- else
194
- raise NotImplementedError, "WTF #{pass_fail}"
195
- end
196
- end
197
-
198
- Then /^the command should (succeed|fail)$/ do |success|
199
- if success == 'succeed'
200
- $?.exitstatus.should == 0
201
- elsif success == 'fail'
202
- $?.exitstatus.should_not == 0
203
- else
204
- raise NotImplementedError, "Unknown expectation #{success}"
205
- end
206
- end