Created
September 2, 2015 19:43
-
-
Save elrayle/129ecac092587b8d9849 to your computer and use it in GitHub Desktop.
my first capybara test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'spec_helper' | |
| describe 'generic_files/new.html.erb', type: :view do | |
| let(:user_collection) { | |
| default_option = SolrDocument.new(id: -1, title_tesim: "Select collection...") | |
| col1 = SolrDocument.new(id: "1", title_tesim: "col1") | |
| col2 = SolrDocument.new(id: "2", title_tesim: "col2") | |
| [default_option, col1, col2] | |
| } | |
| describe 'upload_to_collection' do | |
| before do | |
| Sufia.config.upload_to_collection = upload_to_collection | |
| end | |
| context 'when enabled' do | |
| let(:upload_to_collection) { true } | |
| it 'appears on page' do | |
| render | |
| page = Capybara::Node::Simple.new(rendered) | |
| expect(page).to have_selector('select#collection', count: 1) | |
| end | |
| end | |
| context 'when disabled' do | |
| let(:upload_to_collection) { false } | |
| it 'does not appear on page' do | |
| render | |
| page = Capybara::Node::Simple.new(rendered) | |
| expect(page).to have_no_selector('select#collection') | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment