diff --git a/Gemfile b/Gemfile index 2686cb016..8bae74400 100644 --- a/Gemfile +++ b/Gemfile @@ -69,8 +69,9 @@ end group :test do gem 'capybara', '1.1.2' + gem 'cucumber-rails', '1.3.0', :require => false + gem 'headless' gem 'factory_girl_rails', '4.1.0' - gem 'cucumber-rails', '1.2.1', :require => false gem 'database_cleaner', '0.7.0' gem 'guard-spork', '0.3.2' gem 'spork', '0.9.0' @@ -80,3 +81,5 @@ group :test do # gem 'growl', '1.0.3' end + + diff --git a/db/migrate/20120308032820_create_users.rb b/db/migrate/20120308032820_create_users.rb deleted file mode 100644 index 7e0dcd97d..000000000 --- a/db/migrate/20120308032820_create_users.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateUsers < ActiveRecord::Migration - def change - create_table :users do |t| - t.string :name - t.string :email - - t.timestamps - end - end -end diff --git a/db/migrate/20120308034224_add_index_to_users_email.rb b/db/migrate/20120308034224_add_index_to_users_email.rb deleted file mode 100644 index ff1f1d53a..000000000 --- a/db/migrate/20120308034224_add_index_to_users_email.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddIndexToUsersEmail < ActiveRecord::Migration - def change - add_index :users, :email, unique: true - end -end \ No newline at end of file diff --git a/db/migrate/20120308034454_add_password_digest_to_users.rb b/db/migrate/20120308034454_add_password_digest_to_users.rb deleted file mode 100644 index 7ad1f62e1..000000000 --- a/db/migrate/20120308034454_add_password_digest_to_users.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPasswordDigestToUsers < ActiveRecord::Migration - def change - add_column :users, :password_digest, :string - end -end diff --git a/db/migrate/20120308054414_add_remember_token_to_users.rb b/db/migrate/20120308054414_add_remember_token_to_users.rb deleted file mode 100644 index be5dee738..000000000 --- a/db/migrate/20120308054414_add_remember_token_to_users.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddRememberTokenToUsers < ActiveRecord::Migration - def change - add_column :users, :remember_token, :string - add_index :users, :remember_token - end -end \ No newline at end of file diff --git a/db/migrate/20120308193644_add_admin_to_users.rb b/db/migrate/20120308193644_add_admin_to_users.rb deleted file mode 100644 index e386d33dd..000000000 --- a/db/migrate/20120308193644_add_admin_to_users.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddAdminToUsers < ActiveRecord::Migration - def change - add_column :users, :admin, :boolean, default: false - end -end diff --git a/db/migrate/20120308210452_create_microposts.rb b/db/migrate/20120308210452_create_microposts.rb deleted file mode 100644 index 34bbf994b..000000000 --- a/db/migrate/20120308210452_create_microposts.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateMicroposts < ActiveRecord::Migration - def change - create_table :microposts do |t| - t.string :content - t.integer :user_id - - t.timestamps - end - add_index :microposts, [:user_id, :created_at] - end -end \ No newline at end of file diff --git a/db/migrate/20120308215846_create_relationships.rb b/db/migrate/20120308215846_create_relationships.rb deleted file mode 100644 index c49989cb9..000000000 --- a/db/migrate/20120308215846_create_relationships.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateRelationships < ActiveRecord::Migration - def change - create_table :relationships do |t| - t.integer :follower_id - t.integer :followed_id - - t.timestamps - end - - add_index :relationships, :follower_id - add_index :relationships, :followed_id - add_index :relationships, [:follower_id, :followed_id], unique: true - end -end \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 88848d25f..b5e6a7964 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,39 +11,6 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120308215846) do - - create_table "microposts", :force => true do |t| - t.string "content" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "microposts", ["user_id", "created_at"], :name => "index_microposts_on_user_id_and_created_at" - - create_table "relationships", :force => true do |t| - t.integer "follower_id" - t.integer "followed_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "relationships", ["followed_id"], :name => "index_relationships_on_followed_id" - add_index "relationships", ["follower_id", "followed_id"], :name => "index_relationships_on_follower_id_and_followed_id", :unique => true - add_index "relationships", ["follower_id"], :name => "index_relationships_on_follower_id" - - create_table "users", :force => true do |t| - t.string "name" - t.string "email" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "password_digest" - t.string "remember_token" - t.boolean "admin", :default => false - end - - add_index "users", ["email"], :name => "index_users_on_email", :unique => true - add_index "users", ["remember_token"], :name => "index_users_on_remember_token" +ActiveRecord::Schema.define(:version => 0) do end diff --git a/features/signing_in.feature b/features/signing_in.feature deleted file mode 100644 index 1c6fe0f2c..000000000 --- a/features/signing_in.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: Signing in - - Scenario: Unsuccessful signin - Given a user visits the signin page - When he submits invalid signin information - Then he should see an error message - - Scenario: Successful signin - Given a user visits the signin page - And the user has an account - And the user submits valid signin information - Then he should see his profile page - And he should see a signout link \ No newline at end of file diff --git a/features/step_definitions/authentication_steps.rb b/features/step_definitions/authentication_steps.rb deleted file mode 100644 index 035e58f41..000000000 --- a/features/step_definitions/authentication_steps.rb +++ /dev/null @@ -1,31 +0,0 @@ -Given /^a user visits the signin page$/ do - visit signin_path -end - -When /^he submits invalid signin information$/ do - click_button "Sign in" -end - -Then /^he should see an error message$/ do - page.should have_selector('div.alert.alert-error') -end - -Given /^the user has an account$/ do - @user = User.create(name: "Example User", email: "user@example.com", - password: "foobar", password_confirmation: "foobar") -end - -When /^the user submits valid signin information$/ do - visit signin_path - fill_in "Email", with: @user.email - fill_in "Password", with: @user.password - click_button "Sign in" -end - -Then /^he should see his profile page$/ do - page.should have_selector('title', text: @user.name) -end - -Then /^he should see a signout link$/ do - page.should have_link('Sign out', href: signout_path) -end \ No newline at end of file diff --git a/features/support/env.rb b/features/support/env.rb index b2cf67330..30a6a07b5 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -4,8 +4,14 @@ # instead of editing this one. Cucumber will automatically load all features/**/*.rb # files. +# SETH: ADDED TO FORCE OUR OWN DB LOADING +require File.expand_path('../before_cucumber', __FILE__) +BeforeCucumber.new + require 'cucumber/rails' + + # 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 @@ -32,7 +38,9 @@ ActionController::Base.allow_rescue = false # Remove/comment out the lines below if your app doesn't have a database. # For some databases (like MongoDB and CouchDB) you may need to use :truncation instead. begin - DatabaseCleaner.strategy = :transaction + #DatabaseCleaner.strategy = :transaction + #DatabaseCleaner.strategy = :truncation, {:except => %w[instruments genres] } + #DatabaseCleaner.clean_with(:truncation, {:except => %w[instruments genres] }) rescue NameError raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it." end @@ -41,7 +49,10 @@ end # See the DatabaseCleaner documentation for details. Example: # # Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do -# DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]} +# # { :except => [:widgets] } may not do what you expect here +# # as tCucumber::Rails::Database.javascript_strategy overrides +# # this setting. +# DatabaseCleaner.strategy = :truncation # end # # Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do @@ -49,8 +60,19 @@ end # end # +Capybara.javascript_driver = :selenium + +# if on jenkins, run headless +unless ENV["HEADLESS"].nil? + require 'headless' + + headless = Headless.new + headless.start +end + # Possible values are :truncation and :transaction # The :transaction strategy is faster, but might give you threading problems. # See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature Cucumber::Rails::Database.javascript_strategy = :truncation +