Advertisement
humpah

Untitled

Nov 5th, 2014
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 9.06 KB | None | 0 0
  1. #test.rb
  2.  
  3. Rails.application.configure do
  4.   # Settings specified here will take precedence over those in config/application.rb.
  5.  
  6.   # The test environment is used exclusively to run your application's
  7.   # test suite. You never need to work with it otherwise. Remember that
  8.   # your test database is "scratch space" for the test suite and is wiped
  9.   # and recreated between test runs. Don't rely on the data there!
  10.   config.neo4j.session_type = :server_db
  11.   config.neo4j.session_path = 'http://localhost:7475'
  12.  
  13.   config.cache_classes = true
  14.  
  15.   # Do not eager load code on boot. This avoids loading your whole application
  16.   # just for the purpose of running a single test. If you are using a tool that
  17.   # preloads Rails for running tests, you may have to set it to true.
  18.   config.eager_load = false
  19.  
  20.   # Configure static asset server for tests with Cache-Control for performance.
  21.   config.serve_static_assets  = true
  22.   config.static_cache_control = 'public, max-age=3600'
  23.  
  24.   # Show full error reports and disable caching.
  25.   config.consider_all_requests_local       = true
  26.   config.action_controller.perform_caching = false
  27.  
  28.   # Raise exceptions instead of rendering exception templates.
  29.   config.action_dispatch.show_exceptions = false
  30.  
  31.   # Disable request forgery protection in test environment.
  32.   config.action_controller.allow_forgery_protection = false
  33.  
  34.   # Tell Action Mailer not to deliver emails to the real world.
  35.   # The :test delivery method accumulates sent emails in the
  36.   # ActionMailer::Base.deliveries array.
  37.   config.action_mailer.delivery_method = :test
  38.  
  39.   # Print deprecation notices to the stderr.
  40.   config.active_support.deprecation = :stderr
  41.  
  42.   # Raises error for missing translations
  43.   # config.action_view.raise_on_missing_translations = true
  44. end
  45.  
  46. --------------------------------------------------------------------------------------------------
  47. #rails_helper.rb
  48.  
  49. # This file is copied to spec/ when you run 'rails generate rspec:install'
  50. ENV["RAILS_ENV"] ||= 'test'
  51. require File.expand_path("../../config/environment", __FILE__)
  52. require 'rspec/rails'
  53. # Add additional requires below this line. Rails is not loaded until this point!
  54. require 'spec_helper'
  55.  
  56. # Requires supporting ruby files with custom matchers and macros, etc, in
  57. # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
  58. # run as spec files by default. This means that files in spec/support that end
  59. # in _spec.rb will both be required and run as specs, causing the specs to be
  60. # run twice. It is recommended that you do not name files matching this glob to
  61. # end with _spec.rb. You can configure this pattern with the --pattern
  62. # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
  63. #
  64. # The following line is provided for convenience purposes. It has the downside
  65. # of increasing the boot-up time by auto-requiring all files in the support
  66. # directory. Alternatively, in the individual `*_spec.rb` files, manually
  67. # require only the support files necessary.
  68. #
  69. # Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
  70.  
  71. # Checks for pending migrations before tests are run.
  72. # If you are not using ActiveRecord, you can remove this line.
  73. #ActiveRecord::Migration.maintain_test_schema!
  74. Neo4j::Session.current._query('MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r')
  75. RSpec.configure do |config|
  76.   # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
  77.   config.fixture_path = "#{::Rails.root}/spec/fixtures"
  78.   config.include Rails.application.routes.url_helpers
  79.  
  80.   # If you're not using ActiveRecord, or you'd prefer not to run each of your
  81.   # examples within a transaction, remove the following line or assign false
  82.   # instead of true.
  83.   #config.use_transactional_fixtures = true
  84.  
  85.   # RSpec Rails can automatically mix in different behaviours to your tests
  86.   # based on their file location, for example enabling you to call `get` and
  87.   # `post` in specs under `spec/controllers`.
  88.   #
  89.   # You can disable this behaviour by removing the line below, and instead
  90.   # explicitly tag your specs with their type, e.g.:
  91.   #
  92.   #     RSpec.describe UsersController, :type => :controller do
  93.   #       # ...
  94.   #     end
  95.   #
  96.   # The different available types are documented in the features, such as in
  97.   # https://relishapp.com/rspec/rspec-rails/docs
  98.   config.infer_spec_type_from_file_location!
  99. end
  100.  
  101. --------------------------------------------------------------------------------------------------
  102. #spec_helper.rb
  103.  
  104. require 'capybara/rspec'
  105. # This file was generated by the `rails generate rspec:install` command. Conventionally, all
  106. # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
  107. # The generated `.rspec` file contains `--require spec_helper` which will cause this
  108. # file to always be loaded, without a need to explicitly require it in any files.
  109. #
  110. # Given that it is always loaded, you are encouraged to keep this file as
  111. # light-weight as possible. Requiring heavyweight dependencies from this file
  112. # will add to the boot time of your test suite on EVERY test run, even for an
  113. # individual file that may not need all of that loaded. Instead, consider making
  114. # a separate helper file that requires the additional dependencies and performs
  115. # the additional setup, and require it from the spec files that actually need it.
  116. #
  117. # The `.rspec` file also contains a few flags that are not defaults but that
  118. # users commonly want.
  119. #
  120. # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
  121. RSpec.configure do |config|
  122.   # rspec-expectations config goes here. You can use an alternate
  123.   # assertion/expectation library such as wrong or the stdlib/minitest
  124.   # assertions if you prefer.
  125.   Capybara.default_driver = :selenium
  126.  
  127.   config.expect_with :rspec do |expectations|
  128.     # This option will default to `true` in RSpec 4. It makes the `description`
  129.     # and `failure_message` of custom matchers include text for helper methods
  130.     # defined using `chain`, e.g.:
  131.     # be_bigger_than(2).and_smaller_than(4).description
  132.     #   # => "be bigger than 2 and smaller than 4"
  133.     # ...rather than:
  134.     #   # => "be bigger than 2"
  135.     expectations.include_chain_clauses_in_custom_matcher_descriptions = true
  136.   end
  137.  
  138.   # rspec-mocks config goes here. You can use an alternate test double
  139.   # library (such as bogus or mocha) by changing the `mock_with` option here.
  140.   config.mock_with :rspec do |mocks|
  141.     # Prevents you from mocking or stubbing a method that does not exist on
  142.     # a real object. This is generally recommended, and will default to
  143.     # `true` in RSpec 4.
  144.     mocks.verify_partial_doubles = true
  145.   end
  146.  
  147. # The settings below are suggested to provide a good initial experience
  148. # with RSpec, but feel free to customize to your heart's content.
  149. =begin
  150.   # These two settings work together to allow you to limit a spec run
  151.   # to individual examples or groups you care about by tagging them with
  152.   # `:focus` metadata. When nothing is tagged with `:focus`, all examples
  153.   # get run.
  154.   config.filter_run :focus
  155.   config.run_all_when_everything_filtered = true
  156.  
  157.   # Limits the available syntax to the non-monkey patched syntax that is recommended.
  158.   # For more details, see:
  159.   #   - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
  160.   #   - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
  161.   #   - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
  162.   config.disable_monkey_patching!
  163.  
  164.   # Many RSpec users commonly either run the entire suite or an individual
  165.   # file, and it's useful to allow more verbose output when running an
  166.   # individual spec file.
  167.   if config.files_to_run.one?
  168.     # Use the documentation formatter for detailed output,
  169.     # unless a formatter has already been configured
  170.     # (e.g. via a command-line flag).
  171.     config.default_formatter = 'doc'
  172.   end
  173.  
  174.   # Print the 10 slowest examples and example groups at the
  175.   # end of the spec run, to help surface which specs are running
  176.   # particularly slow.
  177.   config.profile_examples = 10
  178.  
  179.   # Run specs in random order to surface order dependencies. If you find an
  180.   # order dependency and want to debug it, you can fix the order by providing
  181.   # the seed, which is printed after each run.
  182.   #     --seed 1234
  183.   config.order = :random
  184.  
  185.   # Seed global randomization in this process using the `--seed` CLI option.
  186.   # Setting this allows you to use `--seed` to deterministically reproduce
  187.   # test failures related to randomization by passing the same `--seed` value
  188.   # as the one that triggered the failure.
  189.   Kernel.srand config.seed
  190. =end
  191. end
  192.  
  193. --------------------------------------------------------------------------------------------------
  194. #users_sign_in.rb
  195.  
  196. require 'rails_helper' 
  197.  
  198. describe "Sign up pages" do
  199.  
  200.   subject { page }
  201.  
  202.   it "should allow an user to make an account" do
  203.     visit root_path
  204.     click_link "Create account"
  205.     fill_in "Firstname", :with => "Bööna"
  206.   end
  207. end
  208.  
  209. --------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement