-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
81 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ source "http://rubygems.org" | |
|
||
# Specify your gem's dependencies in rip_hashrocket.gemspec | ||
gemspec | ||
|
||
gem 'rspec' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.