behave 0.2.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/examples/Rakefile +7 -0
- data/lib/behave/version.rb +1 -1
- data/lib/behave.rb +13 -9
- data/tests/behaviour_spec.rb +0 -1
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/examples/Rakefile
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rubygems'
|
3
3
|
require 'behave'
|
4
|
+
require 'cucumber'
|
5
|
+
require 'cucumber/rake'
|
4
6
|
|
5
7
|
desc "Fetch features"
|
6
8
|
task :fetch do
|
@@ -15,6 +17,11 @@ task :fetch do
|
|
15
17
|
end
|
16
18
|
|
17
19
|
desc "Run cucumber"
|
20
|
+
Cucumber::Rake::Task.new(:cucumber) do |t|
|
21
|
+
t.cucumber_opts = "features --format pretty"
|
22
|
+
end
|
23
|
+
|
24
|
+
|
18
25
|
task :default => :fetch do
|
19
26
|
|
20
27
|
end
|
data/lib/behave/version.rb
CHANGED
data/lib/behave.rb
CHANGED
@@ -43,11 +43,11 @@ module Behave
|
|
43
43
|
|
44
44
|
def fetch()
|
45
45
|
path = @host + 'rest/cucumber/1.0/project/' + @key + '/features'
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
if @user.nil? then
|
47
|
+
resource = RestClient::Resource.new(path, :content_type => 'application/zip')
|
48
|
+
else
|
49
|
+
resource = RestClient::Resource.new(path, :user => @user, :password => @pass, :content_type => 'application/zip')
|
50
|
+
end
|
51
51
|
begin
|
52
52
|
@contents = resource.get(:accept => 'application/zip', :params => {:manual => @manual})
|
53
53
|
puts '--------------------------------------------------------------'
|
@@ -61,9 +61,13 @@ module Behave
|
|
61
61
|
puts 'Could not authenticate using supplied username and password'
|
62
62
|
when 403
|
63
63
|
puts 'User forbidden (403)'
|
64
|
-
puts 'Too many attempts with this user'
|
64
|
+
puts 'Too many login attempts with this user'
|
65
|
+
when 404
|
66
|
+
puts 'Not Found (404)'
|
67
|
+
puts 'Could not find the project specified'
|
65
68
|
when 405
|
66
|
-
puts '
|
69
|
+
puts 'Behave running on server is outdated, cannot download features'
|
70
|
+
puts 'Please upgrade your version of Behave for Jira and try again'
|
67
71
|
when 406
|
68
72
|
puts 'Behave running on server is outdated, cannot download features'
|
69
73
|
puts 'Please upgrade your version of Behave for Jira and try again'
|
@@ -73,7 +77,7 @@ module Behave
|
|
73
77
|
puts 'Writing server response to error.log...'
|
74
78
|
File.open('error.log', 'w') {|f| f.write(e.response) }
|
75
79
|
else
|
76
|
-
puts
|
80
|
+
puts "Could not connect to host at '#{@host}'"
|
77
81
|
puts e.message
|
78
82
|
end
|
79
83
|
puts 'ABORTING'
|
@@ -86,7 +90,7 @@ module Behave
|
|
86
90
|
return if @contents.nil?
|
87
91
|
count = 0
|
88
92
|
Dir.mkdir(@dir) unless File.exists?(@dir)
|
89
|
-
File.open(@dir + 'features.zip', '
|
93
|
+
File.open(@dir + 'features.zip', 'wb') {|f| f.write(@contents) }
|
90
94
|
Zip::ZipFile::foreach("#{@dir}features.zip") {|feature|
|
91
95
|
path = @dir + feature.to_s
|
92
96
|
File.delete(path) if File.exists?(path)
|
data/tests/behaviour_spec.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: behave
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jack Bastow
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-10-
|
13
|
+
date: 2012-10-23 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|