Skip to content

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

Merged
mshibuya merged 3 commits into
railsadminteam:masterfrom
tmesquita:nested-attributes-form-fix
Oct 29, 2016
Merged

fixes 'Cannot set property '_renderItem' of undefined' when adding a nested resource#2737
mshibuya merged 3 commits into
railsadminteam:masterfrom
tmesquita:nested-attributes-form-fix

Conversation

@tmesquita
Copy link
Copy Markdown
Contributor

Fixes #2722

@mshibuya
Copy link
Copy Markdown
Member

Spec is failing, can you take a look?

@tmesquita
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

@tmesquita thank you! 👍

@kubudubu
Copy link
Copy Markdown

When can we expect integration with master? ;)

@mshibuya mshibuya merged commit 326ee71 into railsadminteam:master Oct 29, 2016
@mshibuya
Copy link
Copy Markdown
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