-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into jonny5/permissions-creation-163
- Loading branch information
Showing
8 changed files
with
83 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,22 +8,27 @@ on: | |
types: ['opened', 'reopened', 'synchronize', 'unlocked'] | ||
|
||
jobs: | ||
ruby-lint: | ||
name: Ruby Lint | ||
runs-on: ubuntu-latest | ||
# NOTE: @abachman | ||
# In order to move a little faster for the Ruby for Good weekend event, I'm | ||
# commenting out the ruby-lint job. We can re-enable it after the event | ||
# once we've had a chance to let the dust settle and run `standardrb --fix` | ||
# on everything. | ||
# ruby-lint: | ||
# name: Ruby Lint | ||
# runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
# steps: | ||
# - name: Checkout code | ||
# uses: actions/checkout@v4 | ||
|
||
- name: Set up Ruby | ||
uses: ruby/[email protected] | ||
with: | ||
ruby-version: '3.2.3' | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
# - name: Set up Ruby | ||
# uses: ruby/[email protected] | ||
# with: | ||
# ruby-version: '3.2.3' | ||
# bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
|
||
- name: Ruby Lint | ||
run: bundle exec standardrb --parallel -f github | ||
# - name: Ruby Lint | ||
# run: bundle exec standardrb --parallel -f github | ||
|
||
rails-test: | ||
name: Rails Test | ||
|
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 |
---|---|---|
|
@@ -41,4 +41,4 @@ | |
!/app/assets/builds/.keep | ||
|
||
/node_modules | ||
.vscode/ | ||
.vscode/ |
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 |
---|---|---|
|
@@ -39,6 +39,7 @@ end | |
group :test do | ||
gem "capybara" | ||
gem "selenium-webdriver" | ||
gem "webmock" | ||
end | ||
|
||
gem "pundit", "~> 2.3" |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
API_KEY = ENV.fetch("STOCKS_API_KEY", "test-api-key") |
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,7 +1,43 @@ | ||
require "test_helper" | ||
|
||
class StockPricesUpdateJobTest < ActiveJob::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
STOCK_URL_MATCHER = %r{https://www\.alphavantage\.co/query\?apikey=[^&]+&function=GLOBAL_QUOTE&symbol=[A-Z]+} | ||
STOCK_SYMBOLS = ["KO", "SNE", "TWX", "DIS", "SIRI", "F", "EA", "FB", "UA", "LUV", "GPS"] | ||
|
||
setup do | ||
stub_request(:get, STOCK_URL_MATCHER) | ||
.with( | ||
headers: { | ||
"Accept" => "*/*", | ||
"Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3", | ||
"Host" => "www.alphavantage.co", | ||
"User-Agent" => "Ruby" | ||
} | ||
) | ||
.to_return(status: 200, body: "", headers: {}) | ||
end | ||
|
||
test "makes API calls" do | ||
StockPricesUpdateJob.perform_now | ||
assert_requested :get, STOCK_URL_MATCHER, times: 11 | ||
end | ||
|
||
test "creates Stock records" do | ||
skip("waiting for implementation") | ||
|
||
assert_difference("Stock.count", 11) do | ||
StockPricesUpdateJob.perform_now | ||
end | ||
end | ||
|
||
test "sets Stock ticker and price" do | ||
skip("waiting for implementation") | ||
|
||
StockPricesUpdateJob.perform_now | ||
STOCK_SYMBOLS.each do |ticker| | ||
stock = Stock.find_by(ticker: ticker) | ||
assert stock.present? | ||
assert stock.price.present? | ||
end | ||
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