Some updates to translation engine, added dotenv but have not yet set it up.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'Home' do
|
||||
it "has a title which is Bike!Bike!" do
|
||||
visit root_path
|
||||
expect(page).to have_link 'Bike!Bike!'
|
||||
end
|
||||
|
||||
it "has a link to login" do
|
||||
visit root_path
|
||||
expect(page).to have_link 'Sign In', :href => '/login'
|
||||
end
|
||||
|
||||
it "has a link to conferences" do
|
||||
visit root_path
|
||||
expect(find '.top-bar-section a[href$="/conferences"]').to have_text 'Conferences'
|
||||
end
|
||||
|
||||
it "has a link to organizations" do
|
||||
visit root_path
|
||||
expect(find '.top-bar-section a[href$="/organizations"]').to have_text 'Organizations'
|
||||
end
|
||||
|
||||
it "has a link to resources" do
|
||||
visit root_path
|
||||
expect(find '.top-bar-section a[href$="/resources"]').to have_text 'Resources'
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,72 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'Login' do
|
||||
|
||||
it "has a title which is Bike!Bike!" do
|
||||
visit login_path
|
||||
expect(page).to have_link 'Bike!Bike!'
|
||||
end
|
||||
|
||||
it "has a link to login" do
|
||||
visit login_path
|
||||
expect(page).to have_link 'Sign In', :href => '/login'
|
||||
end
|
||||
|
||||
it "has a link to conferences" do
|
||||
visit login_path
|
||||
expect(find '.top-bar-section a[href$="/conferences"]').to have_text 'Conferences'
|
||||
end
|
||||
|
||||
it "has a link to organizations" do
|
||||
visit login_path
|
||||
expect(find '.top-bar-section a[href$="/organizations"]').to have_text 'Organizations'
|
||||
end
|
||||
|
||||
it "has a link to resources" do
|
||||
visit login_path
|
||||
expect(find '.top-bar-section a[href$="/resources"]').to have_text 'Resources'
|
||||
end
|
||||
|
||||
it "has a login form" do
|
||||
visit login_path
|
||||
form = find 'form[action$="/user_sessions"]'
|
||||
expect(form).to have_button 'sign in'
|
||||
expect(form).to have_field 'email_'
|
||||
expect(form).to have_field 'password'
|
||||
expect(form).to have_link 'facebook'
|
||||
end
|
||||
|
||||
it "has a register form" do
|
||||
visit login_path
|
||||
form = find 'form[action$="/users"]'
|
||||
expect(form).to have_button 'register'
|
||||
expect(form).to have_field 'user_username'
|
||||
expect(form).to have_field 'user_email'
|
||||
expect(form).to have_field 'user_password'
|
||||
expect(form).to have_field 'user_password_confirmation'
|
||||
end
|
||||
|
||||
it "allows you to register" do
|
||||
visit login_path
|
||||
fill_in "user_username", :with => "John"
|
||||
fill_in "user_email", :with => "johnsemail@example.com"
|
||||
fill_in "user_password", :with => "johnspassword"
|
||||
fill_in "user_password_confirmation", :with => "johnspassword"
|
||||
click_button "register"
|
||||
end
|
||||
|
||||
describe "can actually happen" do
|
||||
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
||||
it "allows you to login" do
|
||||
visit login_path
|
||||
form = find 'form[action$="/user_sessions"]'
|
||||
form.find("#email_").set(user.email)
|
||||
form.find("#password").set('secret')
|
||||
click_button "sign_in"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'Organization Registration' do
|
||||
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
||||
before(:each) do
|
||||
visit login_path
|
||||
form = find 'form[action$="/user_sessions"]'
|
||||
form.find("#email_").set(user.email)
|
||||
form.find("#password").set('secret')
|
||||
click_button "sign_in"
|
||||
visit new_organization_path
|
||||
end
|
||||
|
||||
it "works as expected" do
|
||||
fill_in 'organization_name', :with => 'Bike Kitchen'
|
||||
fill_in 'organization_slug', :with => 'bike-kitchen'
|
||||
fill_in 'organization_email_address', :with => 'bikekitchen@example.com'
|
||||
end
|
||||
end
|
||||
+45
-32
@@ -1,16 +1,6 @@
|
||||
if ENV['CI']
|
||||
require 'coveralls'
|
||||
Coveralls.wear! 'rails'
|
||||
end
|
||||
|
||||
unless ENV['DRB']
|
||||
require 'simplecov'
|
||||
SimpleCov.start 'rails'
|
||||
end
|
||||
|
||||
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||
ENV['RAILS_ENV'] ||= 'test'
|
||||
require File.expand_path('../../config/environment', __FILE__)
|
||||
ENV["RAILS_ENV"] ||= 'test'
|
||||
require File.expand_path("../../config/environment", __FILE__)
|
||||
require 'rspec/rails'
|
||||
require 'rspec/autorun'
|
||||
|
||||
@@ -18,28 +8,51 @@ require 'rspec/autorun'
|
||||
# in spec/support/ and its subdirectories.
|
||||
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
||||
|
||||
require 'webmock/rspec'
|
||||
require 'capybara/rspec'
|
||||
|
||||
#Capybara.ignore_hidden_elements = false # testing hidden fields
|
||||
|
||||
include Sorcery::TestHelpers::Rails
|
||||
# Checks for pending migrations before tests are run.
|
||||
# If you are not using ActiveRecord, you can remove this line.
|
||||
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
||||
|
||||
RSpec.configure do |config|
|
||||
# == Mock Framework
|
||||
#
|
||||
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
||||
#
|
||||
# config.mock_with :mocha
|
||||
# config.mock_with :flexmock
|
||||
# config.mock_with :rr
|
||||
# config.mock_with :rspec
|
||||
# ## Mock Framework
|
||||
#
|
||||
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
||||
#
|
||||
# config.mock_with :mocha
|
||||
# config.mock_with :flexmock
|
||||
# config.mock_with :rr
|
||||
|
||||
config.include AuthenticationForFeatureRequest, type: :feature
|
||||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
||||
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||
|
||||
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||
# examples within a transaction, remove the following line or assign false
|
||||
# instead of true.
|
||||
config.use_transactional_fixtures = true
|
||||
|
||||
# If true, the base class of anonymous controllers will be inferred
|
||||
# automatically. This will be the default behavior in future versions of
|
||||
# rspec-rails.
|
||||
config.infer_base_class_for_anonymous_controllers = false
|
||||
|
||||
# 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"
|
||||
|
||||
config.before(:each) do
|
||||
Translation.connection.execute("TRUNCATE TABLE translations RESTART IDENTITY;")
|
||||
translations = DevTranslation.connection.select_all("SELECT * FROM translations")
|
||||
|
||||
translations.each { |t|
|
||||
Translation.connection.execute("
|
||||
INSERT INTO
|
||||
translations
|
||||
(id, locale, key, value, interpolations, is_proc, created_at, updated_at)
|
||||
VALUES
|
||||
(#{t['id']}, #{Translation.sanitize(t['locale'])}, #{Translation.sanitize(t['key'])}, #{Translation.sanitize(t['value'])}, #{Translation.sanitize(t['interpolations'])}, #{Translation.sanitize(t['is_proc'])}, #{Translation.sanitize(t['created_at'])}, #{Translation.sanitize(t['updated_at'])})
|
||||
;")
|
||||
}
|
||||
end
|
||||
|
||||
# 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
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
module AuthenticationForFeatureRequest
|
||||
def login user, password = 'login'
|
||||
user.update_attribute :password, password
|
||||
def login user, password = 'login'
|
||||
user.update_attribute :password, password
|
||||
|
||||
page.driver.post sessions_url, {email: user.email, password: password}
|
||||
visit root_url
|
||||
end
|
||||
end
|
||||
page.driver.post sessions_url, {email: user.email, password: password}
|
||||
visit root_url
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
RSpec.configure do |config|
|
||||
config.include Delorean
|
||||
config.include Delorean
|
||||
|
||||
config.before(:each) do
|
||||
back_to_the_present
|
||||
end
|
||||
config.before(:each) do
|
||||
back_to_the_present
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user