Skip to content

Commit

Permalink
test environment set up
Browse files Browse the repository at this point in the history
  • Loading branch information
drewtunney committed Feb 25, 2014
1 parent dd823f9 commit bb0384f
Show file tree
Hide file tree
Showing 16 changed files with 117 additions and 52 deletions.
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--color
--format progress
16 changes: 10 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,18 @@ end

gem 'httparty'

gem 'pry-rails'

gem 'omniauth-facebook'

gem 'omniauth'

gem 'bcrypt-ruby', '~> 3.1.2'

gem 'rails_12factor', group: :production

group :development, :test do
gem 'pry-rails'
gem 'rspec-rails'
gem 'shoulda-matchers'
gem 'capybara'
gem 'launchy'
gem 'factory_girl_rails'
gem 'ffaker'
end

ruby "2.1.0"
65 changes: 41 additions & 24 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,17 @@ GEM
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
addressable (2.3.5)
arel (4.0.2)
atomic (1.1.14)
bcrypt-ruby (3.1.2)
builder (3.1.4)
capybara (2.2.1)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
coderay (1.1.0)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
Expand All @@ -37,11 +44,15 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.7.0)
diff-lcs (1.2.5)
erubis (2.7.0)
execjs (2.0.2)
faraday (0.9.0)
multipart-post (>= 1.2, < 3)
hashie (2.0.5)
factory_girl (4.4.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.4.0)
factory_girl (~> 4.4.0)
railties (>= 3.0.0)
ffaker (1.23.0)
hike (1.2.3)
httparty (0.12.0)
json (~> 1.8)
Expand All @@ -54,33 +65,19 @@ GEM
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
jwt (0.1.11)
multi_json (>= 1.5)
launchy (2.4.2)
addressable (~> 2.3)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
method_source (0.8.2)
mime-types (1.25.1)
mini_portile (0.5.2)
minitest (4.7.5)
multi_json (1.8.4)
multi_xml (0.5.5)
multipart-post (2.0.0)
oauth2 (0.9.3)
faraday (>= 0.8, < 0.10)
jwt (~> 0.1.8)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (~> 1.2)
omniauth (1.2.1)
hashie (>= 1.2, < 3)
rack (~> 1.0)
omniauth-facebook (1.6.0)
omniauth-oauth2 (~> 1.1)
omniauth-oauth2 (1.1.2)
faraday (>= 0.8, < 0.10)
multi_json (~> 1.3)
oauth2 (~> 0.9.3)
omniauth (~> 1.2)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
pg (0.17.1)
polyglot (0.3.3)
pry (0.9.12.6)
Expand Down Expand Up @@ -113,6 +110,18 @@ GEM
rake (10.1.1)
rdoc (4.1.1)
json (~> 1.4)
rspec-core (2.14.7)
rspec-expectations (2.14.4)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.4)
rspec-rails (2.14.1)
actionpack (>= 3.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
sass (3.2.14)
sass-rails (4.0.1)
railties (>= 4.0.0, < 5.0)
Expand All @@ -121,6 +130,8 @@ GEM
sdoc (0.4.0)
json (~> 1.8)
rdoc (~> 4.0, < 5.0)
shoulda-matchers (2.5.0)
activesupport (>= 3.0.0)
slop (3.4.7)
sprockets (2.10.1)
hike (~> 1.2)
Expand All @@ -144,23 +155,29 @@ GEM
uglifier (2.4.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
xpath (2.0.0)
nokogiri (~> 1.3)

PLATFORMS
ruby

DEPENDENCIES
bcrypt-ruby (~> 3.1.2)
capybara
coffee-rails (~> 4.0.0)
factory_girl_rails
ffaker
httparty
jbuilder (~> 1.2)
jquery-rails (~> 2.1)
omniauth
omniauth-facebook
launchy
pg
pry-rails
rails (= 4.0.2)
rails_12factor
rspec-rails
sass-rails (~> 4.0.0)
sdoc
shoulda-matchers
turbolinks
uglifier (>= 1.3.0)
5 changes: 2 additions & 3 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ iframe {
text-align: center;
}

.homepage_menu {
/* text-align: left;
display: inline-block;*/
#doge_form{
float: right;
}


Expand Down
4 changes: 2 additions & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<% end %>

<ul id="price">
<li id="price_nav"> Bitcoin Price: $<strong><%= get_current_price %></strong></li>
<li id="price_nav"> Doge Price (for 1,000): BTC <strong><%= doge_price_btc %></strong></li>
<li id="price_nav"> BTC: $<strong><%= get_current_price %></strong></li>
<li id="price_nav"> DOGE: BTC(1,000) <strong><%= doge_price_btc %></strong></li>
</ul>


Expand Down
2 changes: 1 addition & 1 deletion app/views/users/_btc_buy_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<input id="total" type="text" name="usd_total" readonly="true" value=<%=get_current_price%> />
</label><br><br>

<button>Submit Transaction</button>
<button>Buy/Sell BTC</button>

<p><%= flash[:error] %></p>

Expand Down
2 changes: 1 addition & 1 deletion app/views/users/_doge_buy_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<input id="total" type="text" name="usd_total" readonly="true" value=<%=doge_price_btc%> />
</label><br><br>

<button>Submit Transaction</button>
<button>Buy/Sell Doge</button>

<p><%= flash[:error] %></p>

Expand Down
1 change: 1 addition & 0 deletions app/views/users/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
document.getElementById('total').value = quantity * current_price ;
}

// ToDo: Update Doge Total Not Working
function updatedogeTotal(){

var quantity = document.getElementById('qty').value;
Expand Down
15 changes: 8 additions & 7 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ development:
timeout: 5000


# production:
# adapter: postgresql
# encoding: unicode
# database: bit_trade_db
# host: localhost
# pool: 5
# password:
test:
adapter: postgresql
encoding: unicode
database: bit_trade_test_db
user: drewtunney
host: localhost
pool: 5
timeout: 5000
8 changes: 0 additions & 8 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "accounts", force: true do |t|
t.decimal "usd", default: 25000.0
t.decimal "btc"
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "transactions", force: true do |t|
t.decimal "price"
t.decimal "btc_total"
Expand Down
9 changes: 9 additions & 0 deletions spec/factories/transaction.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FactoryGirl.define do
factory :transaction do |t|
price {("rand(400..700)").to_i}
btc_total {("rand(10)").to_i}
usd_total { price * btc_total }
buy { ("rand(0..1)").to_i }
association :user
end
end
8 changes: 8 additions & 0 deletions spec/factories/user.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FactoryGirl.define do
factory :user do
email { Faker::Internet.email }
user_name { Faker::Name.name }
password "password"
password_confirmation "password"
end
end
5 changes: 5 additions & 0 deletions spec/features/doge_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'spec_helper'

describe "a user can buy doge coin" do
let!(:doge_purchase) { Transaction.create(price: 600, btc_total: 2, usd_total: 1200, buy: 0)}
end
1 change: 1 addition & 0 deletions spec/models/transaction_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'spec_helper'
1 change: 1 addition & 0 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'spec_helper'
25 changes: 25 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rails'



# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# Require this file using `require "spec_helper"` to ensure that it is only
# loaded once.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
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

# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = 'random'
end

0 comments on commit bb0384f

Please sign in to comment.