Skip to content

Fix app and spec errors #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 21, 2020
Merged

Fix app and spec errors #65

merged 6 commits into from
Apr 21, 2020

Conversation

jgarber623
Copy link
Member

While getting the app checked out and up-and-running, I found a handful of spec errors that would reasonably prevent moving forward with dependency updates.

So… this PR addresses those errors. I'll post comments alongside the changes for context. Feedback appreciated. Thanks!

@jgarber623 jgarber623 self-assigned this Apr 20, 2020
@@ -17,7 +17,7 @@ def show

render json: JSON.pretty_generate(results)
else
redirect_to new_submissions_path
redirect_to new_submission_path
Copy link
Member Author

Choose a reason for hiding this comment

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

Correcting route name.

get :show
expect(response).to have_http_status(:success)
expect(response).to have_http_status(:redirect)
Copy link
Member Author

Choose a reason for hiding this comment

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

The controller action throws a redirect, so now the spec checks for that.

@@ -4,7 +4,7 @@
describe 'GET /submissions' do
it 'works! (now write some real specs)' do
get submissions_path
expect(response).to have_http_status(:ok)
expect(response).to have_http_status(:redirect)
Copy link
Member Author

Choose a reason for hiding this comment

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

Same as above: controller action throws a redirect.

@@ -3,7 +3,6 @@
RSpec.describe 'submissions/new', type: :view do
before do
assign(:submission, Submission.new(
url: 'MyText',
Copy link
Member Author

Choose a reason for hiding this comment

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

The Submission model doesn't have a url field on it, so this was throwing an error.

assert_select 'textarea[name=?]', 'submission[html]'

assert_select 'textarea[name=?]', 'submission[base_url]'
assert_select 'input[name=?]', 'submission[base_url]'
Copy link
Member Author

Choose a reason for hiding this comment

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

Fixing spec to match page's markup.

assert_select 'input[name=?][value=?]', 'submission[base_url]', 'MyText'

assert_select 'textarea[name=?]', 'submission[json]'
end
Copy link
Member Author

Choose a reason for hiding this comment

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

This set of assertions is an improvement over the string matching (which was breaking). This is a quick fix, but I'm sure it could be improved.

@aaronpk aaronpk merged commit f33e93e into master Apr 21, 2020
@jgarber623 jgarber623 deleted the fix-app-and-spec-errors branch April 21, 2020 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants