Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions Appraisals

This file was deleted.

6 changes: 5 additions & 1 deletion lib/tiddle/strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ def model_name
end

def authentication_keys
mapping.to.authentication_keys
if mapping.to.authentication_keys.is_a?(Hash)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the corresponding spec: I copy & pasted from adamniedzielski#102 (added co-authorship to the original author).

mapping.to.authentication_keys.keys
else
mapping.to.authentication_keys
end
end

def touch_token(token)
Expand Down
29 changes: 29 additions & 0 deletions spec/strategy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,35 @@
end
end

describe "when authentication_keys is a hash" do
before do
Devise.setup do |config|
config.authentication_keys = { email: true }
end

@user = User.create!(
email: "test@example.com",
password: "12345678"
)
@token = Tiddle.create_and_return_token(@user, FakeRequest.new)
end

after do
Devise.setup do |config|
config.authentication_keys = [:email]
end
end

it "allows to access endpoints which require authentication with valid \
nick name and token" do
get(
secrets_path,
headers: { "X-USER-EMAIL" => "test@example.com", "X-USER-TOKEN" => @token }
)
expect(response.status).to eq 200
end
end

context "when token has expires_in set up" do
before do
@user = User.create!(email: "test@example.com", password: "12345678")
Expand Down
6 changes: 1 addition & 5 deletions spec/support/backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ def migrate!
# Do initial migration
path = File.expand_path("../rails_app_active_record/db/migrate/", File.dirname(__FILE__))

schema_migration = ::ActiveRecord::SchemaMigration.new(
ActiveRecord::Tasks::DatabaseTasks.migration_connection_pool
)

::ActiveRecord::MigrationContext.new(path, schema_migration).migrate
ActiveRecord::MigrationContext.new(path).migrate

@entpiske entpiske Jul 21, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bringing adamniedzielski#102 (comment) over here.

end
end

Expand Down
2 changes: 0 additions & 2 deletions tiddle.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rake", "~> 13"
spec.add_development_dependency "rspec-rails"
spec.add_development_dependency "simplecov"
spec.add_development_dependency "appraisal"
spec.add_development_dependency "rubocop"
spec.add_development_dependency "database_cleaner"
spec.add_development_dependency "database_cleaner-active_record"
spec.add_development_dependency "database_cleaner-mongoid"
end