I have something similar to the following code
feature Something do
let!(:var) { FactoryGirl.create(:var) }
include_examples "these examples"
end
shared_examples_for "these examples" do
scenario "test" do
visit some_url
expect(page).to have_values(var)
end
end
RSpec::Matchers.define :have_values do |expected|
match do |actual|
page.has_text(expected.name)
end
end
FactoryGirl.define do
factory :var do
sequence(name) {|n| "name#{n}}
end
end
The problem I'm having is that let doesn't seem to memoize var into the
matcher. Since var.name is a sequence, the name on the page when it is
visited is different from the check in the customer matcher.
Rspec 2.12, Capybara 2
Thanks in advance for the help
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
To view this discussion on the web visit
https://groups.google.com/d/msg/rspec/-/bAHVIkAH7GkJ.
For more options, visit https://groups.google.com/groups/opt_out.