diff --git a/Gemfile b/Gemfile index ffbb4bf7..1d3a8867 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source :rubygems -gem 'rails', '3.2.11' +gem 'rails', '3.2.13' gem 'rack-cors', :require => 'rack/cors' # Bundle edge Rails instead: @@ -36,7 +36,7 @@ gem 'simply_stored' , :git => 'git://github.com/bterkuile/simply_stored.git' gem 'devise', '2.0.4' gem 'devise_simply_stored' gem 'simple_form' -gem 'active_decorator' +gem 'active_decorator', path: '/Users/bterkuile/companytools/development/rails/components/active_decorator' gem 'cmtool', github: 'bterkuile/cmtool' gem 'kaminari' @@ -65,6 +65,7 @@ group :test do gem 'rspec-rails' gem 'cucumber-rails' gem 'poltergeist' + gem 'selenium-webdriver' gem 'database_cleaner' gem 'rb-fsevent', :require => false #if RUBY_PLATFORM =~ /darwin/i gem 'ruby_gntp' diff --git a/Gemfile.lock b/Gemfile.lock index 76d2f3a6..22bf12cb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -34,56 +34,59 @@ GIT couch_potato (>= 0.2.15) rest-client (>= 1.4.2) +PATH + remote: /Users/bterkuile/companytools/development/rails/components/active_decorator + specs: + active_decorator (0.3.4) + GEM remote: http://rubygems.org/ specs: - actionmailer (3.2.11) - actionpack (= 3.2.11) - mail (~> 2.4.4) - actionpack (3.2.11) - activemodel (= 3.2.11) - activesupport (= 3.2.11) + actionmailer (3.2.13) + actionpack (= 3.2.13) + mail (~> 2.5.3) + actionpack (3.2.13) + activemodel (= 3.2.13) + activesupport (= 3.2.13) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.4) - rack (~> 1.4.0) + rack (~> 1.4.5) rack-cache (~> 1.2) rack-test (~> 0.6.1) sprockets (~> 2.2.1) - active_decorator (0.3.4) - activemodel (3.2.11) - activesupport (= 3.2.11) + activemodel (3.2.13) + activesupport (= 3.2.13) builder (~> 3.0.0) - activerecord (3.2.11) - activemodel (= 3.2.11) - activesupport (= 3.2.11) + activerecord (3.2.13) + activemodel (= 3.2.13) + activesupport (= 3.2.13) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.11) - activemodel (= 3.2.11) - activesupport (= 3.2.11) - activesupport (3.2.11) - i18n (~> 0.6) + activeresource (3.2.13) + activemodel (= 3.2.13) + activesupport (= 3.2.13) + activesupport (3.2.13) + i18n (= 0.6.1) multi_json (~> 1.0) addressable (2.3.3) arel (3.0.2) bcrypt-ruby (3.0.1) - bootstrap-sass (2.3.0.1) + bootstrap-sass (2.3.1.0) sass (~> 3.2) - bourbon (3.1.1) + bourbon (3.1.2) sass (>= 3.2.0) thor builder (3.0.4) - capybara (2.0.2) + capybara (2.1.0) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) - selenium-webdriver (~> 2.0) - xpath (~> 1.0.0) + xpath (~> 2.0) childprocess (0.3.9) ffi (~> 1.0, >= 1.0.11) - chunky_png (1.2.7) + chunky_png (1.2.8) climate_control (0.0.3) activesupport (>= 3.0) cocaine (0.5.1) @@ -95,7 +98,7 @@ GEM coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.5.0) + coffee-script-source (1.6.2) compass (0.12.2) chunky_png (~> 1.2) fssm (>= 0.2.7) @@ -106,15 +109,16 @@ GEM mime-types (~> 1.15) multi_json (~> 1.0) rest-client (~> 1.6.1) - cucumber (1.2.3) + cucumber (1.2.5) builder (>= 2.1.2) diff-lcs (>= 1.1.3) - gherkin (~> 2.11.6) + gherkin (~> 2.11.7) multi_json (~> 1.3) - cucumber-rails (1.3.0) + cucumber-rails (1.3.1) capybara (>= 1.1.2) - cucumber (>= 1.1.8) + cucumber (>= 1.2.0) nokogiri (>= 1.5.0) + rails (~> 3.0) daemons (1.1.9) database_cleaner (0.9.1) devise (2.0.4) @@ -124,11 +128,11 @@ GEM warden (~> 1.1.1) devise_simply_stored (0.0.3) devise - diff-lcs (1.2.1) - email_validator (1.3.0) + diff-lcs (1.2.2) + email_validator (1.4.0) activemodel erubis (2.7.0) - eventmachine (1.0.1) + eventmachine (1.0.3) execjs (1.4.0) multi_json (~> 1.0) factory_girl (4.2.0) @@ -136,31 +140,32 @@ GEM factory_girl_rails (4.2.1) factory_girl (~> 4.2.0) railties (>= 3.0.0) - faye-websocket (0.4.6) + faye-websocket (0.4.7) eventmachine (>= 0.12.0) - ffi (1.4.0) + ffi (1.6.0) + formatador (0.2.4) fssm (0.2.10) - gherkin (2.11.6) - json (>= 1.7.6) - guard (1.6.2) + gherkin (2.11.8) + multi_json (~> 1.3) + guard (1.7.0) + formatador (>= 0.2.4) listen (>= 0.6.0) lumberjack (>= 1.0.2) pry (>= 0.9.10) - terminal-table (>= 1.4.3) thor (>= 0.14.6) - guard-rspec (2.4.1) + guard-rspec (2.5.2) guard (>= 1.1) rspec (~> 2.11) - haml (4.0.0) + haml (4.0.2) tilt haml-rails (0.4) actionpack (>= 3.1, < 4.1) activesupport (>= 3.1, < 4.1) haml (>= 3.1, < 4.1) railties (>= 3.1, < 4.1) - hike (1.2.1) + hike (1.2.2) http_parser.rb (0.5.3) - i18n (0.6.4) + i18n (0.6.1) journey (1.0.4) jquery-rails (2.2.1) railties (>= 3.0, < 5.0) @@ -174,18 +179,18 @@ GEM letter_opener (1.1.0) launchy (~> 2.2.0) listen (0.7.3) - lumberjack (1.0.2) - mail (2.4.4) + lumberjack (1.0.3) + mail (2.5.3) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) method_source (0.8.1) - mime-types (1.21) + mime-types (1.22) mini_magick (3.5.0) subexec (~> 0.2.1) - multi_json (1.6.1) + multi_json (1.7.2) mustache (0.99.4) - nokogiri (1.5.6) + nokogiri (1.5.9) orm_adapter (0.0.7) paperclip (3.4.1) activemodel (>= 3.0.0) @@ -193,12 +198,10 @@ GEM activesupport (>= 3.0.0) cocaine (~> 0.5.0) mime-types - poltergeist (1.0.2) - capybara (> 1.1) - childprocess (~> 0.3) + poltergeist (1.1.0) + capybara (~> 2.0, >= 2.0.1) faye-websocket (~> 0.4, >= 0.4.4) http_parser.rb (~> 0.5.3) - multi_json (~> 1.0) polyglot (0.3.3) pry (0.9.12) coderay (~> 1.0.5) @@ -215,22 +218,22 @@ GEM rack rack-test (0.6.2) rack (>= 1.0) - rails (3.2.11) - actionmailer (= 3.2.11) - actionpack (= 3.2.11) - activerecord (= 3.2.11) - activeresource (= 3.2.11) - activesupport (= 3.2.11) + rails (3.2.13) + actionmailer (= 3.2.13) + actionpack (= 3.2.13) + activerecord (= 3.2.13) + activeresource (= 3.2.13) + activesupport (= 3.2.13) bundler (~> 1.0) - railties (= 3.2.11) - railties (3.2.11) - actionpack (= 3.2.11) - activesupport (= 3.2.11) + railties (= 3.2.13) + railties (3.2.13) + actionpack (= 3.2.13) + activesupport (= 3.2.13) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) - rake (10.0.3) + rake (10.0.4) rb-fsevent (0.9.3) rdoc (3.12.2) json (~> 1.4) @@ -241,10 +244,10 @@ GEM rspec-core (~> 2.13.0) rspec-expectations (~> 2.13.0) rspec-mocks (~> 2.13.0) - rspec-core (2.13.0) + rspec-core (2.13.1) rspec-expectations (2.13.0) diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.13.0) + rspec-mocks (2.13.1) rspec-rails (2.13.0) actionpack (>= 3.0) activesupport (>= 3.0) @@ -254,12 +257,12 @@ GEM rspec-mocks (~> 2.13.0) ruby_gntp (0.3.4) rubyzip (0.9.9) - sass (3.2.6) + sass (3.2.7) sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) - selenium-webdriver (2.31.0) + selenium-webdriver (2.32.0) childprocess (>= 0.2.5) multi_json (~> 1.0) rubyzip @@ -267,49 +270,48 @@ GEM simple_form (2.1.0) actionpack (~> 3.0) activemodel (~> 3.0) - slim (1.3.6) - temple (~> 0.5.5) + slim (1.3.7) + temple (~> 0.6.3) tilt (~> 1.3.3) - slim-rails (1.1.0) + slim-rails (1.1.1) actionpack (>= 3.0, < 4.1) activesupport (>= 3.0, < 4.1) railties (>= 3.0, < 4.1) slim (~> 1.3) - slop (3.4.3) + slop (3.4.4) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) subexec (0.2.2) - temple (0.5.5) - terminal-table (1.4.5) - thin (1.5.0) + temple (0.6.3) + thin (1.5.1) daemons (>= 1.0.9) eventmachine (>= 0.12.6) rack (>= 1.0.0) - thor (0.17.0) - tilt (1.3.4) + thor (0.18.1) + tilt (1.3.7) tinymce-rails (3.5.8.1) railties (>= 3.1.1) treetop (1.4.12) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.35) - uglifier (1.3.0) + tzinfo (0.3.37) + uglifier (2.0.1) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) warden (1.1.1) rack (>= 1.0) websocket (1.0.7) - xpath (1.0.0) + xpath (2.0.0) nokogiri (~> 1.3) PLATFORMS ruby DEPENDENCIES - active_decorator + active_decorator! bootstrap-sass bourbon cmtool! @@ -332,12 +334,13 @@ DEPENDENCIES pry quiet_assets rack-cors - rails (= 3.2.11) + rails (= 3.2.13) rb-fsevent rqrcode rspec-rails ruby_gntp sass-rails (~> 3.2.3) + selenium-webdriver simple_form simply_stored! slim-rails diff --git a/app/assets/images/logo.svg b/app/assets/images/logo.svg index d123c509..f42c0310 100644 --- a/app/assets/images/logo.svg +++ b/app/assets/images/logo.svg @@ -126,13 +126,13 @@ guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:window-width="1122" - inkscape:window-height="852" + inkscape:window-width="1435" + inkscape:window-height="860" id="namedview43" showgrid="false" inkscape:zoom="6.34" - inkscape:cx="51.171527" - inkscape:cy="47.772468" + inkscape:cx="35.062165" + inkscape:cy="30.642055" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="0" @@ -143,12 +143,12 @@ Q + inkscape:export-ydpi="112.82128" /> WAITE + y="69.109116" + x="23.631485" + dx="0 0">QWAITER + + R + xml:space="preserve" + style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans" + x="35.962147" + y="74.290222" + id="text3028" + sodipodi:linespacing="125%"> \ No newline at end of file diff --git a/config/application.rb b/config/application.rb index a83ae7ae..a48f6249 100644 --- a/config/application.rb +++ b/config/application.rb @@ -26,6 +26,14 @@ module JSON end end end +MultiJson.engine = :json_gem + +require 'simply_stored' +module SimplyStored::Couch + def freeze + self + end +end module Qwaiter class Application < Rails::Application diff --git a/features/support/env.rb b/features/support/env.rb index 197e3952..bd70d39f 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -6,16 +6,19 @@ require 'cucumber/rails' require 'capybara/poltergeist' -#Capybara.javascript_driver = :poltergeist +poltergeist = false # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In # order to ease the transition to Capybara we set the default here. If you'd # prefer to use XPath just remove this line and adjust any selectors in your # steps to use the XPath syntax. Capybara.default_selector = :css - -Capybara.register_driver :selenium do |app| - #Capybara::Selenium::Driver.new(app, :browser => :chrome) - Capybara::Selenium::Driver.new(app, :browser => :firefox) +if poltergeist + Capybara.javascript_driver = :poltergeist +else + Capybara.register_driver :selenium do |app| + #Capybara::Selenium::Driver.new(app, :browser => :chrome) + Capybara::Selenium::Driver.new(app, :browser => :firefox) + end end # By default, any exception happening in your Rails application will bubble up diff --git a/spec/acceptance/acceptance_helper.rb b/spec/acceptance/acceptance_helper.rb deleted file mode 100644 index 71946ade..00000000 --- a/spec/acceptance/acceptance_helper.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'spec_helper' - -# Put your acceptance spec helpers inside spec/acceptance/support -Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} \ No newline at end of file diff --git a/spec/acceptance/suppliers/supplier_main_board_spec.rb_spec.rb b/spec/acceptance/suppliers/supplier_main_board_spec.rb_spec.rb deleted file mode 100644 index 5c2f42bc..00000000 --- a/spec/acceptance/suppliers/supplier_main_board_spec.rb_spec.rb +++ /dev/null @@ -1,48 +0,0 @@ -require 'acceptance/acceptance_helper' - -feature 'Supplier main board spec.rb', %q{ - In order to manage active lists and orders - As a confirmed supplier - I want to have control over lists and orders from the main activity panel -} do - background do - CouchPotato.couchrest_database.recreate! - create_confirmed_supplier 'supplier@qwaiter.com' - create_user 'user@qwaiter.com' - end - - def create_active_list(options = {}) - @table = create :table, supplier: @supplier - @list = create :list, supplier: @supplier, table: @table, user_ids: [@user.id] - end - - context "having javascript activated", js: true do - - scenario 'the active list should be present and contained in row having its id' do - create_active_list - login_supplier_as 'supplier@qwaiter.com' - visit '/supplier' - page.should have_selector "#list-row-#{@list.id}" - end - - scenario 'an order is added to the list before visiting the page' do - create_active_list - login_supplier_as 'supplier@qwaiter.com' - product = create :product, supplier: @supplier - sleep 0.1 - @list.place_order @user, {product.id => 369} - visit '/supplier' - page.should have_selector ".of-list-#{@list.id}" - end - - scenario 'an order is added to the list after visiting the page' do - create_active_list - login_supplier_as 'supplier@qwaiter.com' - product = create :product, supplier: @supplier - visit '/supplier' - @list.place_order @user, {product.id => 369} - sleep 0.1 - page.should have_selector ".of-list-#{@list.id}" - end - end -end diff --git a/spec/acceptance/support/helpers.rb b/spec/acceptance/support/helpers.rb deleted file mode 100644 index 10b8c062..00000000 --- a/spec/acceptance/support/helpers.rb +++ /dev/null @@ -1,35 +0,0 @@ -module HelperMethods - # Put helper methods you need to be available in all acceptance specs here. - - def create_user(email, password='secret') - @user = User.find_by_email(email) || FactoryGirl.create(:user, email: email, password: password) - end - def create_supplier(email, password='secret') - @supplier = Supplier.find_by_email(email) || FactoryGirl.create(:supplier, email: email, password: password) - end - - def create_confirmed_supplier(email, password='secret') - @supplier = Supplier.find_by_email(email) || FactoryGirl.create(:supplier, :confirmed, email: email, password: password) - @supplier.confirm! unless @supplier.confirmed? - end - - def login_user_as(email) - visit "/users/sign_in" - fill_in "user_email", with: email - fill_in "user_password", with: "secret" - submit_form - end - - def login_supplier_as(email) - visit "/suppliers/sign_in" - fill_in "supplier_email", with: email - fill_in "supplier_password", with: "secret" - submit_form - end - - def submit_form - find("[type=submit]").click - end -end - -RSpec.configuration.include HelperMethods, :type => :acceptance diff --git a/spec/acceptance/support/paths.rb b/spec/acceptance/support/paths.rb deleted file mode 100644 index e3b83074..00000000 --- a/spec/acceptance/support/paths.rb +++ /dev/null @@ -1,9 +0,0 @@ -module NavigationHelpers - # Put helper methods related to the paths in your application here. - - def homepage - "/" - end -end - -RSpec.configuration.include NavigationHelpers, :type => :acceptance \ No newline at end of file diff --git a/spec/acceptance/suppliers/product_categories_spec.rb b/spec/features/suppliers/product_categories_spec.rb similarity index 94% rename from spec/acceptance/suppliers/product_categories_spec.rb rename to spec/features/suppliers/product_categories_spec.rb index 4ab9ea18..40f4e815 100644 --- a/spec/acceptance/suppliers/product_categories_spec.rb +++ b/spec/features/suppliers/product_categories_spec.rb @@ -1,5 +1,4 @@ -require 'acceptance/acceptance_helper' - +require 'spec_helper' feature 'Supplier product categories spec', %q{ In order to manage product categories As a confirmed supplier diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ed6392d5..5c630366 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -32,6 +32,7 @@ RSpec.configure do |config| config.include FactoryAttributesFor config.include Devise::TestHelpers, :type => :controller config.include EndWithMatcher + config.include Features::BasicHelpers, type: :feature #config.use_transactional_fixtures = true config.infer_base_class_for_anonymous_controllers = true config.render_views = true diff --git a/spec/support/features/basic_helpers.rb b/spec/support/features/basic_helpers.rb new file mode 100644 index 00000000..480e8d55 --- /dev/null +++ b/spec/support/features/basic_helpers.rb @@ -0,0 +1,35 @@ +module Features + module BasicHelpers + # Put helper methods you need to be available in all acceptance specs here. + + def create_user(email, password='secret') + @user = User.find_by_email(email) || FactoryGirl.create(:user, email: email, password: password) + end + def create_supplier(email, password='secret') + @supplier = Supplier.find_by_email(email) || FactoryGirl.create(:supplier, email: email, password: password) + end + + def create_confirmed_supplier(email, password='secret') + @supplier = Supplier.find_by_email(email) || FactoryGirl.create(:supplier, :confirmed, email: email, password: password) + @supplier.confirm! unless @supplier.confirmed? + end + + def login_user_as(email) + visit "/users/sign_in" + fill_in "user_email", with: email + fill_in "user_password", with: "secret" + submit_form + end + + def login_supplier_as(email) + visit "/suppliers/sign_in" + fill_in "supplier_email", with: email + fill_in "supplier_password", with: "secret" + submit_form + end + + def submit_form + find("[type=submit]").click + end + end +end