Skip to content
Browse files

- Removed rspec2 references

- Added Faraday stub in projects
- Changed rspec2 references in Rakefile
- Added rspec1.3 and ticketmaster gems
  • Loading branch information...
1 parent 3b3fafa commit 227ffa0f7309285bf1f43548f552f3221b80096f @chischaschos chischaschos committed
Showing with 83 additions and 43 deletions.
  1. +1 −1 .gitignore
  2. +1 −0 .rvmrc
  3. +4 −6 Gemfile
  4. +48 −0 Gemfile.lock
  5. +3 −21 Rakefile
  6. +1 −2 lib/codaset/codaset-api.rb
  7. +19 −9 spec/projects_spec.rb
  8. +5 −0 spec/spec.opts
  9. +1 −4 spec/spec_helper.rb
View
2 .gitignore
@@ -39,4 +39,4 @@ pkg
#.\#*
#
# For vim:
-#*.swp
+*.swp
View
1 .rvmrc
@@ -0,0 +1 @@
+rvm 1.8.7@ticketmaster-codaset --create
View
10 Gemfile
@@ -1,12 +1,10 @@
source "http://rubygems.org"
-# Add dependencies required to use your gem here.
-# Example:
-# gem "activesupport", ">= 2.3.5"
-# Add dependencies to develop your gem here.
-# Include everything needed to run rake, tests, features, etc.
+gem 'ticketmaster', '0.5.2'
+gem 'oauth2'
+
group :development do
- gem "rspec", "~> 2.1.0"
+ gem "rspec", "1.3.0"
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.5.1"
gem "rcov", ">= 0"
View
48 Gemfile.lock
@@ -0,0 +1,48 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ activemodel (3.0.3)
+ activesupport (= 3.0.3)
+ builder (~> 2.1.2)
+ i18n (~> 0.4)
+ activeresource (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ activesupport (3.0.3)
+ addressable (2.2.2)
+ builder (2.1.2)
+ faraday (0.5.4)
+ addressable (~> 2.2.2)
+ multipart-post (~> 1.1.0)
+ rack (>= 1.1.0, < 2)
+ git (1.2.5)
+ hashie (0.3.0)
+ i18n (0.5.0)
+ jeweler (1.5.2)
+ bundler (~> 1.0.0)
+ git (>= 1.2.5)
+ rake
+ multi_json (0.0.5)
+ multipart-post (1.1.0)
+ oauth2 (0.1.0)
+ faraday (~> 0.5.0)
+ multi_json (~> 0.0.4)
+ rack (1.2.1)
+ rake (0.8.7)
+ rcov (0.9.9)
+ rspec (1.3.0)
+ ticketmaster (0.5.2)
+ activeresource (>= 2.3.2)
+ activesupport (>= 2.3.2)
+ hashie (<= 0.3.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bundler (~> 1.0.0)
+ jeweler (~> 1.5.1)
+ oauth2
+ rcov
+ rspec (= 1.3.0)
+ ticketmaster (= 0.5.2)
View
24 Rakefile
@@ -26,25 +26,7 @@ Jeweler::Tasks.new do |gem|
end
Jeweler::RubygemsDotOrgTasks.new
-require 'rspec/core'
-require 'rspec/core/rake_task'
-RSpec::Core::RakeTask.new(:spec) do |spec|
- spec.pattern = FileList['spec/**/*_spec.rb']
-end
-
-RSpec::Core::RakeTask.new(:rcov) do |spec|
- spec.pattern = 'spec/**/*_spec.rb'
- spec.rcov = true
-end
-
-task :default => :spec
-
-require 'rake/rdoctask'
-Rake::RDocTask.new do |rdoc|
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
-
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = "ticketmaster-codaset #{version}"
- rdoc.rdoc_files.include('README*')
- rdoc.rdoc_files.include('lib/**/*.rb')
+require 'spec/rake/spectask'
+Spec::Rake::SpecTask.new do |t|
+ t.spec_files = FileList['spec/**/*_spec.rb']
end
View
3 lib/codaset/codaset-api.rb
@@ -49,8 +49,7 @@ def access_token(master)
{:url => master.site,
:ssl => {:verify => OpenSSL::SSL::VERIFY_NONE,
:ca_file => nil
- },
- :adapter => :NetHttp
+ }
},
:authorize_url => @auth_url,
:parse_json => true})
View
28 spec/projects_spec.rb
@@ -5,15 +5,25 @@
headers = {'Authorization' => 'OAuth 01234567890abcdef', 'Content-type' => 'application/x-www-form-urlencoded'}
@project_id = 'my-project'
ActiveResource::HttpMock.respond_to do |mock|
- mock.get '/projects.xml', headers, fixture_for('projects'), 200
- mock.get '/my-project.xml', headers, fixture_for('my-project'), 200
- mock.post '/projects.xml', headers, fixture_for('projects'), 200
- mock.put '/my-project.xml', headers, '', 200
- mock.delete '/my-project.xml', headers, '', 200
+ mock.get '/anymoto/projects.json', headers, fixture_for('projects'), 200
+ mock.get '/anymoto/my-project.json', headers, fixture_for('my-project'), 200
+ mock.post '/anymoto/projects.json', headers, fixture_for('projects'), 200
+ mock.put '/anymoto/my-project.json', headers, '', 200
+ mock.delete '/anymoto/my-project.json', headers, '', 200
end
- end
-
- before(:each) do
+
+ stubs = Faraday::Adapter::Test::Stubs.new do |stub|
+ ACCESS_TOKEN = { "access_token" => "01234567890abcdef", "refresh_token" => "01234567890abcdef", "expires_in" => 1209600, "username" => "myusername" }
+ stub.post('/authorization/token') { [200, {}, ACCESS_TOKEN.to_json] }
+ end
+
+ new_method = Faraday::Connection.method(:new)
+ Faraday::Connection.stub(:new) do |*args|
+ connection = new_method.call(*args) do |builder|
+ builder.adapter :test, stubs
+ end
+ end
+
@ticketmaster = TicketMaster.new(:codaset, {:username => 'anymoto', :password => '000000', :client_id => '07f16ec71c324ab053885212ad65a6cc', :client_secret => '442fe0b16ff1143602e89ea923cbabc50'})
@klass = TicketMaster::Provider::Codaset::Project
end
@@ -60,4 +70,4 @@
@project.should be_an_instance_of(@klass)
end
-end
+end
View
5 spec/spec.opts
@@ -0,0 +1,5 @@
+--colour
+--format progress
+--loadby mtime
+--reverse
+
View
5 spec/spec_helper.rb
@@ -1,12 +1,9 @@
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'rubygems'
+require 'spec'
require 'ticketmaster'
require 'ticketmaster-codaset'
-Faraday.default_adapter = :test
-RSpec.configure do |config|
-
-end
def fixture_for(name)
File.read(File.dirname(__FILE__) + '/fixtures/' + name + '.xml')

0 comments on commit 227ffa0

Please sign in to comment.
Something went wrong with that request. Please try again.