flickr_fakr 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -10,4 +10,5 @@ group :test do
10
10
  gem 'rspec'
11
11
  gem 'flickraw', '= 0.8.4'
12
12
  gem 'flickraw-cached'
13
+ gem 'rest-client'
13
14
  end
@@ -12,10 +12,13 @@ GEM
12
12
  git (>= 1.2.5)
13
13
  rake
14
14
  json (1.6.1)
15
+ mime-types (1.17.2)
15
16
  rack (1.3.5)
16
17
  rack-protection (1.1.4)
17
18
  rack
18
19
  rake (0.8.7)
20
+ rest-client (1.6.7)
21
+ mime-types (>= 1.16)
19
22
  rspec (2.7.0)
20
23
  rspec-core (~> 2.7.0)
21
24
  rspec-expectations (~> 2.7.0)
@@ -37,5 +40,6 @@ DEPENDENCIES
37
40
  flickraw (= 0.8.4)
38
41
  flickraw-cached
39
42
  jeweler (~> 1.0)
43
+ rest-client
40
44
  rspec
41
45
  sinatra (~> 1.0)
data/Rakefile CHANGED
@@ -26,11 +26,16 @@ end
26
26
  Jeweler::RubygemsDotOrgTasks.new
27
27
 
28
28
  require 'rspec/core/rake_task'
29
- RSpec::Core::RakeTask.new
29
+ namespace :acceptance do
30
+ RSpec::Core::RakeTask.new do |c|
31
+ c.pattern = './spec/acceptance/**/*_spec.rb'
32
+ end
33
+ end
30
34
 
31
35
  require 'timeout'
36
+ desc 'Bootstrap and run the acceptance specs'
32
37
  task :acceptance do
33
- pid = Process.spawn 'rackup -p 9292'
38
+ pid = Process.spawn 'rackup -p 9292 -D'
34
39
 
35
40
  trap("INT") {
36
41
  Process.kill(9, pid) rescue Errno::ESRCH
@@ -42,7 +47,7 @@ task :acceptance do
42
47
  sleep 1
43
48
  end
44
49
 
45
- Rake::Task['spec'].invoke
50
+ Rake::Task['acceptance:spec'].invoke
46
51
 
47
52
  Process.kill 9, pid
48
53
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{flickr_fakr}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
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-09}
12
+ s.date = %q{2011-12-04}
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}]
@@ -34,7 +34,10 @@ Gem::Specification.new do |s|
34
34
  "lib/flickr_fakr/views/flickr.auth.getToken.json.erb",
35
35
  "lib/flickr_fakr/views/flickr.reflection.getMethods.json.erb",
36
36
  "lib/flickr_fakr/views/flickr.test.login.json.erb",
37
- "spec/reflection/getMethods_spec.rb",
37
+ "spec/acceptance/auth_getFrob_spec.rb",
38
+ "spec/acceptance/auth_getToken_spec.rb",
39
+ "spec/acceptance/reflection_getMethods_spec.rb",
40
+ "spec/acceptance/test_login_spec.rb",
38
41
  "spec/spec_helper.rb",
39
42
  "spec/support/integrate-flickr-fakr.rb"
40
43
  ]
@@ -1,6 +1,8 @@
1
1
  require 'sinatra/base'
2
2
 
3
3
  class FlickrFakr < Sinatra::Base
4
+ set :views, File.dirname(__FILE__)+'/views'
5
+
4
6
  get '/' do
5
7
  'Welcome to Flickr Fakr!'
6
8
  end
@@ -10,10 +12,7 @@ class FlickrFakr < Sinatra::Base
10
12
  end
11
13
 
12
14
  post '/services/rest/' do
13
- args = {}
14
- request.body.rewind
15
- request.body.read.split('&').each { |arg| args[arg.split('=').first] = arg.split('=').last }
16
- view = "#{args['method']}.#{args['format']}"
15
+ view = params[:method]+'.'+params[:format]
17
16
  erb view.to_sym
18
17
  end
19
18
  end
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'flickr.auth.getFrob' do
4
+ subject { flickr.auth.getFrob }
5
+ it { should == '72157628008826732-d18f7df9bfd670c3-31528' }
6
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'flickr.auth.getToken' do
4
+ subject { flickr.auth.getToken :frob => 'abc' }
5
+ its(:token) { should == '72197626744597143-36de57c6a59d1a8d' }
6
+ its(:perms) { should == 'write' }
7
+ context :user do
8
+ subject { flickr.auth.getToken(:frob => 'abc').user }
9
+ its(:nsid) { should == '13314999@N06' }
10
+ its(:username) { should == 'johnsmith' }
11
+ its(:fullname) { should == 'John Smith' }
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'flickr.test.login' do
4
+ subject { flickr.test.login }
5
+ its(:id) { should == '13314999@N06' }
6
+ its(:username) { should == 'johnsmith' }
7
+ end
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.2
5
+ version: 0.1.3
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-09 00:00:00 Z
13
+ date: 2011-12-04 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sinatra
@@ -60,7 +60,10 @@ files:
60
60
  - lib/flickr_fakr/views/flickr.auth.getToken.json.erb
61
61
  - lib/flickr_fakr/views/flickr.reflection.getMethods.json.erb
62
62
  - lib/flickr_fakr/views/flickr.test.login.json.erb
63
- - spec/reflection/getMethods_spec.rb
63
+ - spec/acceptance/auth_getFrob_spec.rb
64
+ - spec/acceptance/auth_getToken_spec.rb
65
+ - spec/acceptance/reflection_getMethods_spec.rb
66
+ - spec/acceptance/test_login_spec.rb
64
67
  - spec/spec_helper.rb
65
68
  - spec/support/integrate-flickr-fakr.rb
66
69
  homepage: http://github.com/jamesottaway/flickr_fakr
@@ -76,7 +79,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
79
  requirements:
77
80
  - - ">="
78
81
  - !ruby/object:Gem::Version
79
- hash: -4342559305998929771
82
+ hash: 3049751267208836109
80
83
  segments:
81
84
  - 0
82
85
  version: "0"