Skip to content

Commit

Permalink
failed test for #30
Browse files Browse the repository at this point in the history
  • Loading branch information
akuchinke committed Nov 9, 2017
1 parent 828a4c5 commit 8798e50
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spec/factories/papers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
title "COMPUTING MACHINERY AND INTELLIGENCE"
venue "Mind 49: 433-460"
year 1950

end

factory :paper_with_author, class: Paper do
title "COMPUTING MACHINERY AND INTELLIGENCE"
venue "Mind 49: 433-460"
year 1950
authors {build_list :author, 1}
end

end
19 changes: 19 additions & 0 deletions spec/features/paper/show_paper_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'rails_helper'

describe "papers index page", type: :feature do

before do
@paper = create :paper_with_author
end

it "should render" do
visit paper_path(@paper)
end

it "should show all authors" do
visit paper_path(@paper)
expect(page).to have_content(@paper.authors[0].first_name)
end


end
5 changes: 5 additions & 0 deletions spec/models/paper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@
expect(paper.authors).to be_empty
end

it "Should have 1 author" do
paper=create :paper_with_author
expect(paper.authors.length).to eq(1)
end

end

0 comments on commit 8798e50

Please sign in to comment.