Permalink
Browse files

Make specs more reliable.

  • Loading branch information...
1 parent eddf305 commit b5f47b631b7772c50e46bee455e494817d46b692 @marnen committed Mar 2, 2014
Showing with 23 additions and 17 deletions.
  1. +23 −17 spec/features/stories_spec.rb
View
40 spec/features/stories_spec.rb
@@ -119,33 +119,39 @@
end
describe 'formatting' do
+ let(:title) { 'My story' }
+ let!(:story) { FactoryGirl.create :story, title: title, description: description, project: project, requested_by: user }
+
before do
Capybara.ignore_hidden_elements = true
visit project_path project
end
describe 'description', js: true do
- let(:title) { 'My story' }
- let(:expand_story) { find('.story-title', text: 'My story').click }
+ let(:expand_story) { find('.story-title', text: title).click }
- before do
- click_on 'Add story'
- fill_in 'title', with: title
- end
+ describe '*italics*' do
+ let(:description) { 'Text with *italics*.' }
- it 'shows *italics*' do
- fill_in 'description', with: 'Text with *italics*.'
- within('.story-controls') { click_on 'Save' }
- expand_story
- page.should have_css :em, text: 'italics'
+ specify 'edit form' do
+ expand_story
+ page.should have_css :em, text: 'italics'
+ end
end
- it 'autolinks URLs' do
- url = 'http://www.google.com'
- fill_in 'description', with: "Text with a URL: #{url}"
- within('.story-controls') { click_on 'Save' }
- expand_story
- page.should have_css "a[href='#{url}']", text: url
+ describe 'autolink URLs' do
+ let(:url) { 'http://www.google.com' }
+ let(:description) { "Text with a URL: #{url}" }
+
+ specify 'edit form' do
+ expand_story
+ page.should have_css "a[href='#{url}']", text: url
+ end
+
+ xspecify 'hover' do
+ find('.popover-activate').hover
+ page.should have_css "a[href='#{url}']", text: url
+ end
end
end
end

0 comments on commit b5f47b6

Please sign in to comment.