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
10 changed files
with
135 additions
and
12 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
logs |
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,2 @@ | ||
--color | ||
--format progress |
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,11 @@ | ||
source :rubygems | ||
|
||
group :test do | ||
gem 'rspec' | ||
gem 'capybara' | ||
end | ||
|
||
# Gem should have | ||
# * convert nginx file for local development | ||
# * supports config/env.yml for development | ||
# * suy |
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,43 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
capybara (1.1.2) | ||
mime-types (>= 1.16) | ||
nokogiri (>= 1.3.3) | ||
rack (>= 1.0.0) | ||
rack-test (>= 0.5.4) | ||
selenium-webdriver (~> 2.0) | ||
xpath (~> 0.1.4) | ||
childprocess (0.3.1) | ||
ffi (~> 1.0.6) | ||
diff-lcs (1.1.3) | ||
ffi (1.0.11) | ||
mime-types (1.17.2) | ||
multi_json (1.1.0) | ||
nokogiri (1.5.2) | ||
rack (1.4.1) | ||
rack-test (0.6.1) | ||
rack (>= 1.0) | ||
rspec (2.8.0) | ||
rspec-core (~> 2.8.0) | ||
rspec-expectations (~> 2.8.0) | ||
rspec-mocks (~> 2.8.0) | ||
rspec-core (2.8.0) | ||
rspec-expectations (2.8.0) | ||
diff-lcs (~> 1.1.2) | ||
rspec-mocks (2.8.0) | ||
rubyzip (0.9.6.1) | ||
selenium-webdriver (2.20.0) | ||
childprocess (>= 0.2.5) | ||
ffi (~> 1.0) | ||
multi_json (~> 1.0) | ||
rubyzip | ||
xpath (0.1.4) | ||
nokogiri (~> 1.3) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
capybara | ||
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
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,18 @@ | ||
require 'spec_helper' | ||
|
||
feature 'Venue API' do | ||
|
||
context "GET#index" do | ||
it "works" do | ||
visit '/' | ||
page.should have_content("hello, world") | ||
end | ||
end | ||
|
||
context "GET#venues" do | ||
it "it works" do | ||
visit '/venues' | ||
json.should == [] | ||
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,22 @@ | ||
require 'rubygems' | ||
require 'bundler/setup' | ||
Bundler.require(:default, :test) | ||
|
||
require 'capybara/rspec' | ||
|
||
Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each {|f| require f} | ||
|
||
Capybara.run_server = false | ||
Capybara.app_host = "http://localhost:#{ENV_YAML['PORT']}" | ||
|
||
RSpec.configure do |config| | ||
config.treat_symbols_as_metadata_keys_with_true_values = true | ||
config.run_all_when_everything_filtered = true | ||
config.filter_run :focus | ||
|
||
def json | ||
current_html = body | ||
current_html =~ /<pre.*?>(.*)<\/pre>/ | ||
JSON.parse($1) | ||
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,5 @@ | ||
Capybara.register_driver :selenium do |app| | ||
Capybara::Selenium::Driver.new(app, :browser => :chrome) | ||
end | ||
|
||
Capybara.default_driver = :selenium |
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,5 @@ | ||
PORT: 3456 | ||
DB_HOST: 127.0.0.1 | ||
DB_NAME: venues_api_dev | ||
DB_USERNAME: jtarchie | ||
DB_PASSWORD: |
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,24 @@ | ||
ENV_YAML = YAML.load_file(File.join(File.dirname(__FILE__), "env.yml")) | ||
APP_DIR = File.dirname(__FILE__) | ||
APP_CFG = File.join(APP_DIR, "..", "..", ".env_nginx.conf") | ||
|
||
conf_file = File.read(File.join(APP_DIR, "..", "..", "nginx.conf")) | ||
conf_file.gsub!(/\$ENV_(\w+)/) do | ||
ENV_YAML[$1] | ||
end | ||
File.open(APP_CFG, "w") do |file| | ||
file.puts conf_file | ||
end | ||
|
||
BIN_DIR = '/usr/local/openresty' | ||
|
||
RSpec.configure do |config| | ||
config.before(:all) do | ||
`#{BIN_DIR}/nginx/sbin/nginx -c #{APP_CFG} -g "daemon on;"` | ||
end | ||
|
||
config.after(:all) do | ||
`rm #{APP_CFG}` | ||
`kill $(ps ax | awk '/nginx: master/ {print $1}')` | ||
end | ||
end |