flickr_fakr 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1 @@
1
+ rvm: 1.9.2
data/Gemfile CHANGED
@@ -1,8 +1,13 @@
1
1
  source :rubygems
2
2
 
3
3
  gem 'sinatra', '~> 1.0'
4
- gem 'haml', '~> 3.0'
5
4
 
6
5
  group :development do
7
6
  gem 'jeweler', '~> 1.0'
8
7
  end
8
+
9
+ group :test do
10
+ gem 'rspec'
11
+ gem 'flickraw', '= 0.8.4'
12
+ gem 'flickraw-cached'
13
+ end
data/Gemfile.lock CHANGED
@@ -1,16 +1,29 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ diff-lcs (1.1.3)
5
+ flickraw (0.8.4)
6
+ json (>= 1.1.1)
7
+ flickraw-cached (20100707.1)
8
+ flickraw
4
9
  git (1.2.5)
5
- haml (3.1.3)
6
10
  jeweler (1.6.4)
7
11
  bundler (~> 1.0)
8
12
  git (>= 1.2.5)
9
13
  rake
14
+ json (1.6.1)
10
15
  rack (1.3.5)
11
16
  rack-protection (1.1.4)
12
17
  rack
13
18
  rake (0.8.7)
19
+ rspec (2.7.0)
20
+ rspec-core (~> 2.7.0)
21
+ rspec-expectations (~> 2.7.0)
22
+ rspec-mocks (~> 2.7.0)
23
+ rspec-core (2.7.1)
24
+ rspec-expectations (2.7.0)
25
+ diff-lcs (~> 1.1.2)
26
+ rspec-mocks (2.7.0)
14
27
  sinatra (1.3.1)
15
28
  rack (~> 1.3, >= 1.3.4)
16
29
  rack-protection (~> 1.1, >= 1.1.2)
@@ -21,6 +34,8 @@ PLATFORMS
21
34
  ruby
22
35
 
23
36
  DEPENDENCIES
24
- haml (~> 3.0)
37
+ flickraw (= 0.8.4)
38
+ flickraw-cached
25
39
  jeweler (~> 1.0)
40
+ rspec
26
41
  sinatra (~> 1.0)
