mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
27 lines
670 B
Ruby
27 lines
670 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
class TestHelper < ActionView::Base; end
|
|
|
|
RSpec.describe BulkFormBuilder do
|
|
describe '#text_field' do
|
|
let(:product) { create(:product) }
|
|
let(:form) { BulkFormBuilder.new(:product, product, self, {}) }
|
|
|
|
it { expect(form.text_field(:name)).not_to include "changed" }
|
|
|
|
context "attribute has been changed" do
|
|
before { product.assign_attributes name: "updated name" }
|
|
|
|
it { expect(form.text_field(:name)).to include "changed" }
|
|
|
|
context "and saved" do
|
|
before { product.save }
|
|
|
|
it { expect(form.text_field(:name)).not_to include "changed" }
|
|
end
|
|
end
|
|
end
|
|
end
|