crow 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/lib/crow.rb +11 -0
  2. data/spec/get_spec.rb +12 -0
  3. data/spec/spec_helper.rb +9 -0
  4. metadata +74 -0
@@ -0,0 +1,11 @@
1
+ require 'sinatra'
2
+ class Crow < Sinatra::Base
3
+ def initialize(root_path)
4
+ super
5
+ @root_path = root_path
6
+ end
7
+
8
+ get "/*" do |path|
9
+ File.read File.join(@root_path, 'get', path)
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe Crow, "get" do
4
+ it "should map top level uris to fixture files" do
5
+ HTTParty.get("http://whatever/simple_get.txt").should == "it worked\n"
6
+ end
7
+
8
+ it "should work with nested routes" do
9
+ HTTParty.get("http://whatever/people/1.json").should == "{'name': 'will'}\n"
10
+ end
11
+
12
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec'
2
+ require 'artifice'
3
+ require 'httparty'
4
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
5
+ require 'crow'
6
+
7
+ fixture_path = File.join(File.dirname(__FILE__), 'fixtures')
8
+ Artifice.activate_with Crow.new(fixture_path)
9
+
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: crow
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ version: "0.1"
9
+ platform: ruby
10
+ authors:
11
+ - Will Leinweber
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+
16
+ date: 2010-05-20 00:00:00 -05:00
17
+ default_executable:
18
+ dependencies:
19
+ - !ruby/object:Gem::Dependency
20
+ name: sinatra
21
+ prerelease: false
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ segments:
27
+ - 0
28
+ version: "0"
29
+ type: :runtime
30
+ version_requirements: *id001
31
+ description: Intended to be used with Artifice or ShamRack
32
+ email: will@bitfission.com
33
+ executables: []
34
+
35
+ extensions: []
36
+
37
+ extra_rdoc_files: []
38
+
39
+ files:
40
+ - lib/crow.rb
41
+ - spec/get_spec.rb
42
+ - spec/spec_helper.rb
43
+ has_rdoc: true
44
+ homepage: http://github.com/will/crow
45
+ licenses: []
46
+
47
+ post_install_message:
48
+ rdoc_options: []
49
+
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ requirements: []
67
+
68
+ rubyforge_project:
69
+ rubygems_version: 1.3.6
70
+ signing_key:
71
+ specification_version: 3
72
+ summary: Easy API mocking with Crow
73
+ test_files: []
74
+