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

Order independent tests #4805

Merged
merged 45 commits into from Feb 21, 2017
Merged

Order independent tests #4805

merged 45 commits into from Feb 21, 2017

Conversation

deivid-rodriguez
Copy link
Member

Just a WIP for now.

@@ -19,6 +19,10 @@ def add(resource)
end
end

def delete(resource)
@collection.reject! { |k| k == resource.resource_name }
Copy link
Member

Choose a reason for hiding this comment

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

@deivid-rodriguez , why not

@collection.delete(resource.resource_name )

?

Copy link
Member Author

Choose a reason for hiding this comment

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

Absolutely!

However, this is the only change affecting the actual code in lib and it's not really in the scope of this PR. I only added it while debugging some failures but it's not really necessary. So I'd say it's best to just remove it.

@deivid-rodriguez deivid-rodriguez changed the title [WIP] Order independent tests Order independent tests Feb 19, 2017
@deivid-rodriguez
Copy link
Member Author

Ok, the specs now seem to be consistently passing with random order enabled.

Tentatively removing the WIP (until Travis proves me wrong 😄).

@deivid-rodriguez deivid-rodriguez changed the title Order independent tests [WIP] Order independent tests Feb 19, 2017
@deivid-rodriguez
Copy link
Member Author

Found one more failure locally, restoring WIP.

@deivid-rodriguez
Copy link
Member Author

Ok, it should be fixed now, let's wait for CI.

@deivid-rodriguez deivid-rodriguez changed the title [WIP] Order independent tests Order independent tests Feb 19, 2017
.travis.yml Outdated
branches:
only:
- master

Copy link
Member

Choose a reason for hiding this comment

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

don't do this

Copy link
Member Author

Choose a reason for hiding this comment

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

Could you please be a little more educational in your reviews? I can't learn anything from "don't do this"... 😞

Anyways, it's now removed, the double CI run is now back there.

doublerun

@deivid-rodriguez
Copy link
Member Author

CI hurt, that's good. Will fix the remaining issues it surfaced as soon as possible.

@Fivell
Copy link
Member

Fivell commented Feb 20, 2017

@deivid-rodriguez , looks like this almost finished, 👍 , few bugs to go

@deivid-rodriguez deivid-rodriguez force-pushed the order_independent_tests branch 2 times, most recently from f3b0e70 to 0958ec0 Compare February 20, 2017 16:14
@deivid-rodriguez
Copy link
Member Author

Did another pass. Now it's really really close to green.

@deivid-rodriguez
Copy link
Member Author

Two more fixes pushed... This time it might pass.

@deivid-rodriguez
Copy link
Member Author

Travis passed! Yay!

Codecov is failing but it's unrelated to this PR. My guess is that the last commit was pushed directly to master, codecov didn't generate a report for it, and now it can't find a base report to compare this against.

If that's the case, one more reason to not commit directly to master! 😉

Anyways, sorry for the length of the PR, but this was a big project. Anyone up for reviewing?

@timoschilling
Copy link
Member

good job 👍

@deivid-rodriguez
Copy link
Member Author

Pushed an extra tiny fix. Travis will have one last opportunity to surface more issues :)

end
it "should fallback to edit" do
expect(auto_link(post)).to \
match(%r{<a href="/admin/posts/\d+/edit">Hello World</a>})
Copy link
Member

Choose a reason for hiding this comment

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

@deivid-rodriguez , are you sure we can completely remove locale=en?

this was reasonable introduced here #4766

please take a look

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, I accidentally removed that while refactoring. The test description was not related to locales, so I forgot to re-add it. I think those tests should be separate from the "normal case" because otherwise we don't test the "normal case". So I added be2d300, what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

expect(self).to receive(:url_for) { |url| url }
expect(self).to receive(:link_to).with "Hello World", url_path
auto_link(post)
expect(auto_link(post)).to \
Copy link
Member

Choose a reason for hiding this comment

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

David Rodríguez added 7 commits February 21, 2017 13:21
Reproducible with

```
rspec \
  ./spec/unit/pretty_format_spec.rb[1:7:2:2:1] \
  ./spec/unit/view_helpers/display_helper_spec.rb[1:2:10] \
  --seed 1234
```
Fixes

```
rspec ./spec/unit/resource_registration_spec.rb[1:1:2]
```
Fixes

```
rspec ./spec/unit/authorization/index_overriding_spec.rb[1:1]
```
David Rodríguez added 20 commits February 21, 2017 13:21
For example

```
./spec/unit/auto_link_spec.rb:4:in `block in <top (required)>':
uninitialized constant
ActiveAdmin::ViewHelpers::ActiveAdminApplicationHelper (NameError)
```

or

```
./lib/active_admin/views/components/paginated_collection.rb:118:in
`<class:PaginatedCollection>': uninitialized constant
ActiveAdmin::ViewHelpers::DownloadFormatLinksHelper (NameError)
```
Fixes

```
rspec \
  ./spec/unit/authorization/index_overriding_spec.rb[1:1] \
  ./spec/unit/resource/routes_spec.rb[1:1:3] \
  --seed 50491
```
Fixes

```
rspec \
  ./spec/unit/belongs_to_spec.rb[1:4:1] \
  ./spec/unit/namespace/register_resource_spec.rb[1:5:4:1:1] \
  --seed 43047
```
They lead to leaking state very easily.
Fixes

```
rspec \
  ./spec/unit/belongs_to_spec.rb[1:2:2:1] \
  ./spec/unit/resource/routes_spec.rb[1:6:1:1] \
  --seed 60387
```
And properly include it.
Extend it instead.

Fixes

```
rspec \
  ./spec/unit/authorization/controller_authorization_spec.rb[1:2] \
  ./spec/unit/views/components/index_list_spec.rb[1:1:1:1] \
  --seed 42890
```
Fixes

```
rspec \
  ./spec/unit/auto_link_spec.rb[1:1:1] \
  ./spec/unit/dsl_spec.rb[1:4:2] \
  --seed 11315
```
Fixes

```
rspec \
  ./spec/unit/auto_link_spec.rb[1:1:1] \
  ./spec/unit/resource_controller/data_access_spec.rb[1:5:1] \
  --seed 12654
```
Fixes

```
rspec \
  ./spec/unit/auto_link_spec.rb[1:1:1] \
  ./spec/unit/resource_controller_spec.rb[1:2:2] \
  --seed 45595

```
@Fivell
Copy link
Member

Fivell commented Feb 21, 2017

@timoschilling , looks like ready to merge
@deivid-rodriguez , are you going to use parallel_specs after this ?

@deivid-rodriguez
Copy link
Member Author

@Fivell Yes, I did that work locally but tests wouldn't pass. I'll check again after merging this, hopefully this fixes that.

Copy link
Member

@timoschilling timoschilling left a comment

Choose a reason for hiding this comment

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

👍

@timoschilling
Copy link
Member

Good work 🎉

@Fivell
Copy link
Member

Fivell commented Feb 21, 2017

@deivid-rodriguez , 🥇

@deivid-rodriguez deivid-rodriguez merged commit 8166ae9 into master Feb 21, 2017
@deivid-rodriguez deivid-rodriguez deleted the order_independent_tests branch February 21, 2017 20:25
@deivid-rodriguez
Copy link
Member Author

Thanks!! :)

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.

None yet

3 participants