Permalink
Browse files

Converts all hash literals to use the old 1.8 syntax

  • Loading branch information...
vesan committed Apr 29, 2012
1 parent 4dec356 commit 1eea25be057454b07c56f52f6efd482b69821614
Showing with 10 additions and 10 deletions.
  1. +3 −3 lib/kippt/collection_resource.rb
  2. +2 −2 spec/kippt/client_spec.rb
  3. +1 −1 spec/kippt/clips_spec.rb
  4. +4 −4 spec/spec_helper.rb
@@ -19,12 +19,12 @@ def collection_from_url(url)
def save_resource(object)
if object.id
- response = @client.put("#{base_uri}/#{object.id}", data: writable_parameters_from(object))
+ response = @client.put("#{base_uri}/#{object.id}", :data => writable_parameters_from(object))
else
- response = @client.post("#{base_uri}", data: writable_parameters_from(object))
+ response = @client.post("#{base_uri}", :data => writable_parameters_from(object))
end
- save_response = {success: response.success?}
+ save_response = {:success => response.success?}
if response.body["message"]
save_response[:error_message] = response.body["message"]
end
@@ -13,12 +13,12 @@
end
describe "connection" do
- subject { Kippt::Client.new(username: "bob", password: "secret") }
+ subject { Kippt::Client.new(:username => "bob", :password => "secret") }
describe "default headers" do
it "includes correct mime-type and user-agent" do
stub_request(:get, "https://bob:secret@kippt.com/foobar").
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/vnd.kippt.20120429+json', 'User-Agent'=>"KipptRubyGem #{Kippt::VERSION},vesa@vesavanska.com,https://github.com/vesan/kippt", 'X-Kippt-Client'=>"KipptRubyGem #{Kippt::VERSION},vesa@vesavanska.com,https://github.com/vesan/kippt"})
+ with(:headers => {'Accept'=>'*/*', 'Content-Type'=>'application/vnd.kippt.20120429+json', 'User-Agent'=>"KipptRubyGem #{Kippt::VERSION},vesa@vesavanska.com,https://github.com/vesan/kippt", 'X-Kippt-Client'=>"KipptRubyGem #{Kippt::VERSION},vesa@vesavanska.com,https://github.com/vesan/kippt"})
subject.get("/foobar")
end
end
View
@@ -94,7 +94,7 @@
stub_request(:delete, "https://kippt.com/api/clips/100").
to_return(:status => 200, :headers => {})
- clip = Kippt::Clip.new(id: 100)
+ clip = Kippt::Clip.new(:id => 100)
subject.destroy_resource(clip).should be_true
end
end
View
@@ -98,8 +98,8 @@ def fixture(file)
describe "attribute accessors" do
it "delegates to attributes" do
attributes.each do |attribute_name|
- subject.send(attribute_name).should eq data[attribute_name.to_s]
- end
+ subject.send(attribute_name).should eq data[attribute_name.to_s]
+ end
end
end
@@ -112,14 +112,14 @@ def fixture(file)
it "returns true" do
collection_resource.stub(:save_resource).and_return(
- {success: true})
+ {:success => true})
subject.save.should be_true
end
end
context "with invalid parameters" do
before do
- collection_resource.stub(:save_resource).and_return({success: false, error_message: "No url."})
+ collection_resource.stub(:save_resource).and_return({:success => false, :error_message => "No url."})
end
it "sets an error messages" do

0 comments on commit 1eea25b

Please sign in to comment.