-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
155 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
/gemfiles | ||
/spec/dummy/log | ||
/spec/dummy/storage | ||
/spec/dummy/tmp | ||
|
||
/Gemfile.lock | ||
/spec/dummy/Gemfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
appraise "rails_6_1" do | ||
gem "rails", "6.1.0" | ||
end | ||
appraise "rails_7_0" do | ||
gem "rails", "~> 7.0.0" | ||
|
||
appraise "rails_7" do | ||
gem "rails", "7.0.0" | ||
group :test do | ||
gem "sqlite3", "~> 1.4" | ||
end | ||
end | ||
|
||
appraise "rails_7_1" do | ||
gem "rails", "7.1.0" | ||
gem "rails", "~> 7.1.0" | ||
|
||
group :test do | ||
gem "sqlite3", "~> 1.4" | ||
end | ||
end | ||
|
||
appraise "rails_7_2" do | ||
gem "rails", "7.2.0" | ||
gem "rails", "~> 7.2.0" | ||
end | ||
|
||
appraise "rails_8" do | ||
appraise "rails_8_0" do | ||
gem "rails", "8.0.0.rc2" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#!/usr/bin/env sh | ||
set -eu | ||
set -e | ||
|
||
cd spec/dummy | ||
bundle exec rspec --fail-fast=3 -f documentation | ||
bundle exec appraisal "$@" rspec --fail-fast=3 -f documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env sh | ||
set -eu | ||
set -e | ||
|
||
bundle exec rubocop -c .rubocop.yml | ||
bundle exec rubocop -c .rubocop.yml "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
#!/usr/bin/env sh | ||
set -eu | ||
set -e | ||
|
||
echo ---- Installing dependencies ---- | ||
bundle | ||
cd spec/dummy | ||
bundle | ||
bundle exec appraisal install | ||
|
||
echo ---- Setting up database ---- | ||
bundle exec rails db:drop db:setup | ||
if [ -n "$CI" ]; then | ||
bundle exec rails db:create db:schema:load | ||
else | ||
bundle exec rails db:drop db:setup | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,11 @@ | ||
default: &default | ||
development: | ||
adapter: sqlite3 | ||
database: storage/development.sqlite3 | ||
pool: <%= ENV.fetch "RAILS_MAX_THREADS", 5 %> | ||
timeout: 5000 | ||
|
||
development: | ||
<<: *default | ||
database: storage/development.sqlite3 | ||
|
||
test: | ||
<<: *default | ||
adapter: sqlite3 | ||
database: storage/test.sqlite3 | ||
|
||
production: | ||
<<: *default | ||
# database: path/to/persistent/storage/production.sqlite3 | ||
pool: <%= ENV.fetch "RAILS_MAX_THREADS", 5 %> | ||
timeout: 5000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
spec/dummy/db/migrate/20241022111111_create_authors_and_posts.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
RSpec.describe "Hotsheet::Configuration" do | ||
let(:config) do | ||
Hotsheet.configure do |config| | ||
config.model :Author do |model| | ||
model.included_attributes = %i[name birthdate] | ||
model.excluded_attributes = %i[created_at] | ||
end | ||
end | ||
end | ||
|
||
it "has included and excluded attributes" do | ||
expect(config).to be_a Hotsheet::Configuration::ModelConfig | ||
expect(config.included_attributes).to eq %i[name birthdate] | ||
expect(config.excluded_attributes).to eq %i[created_at] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# frozen_string_literal: true | ||
|
||
ENV["RAILS_ENV"] = "test" | ||
|
||
require_relative "dummy/config/environment" | ||
require "database_cleaner-active_record" | ||
require "rspec/rails" | ||
require "selenium-webdriver" | ||
|
||
%i[firefox firefox_headless].each do |driver| | ||
Capybara.register_driver driver do |app| | ||
args = ["--headless"] if driver == :firefox_headless | ||
options = Selenium::WebDriver::Firefox::Options.new args: args | ||
Capybara::Selenium::Driver.new app, browser: :firefox, options: options | ||
end | ||
end | ||
|
||
driver = ENV.fetch("SELENIUM_DRIVER", "firefox_headless").to_sym | ||
Capybara.default_driver = :rack_test | ||
Capybara.javascript_driver = driver | ||
ActiveRecord::Migration.maintain_test_schema! | ||
|
||
RSpec.configure do |config| | ||
Kernel.srand config.seed | ||
|
||
config.include Capybara::DSL | ||
|
||
config.disable_monkey_patching! | ||
config.filter_rails_from_backtrace! | ||
config.infer_spec_type_from_file_location! | ||
config.mock_with(:rspec) { |mocks| mocks.verify_partial_doubles = true } | ||
config.order = :random | ||
config.run_all_when_everything_filtered = true | ||
|
||
config.before :all, type: :system do | ||
FileUtils.rm_rf Rails.root.join "tmp/capybara" | ||
driven_by driver, screen_size: [1280, 800] | ||
end | ||
|
||
config.before :each, type: :system do | ||
DatabaseCleaner.clean_with :truncation | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
RSpec.describe "editable attributes", :js do | ||
let!(:author) { Author.create! name: "Stephen", birthdate: "1947-09-21", gender: "male" } | ||
|
||
describe "update strings" do | ||
before do | ||
visit "/hotsheet" | ||
click_link "Author" | ||
find(".readonly-attribute", text: "Stephen").click | ||
fill_in "author_name", with: "King" | ||
end | ||
|
||
it "updates attribute when pressing enter" do | ||
find_by_id("author_name").native.send_keys :return | ||
|
||
expect(page).to have_content("King") | ||
expect(author.reload.name).to eq("King") | ||
end | ||
|
||
it "updates attribute when clicking outside the input" do | ||
find("th", text: "name").click | ||
|
||
expect(page).to have_content("King") | ||
expect(author.reload.name).to eq("King") | ||
end | ||
end | ||
end |