diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..5f16476 --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--color +--format progress diff --git a/Gemfile b/Gemfile index f6a5d90..a6b503a 100644 --- a/Gemfile +++ b/Gemfile @@ -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" \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 609ceba..0e8c6ca 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 40d5c8e..411ce33 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -59,9 +59,8 @@ iframe { text-align: center; } -.homepage_menu { -/* text-align: left; - display: inline-block;*/ +#doge_form{ + float: right; } diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 4d2a6fe..31f420d 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -16,8 +16,8 @@ <% end %> diff --git a/app/views/users/_btc_buy_form.html.erb b/app/views/users/_btc_buy_form.html.erb index 410d159..5a96927 100644 --- a/app/views/users/_btc_buy_form.html.erb +++ b/app/views/users/_btc_buy_form.html.erb @@ -26,7 +26,7 @@ />

- +

<%= flash[:error] %>

diff --git a/app/views/users/_doge_buy_form.html.erb b/app/views/users/_doge_buy_form.html.erb index b9f9cbc..24173ec 100644 --- a/app/views/users/_doge_buy_form.html.erb +++ b/app/views/users/_doge_buy_form.html.erb @@ -26,7 +26,7 @@ />

- +

<%= flash[:error] %>

diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 36618b4..df47209 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -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; diff --git a/config/database.yml b/config/database.yml index d0f6428..8c1d293 100644 --- a/config/database.yml +++ b/config/database.yml @@ -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 \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index b90920b..a381d5e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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" diff --git a/spec/factories/transaction.rb b/spec/factories/transaction.rb new file mode 100644 index 0000000..372e756 --- /dev/null +++ b/spec/factories/transaction.rb @@ -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 \ No newline at end of file diff --git a/spec/factories/user.rb b/spec/factories/user.rb new file mode 100644 index 0000000..df0012b --- /dev/null +++ b/spec/factories/user.rb @@ -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 \ No newline at end of file diff --git a/spec/features/doge_spec.rb b/spec/features/doge_spec.rb new file mode 100644 index 0000000..96f209b --- /dev/null +++ b/spec/features/doge_spec.rb @@ -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 \ No newline at end of file diff --git a/spec/models/transaction_spec.rb b/spec/models/transaction_spec.rb new file mode 100644 index 0000000..335cafc --- /dev/null +++ b/spec/models/transaction_spec.rb @@ -0,0 +1 @@ +require 'spec_helper' \ No newline at end of file diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb new file mode 100644 index 0000000..335cafc --- /dev/null +++ b/spec/models/user_spec.rb @@ -0,0 +1 @@ +require 'spec_helper' \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..fc7466f --- /dev/null +++ b/spec/spec_helper.rb @@ -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