mirror of
https://github.com/edcommonwealth/Dashboard.git
synced 2026-03-18 02:06:25 -07:00
set up example scaffold with rspec + factorybot tests
This commit is contained in:
parent
533c921a6d
commit
d1e6fb1e39
23 changed files with 512 additions and 6 deletions
26
spec/views/dashboard/examples/index.html.erb_spec.rb
Normal file
26
spec/views/dashboard/examples/index.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
require "rails_helper"
|
||||
require "nokogiri"
|
||||
|
||||
module Dashboard
|
||||
RSpec.describe "/dashboard/examples/index", type: :view do
|
||||
before(:each) do
|
||||
assign(:examples, [
|
||||
Example.create!(
|
||||
text: "Word",
|
||||
body: "Sentence"
|
||||
),
|
||||
Example.create!(
|
||||
text: "Word",
|
||||
body: "Sentence"
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of examples" do
|
||||
render
|
||||
cell_selector = Rails::VERSION::STRING >= "7" ? "div>p" : "tr>td"
|
||||
assert_select cell_selector, text: Regexp.new("Word".to_s), count: 2
|
||||
assert_select cell_selector, text: Regexp.new("Sentence".to_s), count: 2
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue