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

fixes 'Cannot set property '_renderItem' of undefined' when adding a nested resource #2737

Merged
merged 3 commits into from
Oct 29, 2016

Conversation

tmesquita
Copy link
Contributor

Fixes #2722

@mshibuya
Copy link
Member

Spec is failing, can you take a look?

@tmesquita
Copy link
Contributor Author

tmesquita commented Oct 12, 2016

I'm looking into, it looks like it fails when using Capybara >=2.10.0. I haven't used Capybara much so it's taking me a little while trying to figure out what in that update is causing the test to no longer pass.

FWIW I'm also seeing the same thing happening on the master branch

@tmesquita
Copy link
Contributor Author

I think the test that is failing is a bum test

From what I can tell, the block for have_selector was not getting run prior to Capybara v2.1.0 which was released about a week ago (2016-10-05) since that functionality wasn't implemented until that version (teamcapybara/capybara@b5655e9#diff-5b48908a3d2bd3374aaef7b6394f1912R39)

# https://github.com/sferik/rails_admin/blob/master/spec/integration/basic/edit/rails_admin_basic_edit_spec.rb#L76
describe 'edit with has-and-belongs-to-many association' do
    before do
      @teams = FactoryGirl.create_list(:team, 3)
      @fan = FactoryGirl.create :fan, teams: [@teams[0]]
      visit edit_path(model_name: 'fan', id: @fan.id)
    end

    it 'shows associated objects' do      
      is_expected.to have_selector '#fan_team_ids' do |select|         
        # This block doesn't seem to run prior to Capybara v2.1.0
        expect(select[0]).to have_selector 'option[selected="selected"]'
        expect(select[1]).not_to have_selector 'option[selected="selected"]'
        expect(select[2]).not_to have_selector 'option[selected="selected"]'
      end
    end
end

@tmesquita tmesquita force-pushed the nested-attributes-form-fix branch from 64d2a8a to ca0510e Compare October 12, 2016 04:24
@benhutton
Copy link

@tmesquita thank you! 👍

@kubudubu
Copy link

When can we expect integration with master? ;)

@mshibuya mshibuya merged commit 326ee71 into railsadminteam:master Oct 29, 2016
@mshibuya
Copy link
Member

Awesome, 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.

4 participants