acts_as_caesar 0.0.7 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc CHANGED
@@ -1,16 +1,10 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- if ! rvm list | grep ruby-1.9.3 ; then
4
- rvm install 1.9.3
3
+ if ! rvm list | grep -q ruby-1.9.3-p194 ; then
4
+ rvm install 1.9.3-p194
5
5
  fi
6
6
 
7
- rvm 1.9.3
8
-
9
- if ! rvm gemset list | grep platformq_acts_as_caesar ; then
10
- rvm gemset create platformq_acts_as_caesar
11
- fi
12
-
13
- rvm 1.9.3@platformq_acts_as_caesar
7
+ rvm 1.9.3-p194@platformq_acts_as_caesar --create
14
8
 
15
9
  if ! gem list | grep -q bundler ; then
16
10
  gem install --no-ri --no-rdoc bundler
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  s.add_dependency 'redis', '~> 3'
22
- s.add_dependency 'json', '~> 1.6.6'
22
+ s.add_dependency 'multi_json', '~> 1.3'
23
23
 
24
24
  # testing only
25
25
  s.add_development_dependency 'rspec', '~> 2.8'
@@ -1,6 +1,6 @@
1
1
  require 'acts_as_caesar/objects/voter'
2
2
  require 'acts_as_caesar/objects/candidate'
3
- require 'json'
3
+ require 'multi_json'
4
4
  require 'rack/request'
5
5
 
6
6
  module Rack
@@ -41,7 +41,7 @@ module Rack
41
41
  voter.vote_placed_on(c)
42
42
  end
43
43
  # return an array of vote objects
44
- [200, {"Content-Type" => "application/json"}, [JSON.generate(votes.map(&:to_json))]]
44
+ [200, {"Content-Type" => "application/json"}, [MultiJson.dump(votes.map(&:to_json))]]
45
45
  end
46
46
 
47
47
  def update_vote(voter, candidate, value)
@@ -49,7 +49,7 @@ module Rack
49
49
  candidate = ::ActsAsCaesar::Candidate.new(candidate)
50
50
  vote = voter.update_vote(candidate, value)
51
51
  # return the vote object
52
- [200, {"Content-Type" => "application/json"}, [JSON.generate(vote.to_json)]]
52
+ [200, {"Content-Type" => "application/json"}, [MultiJson.dump(vote.to_json)]]
53
53
  end
54
54
 
55
55
  def not_found
@@ -1,3 +1,3 @@
1
1
  module ActsAsCaesar
2
- VERSION = "0.0.7"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
  require_relative '../lib/acts_as_caesar/rack'
3
- require 'json'
3
+ require 'multi_json'
4
4
  require 'rack/test'
5
5
 
6
6
  ENV['RACK_ENV'] = 'test'
@@ -44,7 +44,7 @@ describe Rack::ActsAsCaesar do
44
44
  end
45
45
 
46
46
  context "the JSON response" do
47
- subject { JSON.parse(last_response.body) }
47
+ subject { MultiJson.load(last_response.body) }
48
48
 
49
49
  it { should be_kind_of Array }
50
50
 
@@ -78,7 +78,7 @@ describe Rack::ActsAsCaesar do
78
78
  end
79
79
 
80
80
  it "should return a JSON encoded string of the new vote" do
81
- vote = JSON.parse(last_response.body)
81
+ vote = MultiJson.load(last_response.body)
82
82
  vote['candidate'].should == 'candidate_1'
83
83
  vote['voter'].should == 'voter_1'
84
84
  vote['value'].should == -1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_caesar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-13 00:00:00.000000000 Z
12
+ date: 2012-07-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis
@@ -28,13 +28,13 @@ dependencies:
28
28
  - !ruby/object:Gem::Version
29
29
  version: '3'
30
30
  - !ruby/object:Gem::Dependency
31
- name: json
31
+ name: multi_json
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: 1.6.6
37
+ version: '1.3'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: 1.6.6
45
+ version: '1.3'
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: rspec
48
48
  requirement: !ruby/object:Gem::Requirement