Skip to content

Commit

Permalink
Merge branch 'release/v0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Pellow committed Jun 13, 2011
2 parents bb07024 + 87f6008 commit 849fefd
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 13 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ source "http://rubygems.org"

# Specify your gem's dependencies in rip_hashrocket.gemspec
gemspec

gem 'rspec'
7 changes: 7 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
require 'bundler/gem_tasks'

require 'rspec'
require "rspec/core/rake_task"
Rspec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = 'spec/**/*_spec.rb'
end

2 changes: 1 addition & 1 deletion lib/rip_hashrocket/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module RipHashrocket
VERSION = "0.0.9"
VERSION = "0.1.0"
end
52 changes: 52 additions & 0 deletions spec/rip_hashrocket/rip_hashrocket_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
require 'spec_helper'

describe RipHashrocket do
subject { RipHashrocket }

describe "#output syntax" do
it 'should replace \':a => "a"\' syntax' do
line = '{ :a => "a", :b => "b", :c => "c" }'
expected = '{ a: "a", b: "b", c: "c" }'

line.replace_rockets(line).should == expected
end

it 'should replace \':a=>"a"\' syntax' do
line = '{ :a=>"a", :b=>"b", :c=>"c" }'
expected = '{ a:"a", b:"b", c:"c" }'

line.replace_rockets(line).should == expected
end

it 'should replace \':a => "a"\' syntax, retaining whitespace' do
line = '{ :a => "a", :b => "b", :c => "c" }'
expected = '{ a: "a", b: "b", c: "c" }'

line.replace_rockets(line).should == expected
end


it 'should replace \'=>\' syntax while preserving tabbing/whitespace' do
lines = [
':name => "Someone"',
':address1 => "10 Somewhere Place"',
':city => "ACity"',
':state => "CA"',
':country => "US"',
':zip => "91634"'
]
expected = [
'name: "Someone"',
'address1: "10 Somewhere Place"',
'city: "ACity"',
'state: "CA"',
'country: "US"',
'zip: "91634"'
]

for line, i in lines.each_with_index do
line.replace_rockets(line).should == expected[i]
end
end
end
end
19 changes: 19 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'rip_hashrocket'

require "bundler"
Bundler.setup

require 'rspec'

module RipHashrocket
class Resource
def self.get(*args)
raise 'You must stub this, or should_receive at a higher level.'
end

def self.post(*args)
raise 'You must stub this, or should_receive at a higher level.'
end
end
end

11 changes: 0 additions & 11 deletions test_rb_files/test1.rb

This file was deleted.

1 change: 0 additions & 1 deletion test_rb_files/test2.rb

This file was deleted.

0 comments on commit 849fefd

Please sign in to comment.