data/README.markdown ADDED
@@ -0,0 +1 @@
1
+ [![Build Status](https://secure.travis-ci.org/jamesottaway/flickr_fakr.png)](http://travis-ci.org/jamesottaway/flickr_fakr)
data/Rakefile CHANGED
@@ -24,3 +24,46 @@ Jeweler::Tasks.new do |gem|
24
24
  gem.authors = ["James Ottaway"]
25
25
  end
26
26
  Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core/rake_task'
29
+ RSpec::Core::RakeTask.new
30
+
31
+ require 'timeout'
32
+ task :acceptance do
33
+ pid = Process.spawn 'rackup -p 9292'
34
+
35
+ trap("INT") {
36
+ Process.kill(9, pid) rescue Errno::ESRCH
37
+ exit 0
38
+ }
39
+
40
+ until is_port_open?('localhost', '9292') do
41
+ puts "Waiting for FlickrFakr to start listening..."
42
+ sleep 1
43
+ end
44
+
45
+ Rake::Task['spec'].invoke
46
+
47
+ Process.kill 9, pid
48
+ end
49
+
50
+ private
51
+
52
+ def is_port_open?(ip, port)
53
+ begin
54
+ Timeout::timeout(1) do
55
+ begin
56
+ s = TCPSocket.new(ip, port)
57
+ s.close
58
+ return true
59
+ rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
60
+ return false
61
+ end
62
+ end
63
+ rescue Timeout::Error
64
+ end
65
+
66
+ return false
67
+ end
68
+
69
+ task :default => :acceptance
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/flickr_fakr.gemspec CHANGED
@@ -5,32 +5,38 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{flickr_fakr}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{James Ottaway}]
12
- s.date = %q{2011-11-07}
12
+ s.date = %q{2011-11-09}
13
13
  s.description = %q{Use flickr_fakr to help you write functional tests without having a dependency on Flickr}
14
14
  s.email = %q{james@ottaway.mp}
15
15
  s.executables = [%q{flickr_fakr}]
16
16
  s.extra_rdoc_files = [
17
- "LICENSE.txt"
17
+ "LICENSE.txt",
18
+ "README.markdown"
18
19
  ]
19
20
  s.files = [
20
21
  ".rvmrc",
22
+ ".travis.yml",
21
23
  "Gemfile",
22
24
  "Gemfile.lock",
23
25
  "LICENSE.txt",
26
+ "README.markdown",
24
27
  "Rakefile",
25
28
  "VERSION",
26
29
  "bin/flickr_fakr",
27
30
  "config.ru",
28
31
  "flickr_fakr.gemspec",
29
32
  "lib/flickr_fakr/flickr_fakr.rb",
30
- "lib/flickr_fakr/views/flickr.auth.getFrob.json.haml",
31
- "lib/flickr_fakr/views/flickr.auth.getToken.json.haml",
32
- "lib/flickr_fakr/views/flickr.reflection.getMethods.json.haml",
33
- "lib/flickr_fakr/views/flickr.test.login.json.haml"
33
+ "lib/flickr_fakr/views/flickr.auth.getFrob.json.erb",
34
+ "lib/flickr_fakr/views/flickr.auth.getToken.json.erb",
35
+ "lib/flickr_fakr/views/flickr.reflection.getMethods.json.erb",
36
+ "lib/flickr_fakr/views/flickr.test.login.json.erb",
37
+ "spec/reflection/getMethods_spec.rb",
38
+ "spec/spec_helper.rb",
39
+ "spec/support/integrate-flickr-fakr.rb"
34
40
  ]
35
41
  s.homepage = %q{http://github.com/jamesottaway/flickr_fakr}
36
42
  s.licenses = [%q{MIT}]
@@ -43,16 +49,13 @@ Gem::Specification.new do |s|
43
49
 
44
50
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
51
  s.add_runtime_dependency(%q<sinatra>, ["~> 1.0"])
46
- s.add_runtime_dependency(%q<haml>, ["~> 3.0"])
47
52
  s.add_development_dependency(%q<jeweler>, ["~> 1.0"])
48
53
  else
49
54
  s.add_dependency(%q<sinatra>, ["~> 1.0"])
50
- s.add_dependency(%q<haml>, ["~> 3.0"])
51
55
  s.add_dependency(%q<jeweler>, ["~> 1.0"])
52
56
  end
53
57
  else
54
58
  s.add_dependency(%q<sinatra>, ["~> 1.0"])
55
- s.add_dependency(%q<haml>, ["~> 3.0"])
56
59
  s.add_dependency(%q<jeweler>, ["~> 1.0"])
57
60
  end
58
61
  end
@@ -1,5 +1,4 @@
1
1
  require 'sinatra/base'
2
- require 'haml'
3
2
 
4
3
  class FlickrFakr < Sinatra::Base
5
4
  get '/' do
@@ -15,6 +14,6 @@ class FlickrFakr < Sinatra::Base
15
14
  request.body.rewind
16
15
  request.body.read.split('&').each { |arg| args[arg.split('=').first] = arg.split('=').last }
17
16
  view = "#{args['method']}.#{args['format']}"
18
- haml view.to_sym
17
+ erb view.to_sym
19
18
  end
20
19
  end
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'flickr.reflection.getMethods' do
4
+ subject { flickr.reflection.getMethods }
5
+ its(:size) { should == 183 }
6
+ end
@@ -0,0 +1,14 @@
1
+ require 'flickraw-cached'
2
+
3
+ Dir[File.join(File.dirname(__FILE__),"../spec/support/**/*.rb")].each { |f| require f }
4
+
5
+ RSpec.configure do |config|
6
+ config.mock_with :rspec
7
+ end
8
+
9
+ FlickRaw.api_key = 'api'
10
+ FlickRaw.shared_secret = 'secret'
11
+
12
+ def flickr
13
+ @flickr ||= FlickRaw::Flickr.new
14
+ end
@@ -0,0 +1,23 @@
1
+ require 'flickraw-cached'
2
+ require 'net/http'
3
+ require 'uri'
4
+
5
+ class Net::HTTP
6
+ class << self
7
+ alias start_original start
8
+
9
+ def start address, *arg, &block
10
+ if address.is_a? URI
11
+ self.start_original address.host, address.port, *arg, &block
12
+ else
13
+ self.start_original address, *arg, &block
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ flickr_fakr = URI.parse 'http://localhost:9292/'
20
+ FlickRaw.const_set :FLICKR_HOST, flickr_fakr
21
+
22
+ flickr_fakr_auth_url = FlickRaw.const_get(:AUTH_PATH).gsub('http://flickr.com', "http://localhost:9292")
23
+ FlickRaw.const_set :AUTH_PATH, flickr_fakr_auth_url
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: flickr_fakr
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.1
5
+ version: 0.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Ottaway
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-11-07 00:00:00 Z
13
+ date: 2011-11-09 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sinatra
@@ -23,20 +23,9 @@ dependencies:
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: haml
28
- requirement: &id002 !ruby/object:Gem::Requirement
29
- none: false
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: "3.0"
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: *id002
37
26
  - !ruby/object:Gem::Dependency
38
27
  name: jeweler
39
- requirement: &id003 !ruby/object:Gem::Requirement
28
+ requirement: &id002 !ruby/object:Gem::Requirement
40
29
  none: false
41
30
  requirements:
42
31
  - - ~>
@@ -44,7 +33,7 @@ dependencies:
44
33
  version: "1.0"
45
34
  type: :development
46
35
  prerelease: false
47
- version_requirements: *id003
36
+ version_requirements: *id002
48
37
  description: Use flickr_fakr to help you write functional tests without having a dependency on Flickr
49
38
  email: james@ottaway.mp
50
39
  executables:
@@ -53,21 +42,27 @@ extensions: []
53
42
 
54
43
  extra_rdoc_files:
55
44
  - LICENSE.txt
45
+ - README.markdown
56
46
  files:
57
47
  - .rvmrc
48
+ - .travis.yml
58
49
  - Gemfile
59
50
  - Gemfile.lock
60
51
  - LICENSE.txt
52
+ - README.markdown
61
53
  - Rakefile
62
54
  - VERSION
63
55
  - bin/flickr_fakr
64
56
  - config.ru
65
57
  - flickr_fakr.gemspec
66
58
  - lib/flickr_fakr/flickr_fakr.rb
67
- - lib/flickr_fakr/views/flickr.auth.getFrob.json.haml
68
- - lib/flickr_fakr/views/flickr.auth.getToken.json.haml
69
- - lib/flickr_fakr/views/flickr.reflection.getMethods.json.haml
70
- - lib/flickr_fakr/views/flickr.test.login.json.haml
59
+ - lib/flickr_fakr/views/flickr.auth.getFrob.json.erb
60
+ - lib/flickr_fakr/views/flickr.auth.getToken.json.erb
61
+ - lib/flickr_fakr/views/flickr.reflection.getMethods.json.erb
62
+ - lib/flickr_fakr/views/flickr.test.login.json.erb
63
+ - spec/reflection/getMethods_spec.rb
64
+ - spec/spec_helper.rb
65
+ - spec/support/integrate-flickr-fakr.rb
71
66
  homepage: http://github.com/jamesottaway/flickr_fakr
72
67
  licenses:
73
68
  - MIT
@@ -81,7 +76,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
76
  requirements:
82
77
  - - ">="
83
78
  - !ruby/object:Gem::Version
84
- hash: -3572082499673447201
79
+ hash: -4342559305998929771
85
80
  segments:
86
81
  - 0
87
82
  version: "0"