more tests, trying minitest
This commit is contained in:
parent
b42d8137a9
commit
168320d6ee
@ -2,4 +2,7 @@ class ApplicationController < ActionController::Base
|
||||
def authenticate_member!
|
||||
true
|
||||
end
|
||||
def current_member
|
||||
Member.new(email: "torsten@villataika.fi")
|
||||
end
|
||||
end
|
||||
|
6
test/dummy/app/models/member.rb
Normal file
6
test/dummy/app/models/member.rb
Normal file
@ -0,0 +1,6 @@
|
||||
class Member
|
||||
attr_reader :email
|
||||
def initialize(hash)
|
||||
@email = hash[:email]
|
||||
end
|
||||
end
|
28
test/integration/cards_test.rb
Normal file
28
test/integration/cards_test.rb
Normal file
@ -0,0 +1,28 @@
|
||||
require "test_helper"
|
||||
|
||||
class CardsTest < ActionDispatch::IntegrationTest
|
||||
include Devise::Test::IntegrationHelpers # Rails >= 5
|
||||
|
||||
def go_edit
|
||||
visit "/merged/sections/11"
|
||||
find_link("View and Edit Cards").click
|
||||
end
|
||||
def test_edit_is
|
||||
go_edit
|
||||
assert_equal page.current_path , "/merged/sections/11/cards"
|
||||
end
|
||||
|
||||
def test_update
|
||||
go_edit
|
||||
within("#card_6") do
|
||||
find_button("Update" , match: :first).click
|
||||
end
|
||||
end
|
||||
|
||||
def _test_update
|
||||
go_edit
|
||||
within(".content_update") do
|
||||
find_button("Update").click
|
||||
end
|
||||
end
|
||||
end
|
@ -1,7 +0,0 @@
|
||||
require "test_helper"
|
||||
|
||||
class NavigationTest < ActionDispatch::IntegrationTest
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
36
test/integration/sections_test.rb
Normal file
36
test/integration/sections_test.rb
Normal file
@ -0,0 +1,36 @@
|
||||
require "test_helper"
|
||||
|
||||
class SectionsTest < ActionDispatch::IntegrationTest
|
||||
include Devise::Test::IntegrationHelpers # Rails >= 5
|
||||
|
||||
def go_index
|
||||
visit "/merged/pages"
|
||||
click_on ("index")
|
||||
end
|
||||
def go_edit
|
||||
go_index
|
||||
within("#section_31") do
|
||||
find_link("Edit").click
|
||||
end
|
||||
end
|
||||
def test_edit_is
|
||||
go_index
|
||||
within("#section_31") do
|
||||
assert has_link?("Edit")
|
||||
end
|
||||
end
|
||||
|
||||
def test_edit_ok
|
||||
go_index
|
||||
within("#section_31") do
|
||||
find_link("Edit").click
|
||||
end
|
||||
end
|
||||
|
||||
def test_update
|
||||
go_edit
|
||||
within(".content_update") do
|
||||
find_button("Update").click
|
||||
end
|
||||
end
|
||||
end
|
@ -3,4 +3,21 @@ ENV["RAILS_ENV"] = "test"
|
||||
|
||||
require_relative "../test/dummy/config/environment"
|
||||
require "rails/test_help"
|
||||
require 'capybara/rails'
|
||||
require 'capybara/minitest'
|
||||
require "devise"
|
||||
require "devise/test/integration_helpers"
|
||||
|
||||
class ActionDispatch::IntegrationTest
|
||||
#include Devise::Test::IntegrationHelpers
|
||||
#include FactoryBot::Syntax::Methods
|
||||
# Make the Capybara DSL available in all integration tests
|
||||
include Capybara::DSL
|
||||
include Capybara::Minitest::Assertions #### THIS LINE changes minitest assert_select #####
|
||||
|
||||
# Reset sessions and driver between tests
|
||||
teardown do
|
||||
Capybara.reset_sessions!
|
||||
Capybara.use_default_driver
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user