Skip to content
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

Integration tests #98

Merged
merged 4 commits into from
Oct 10, 2014
Merged

Integration tests #98

merged 4 commits into from
Oct 10, 2014

Conversation

jjb
Copy link
Contributor

@jjb jjb commented Oct 6, 2014

I think the project would benefit from integration tests. Bugs that PRs like #35, #89, and #97 would be easier to observe with integration tests.

Here is some initial simple code for the purpose of discussion. Things to consider:

  • in general do we want this?
  • I've put all the existing tests into "unit" — does that seem appropriate?
  • currently there is no HTTP mocking framework and a real request is made to facebook. what mocking framework do we like? the two I have used are fakeweb and VCR. fakeweb is simpler and takes less DSL syntax to apply the mocking to the entire suite. in the absense of other factors, I would use fakeweb. VCR is more featureful and more actively developed. perhaps others have more experience with these or other projects and are more opinionated.

@mislav
Copy link
Contributor

mislav commented Oct 6, 2014

We do integration tests in Faraday and they are very useful. Yes I think we should have a stronger test suite in the light of these bugs.

I would use webmock instead of fakeweb (outdated) or VCR (overkill for our purposes).

@jjb jjb force-pushed the integration-tests branch from 3794369 to a3a9a98 Compare October 6, 2014 23:04
@jjb
Copy link
Contributor Author

jjb commented Oct 6, 2014

okay, now mocked with webmock

i could make a spec helper file for the integration tests… or we could keep it simple like this until the need presents itself.

@jjb jjb force-pushed the integration-tests branch from a3a9a98 to 504512e Compare October 6, 2014 23:15
@jjb
Copy link
Contributor Author

jjb commented Oct 6, 2014

ah frack now 'helper' isn't in the load path

let me know if you like the file structure and if so i'll fix the require paths

@mislav
Copy link
Contributor

mislav commented Oct 6, 2014

ah frack now 'helper' isn't in the load path

The spec directory should be on the load path automatically. You shouldn't need to fix require paths. I'll look into what's going on here

@mislav
Copy link
Contributor

mislav commented Oct 6, 2014

Ah I see you've moved spec/helper.rb to spec/unit/. You shouldn't do that. Please make spec/helper.rb a common file that both styles of test suite can share.

@jjb jjb force-pushed the integration-tests branch from 504512e to 1334a4f Compare October 6, 2014 23:51
@jjb
Copy link
Contributor Author

jjb commented Oct 7, 2014

@mislav fixed. see the new failures. how do we make access to those values compatible with old versions of faraday?

end

response = connection.get "http://facebook.com"
expect(response.env.url.to_s).to eq("https://www.facebook.com/")
Copy link
Contributor

Choose a reason for hiding this comment

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

response.env[:url]

@jjb jjb force-pushed the integration-tests branch from 1334a4f to 6a42194 Compare October 7, 2014 00:22
@jjb
Copy link
Contributor Author

jjb commented Oct 7, 2014

@mislav fixed, and tidied up some other related stuff

@jjb
Copy link
Contributor Author

jjb commented Oct 7, 2014

now it fails because coverage is too low… even though the only thing this PR does is add new tests, hah!

@mislav
Copy link
Contributor

mislav commented Oct 7, 2014

Yeah, bizarre. Please see if there are low-hanging fruit with regards to code coverage. We could even lower the treshold but that's only a temporary solution, as future PRs will have to lower the treshold even further, and that gets us nowhere.

@jjb
Copy link
Contributor Author

jjb commented Oct 7, 2014

@mislav see #100

@sferik sferik force-pushed the master branch 3 times, most recently from cde9944 to bee560a Compare October 9, 2014 00:20
@jjb
Copy link
Contributor Author

jjb commented Oct 9, 2014

I think because this PR only has new tests, a good case can be made that the coverage tool isn't correctly assessing the situation and that we should lower the threshold.

@mislav
Copy link
Contributor

mislav commented Oct 9, 2014

Yep, do it.

jjb added a commit to jjb/faraday_middleware that referenced this pull request Oct 9, 2014
jjb added 3 commits October 9, 2014 15:06
initial simple test for the purpose of discussing how we might
want to go about writing integration tests
@jjb jjb force-pushed the integration-tests branch from bee8189 to d275d2e Compare October 9, 2014 19:06
@jjb
Copy link
Contributor Author

jjb commented Oct 9, 2014

i've no idea what the cause of these new failures is...

@mislav
Copy link
Contributor

mislav commented Oct 10, 2014

It picked up simple_oauth 0.3.0 when previously we used simple_oauth 0.2.0. We have to look into the incompatibilities with the new version, but for now you could just put a version constraint for < 0.3.0 in the Gemfile.

@jjb
Copy link
Contributor Author

jjb commented Oct 10, 2014

😹

mislav added a commit that referenced this pull request Oct 10, 2014
@mislav mislav merged commit 97dea23 into lostisland:master Oct 10, 2014
@mislav
Copy link
Contributor

mislav commented Oct 10, 2014

Thank you! Could you be bothered to look into the simple_oauth incompatibility thing or should we do it?

@jjb
Copy link
Contributor Author

jjb commented Oct 10, 2014

i've no experience with it and don't use it so it would be hard for me to prioritize, tbh

mislav pushed a commit that referenced this pull request Jul 7, 2015
mislav pushed a commit that referenced this pull request Jul 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants