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 CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- behave (0.2)
4
+ behave (0.2.2)
5
5
  rest-client
6
6
  rubyzip
7
7
 
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
@@ -1,3 +1,3 @@
1
1
  module Behave
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.3"
3
3
  end
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
- args = { :content_type => 'application/zip' }
47
- args[:user] = @user unless @user.nil?
48
- args[:password] = @pass unless @user.nil?
49
- resource = RestClient::Resource.new(path, :user => @user, :password => @pass, :content_type => 'application/zip')
50
- #resource = RestClient::Resource.new(path, args)
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 'Method not Allowed (405)'
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 'Could not connect to host.'
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', 'w') {|f| f.write(@contents) }
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)
@@ -2,7 +2,6 @@ require "rspec"
2
2
  require "behave.rb"
3
3
 
4
4
  describe "Behave Feature Downloader" do
5
-
6
5
  it "should work" do
7
6
  pending
8
7
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: behave
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.1
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-17 00:00:00 Z
13
+ date: 2012-10-23 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec