-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Optionally generate RSpec specs instead of Test::Unit tests #88
base: main
Are you sure you want to change the base?
Optionally generate RSpec specs instead of Test::Unit tests #88
Conversation
This picks up the configuration from the parent application, so RSpec should be installed and configured before running the generator.
ref. #67 |
|
||
describe "GET #show" do | ||
it "returns HTTP success" do | ||
get session_url(user.sessions.last), headers: default_headers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here user.sessions
will allways be blank. since we are using let
, it will be available only when we access token
or default_header
which is not the case here.
I also very interested to have rspec tests. This would be a great improvement. |
I haven't had any more time to work on this recently, but I'm more than happy to accept contributions to help me get this over the line. We're working against a moving target right now because new features and new Test::Unit tests get added all the time 😀 |
Hey @stevehill1981 I would love to help on the RSpec tests |
Hey, how can I help here? I'm very familiar with rspec and love creating tests with it |
RSpec.describe "Sessions", type: :request do | ||
let(:user) { users(:lazaro_nixon) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you put a subject here, the call will be with is_expected and that is so good to read, personally.
RSpec.describe "Sessions", type: :request do | |
let(:user) { users(:lazaro_nixon) } | |
RSpec.describe "Sessions", type: :request do | |
subject { response } | |
let(:user) { users(:lazaro_nixon) } |
it "returns HTTP success" do | ||
get sessions_url, headers: default_headers | ||
|
||
expect(response).to have_http_status(:success) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the expects can be like this:
expect(response).to have_http_status(:success) | |
is_expected.to have_http_status :success |
2381d98
to
bfc80b5
Compare
This picks up the configuration from the parent application, so RSpec should be installed and configured before running the generator.
Very much WIP, a lot of work to be done before this is ready.