spec/lib/extensions/actions/action_spec.rb in table_cloth-0.4.2 vs spec/lib/extensions/actions/action_spec.rb in table_cloth-0.4.3
- old
+ new
@@ -13,27 +13,28 @@
end
context "#value" do
let(:model) { FactoryGirl.build(:dummy_model) }
let(:view_context) { ActionView::Base.new }
+ let(:table) { TableCloth::Base.new(nil, nil) }
context "string" do
let(:action_hash) { {proc: Proc.new{ "something" }} }
it "returns a string" do
- expect(subject.value(model, view_context)).to match /something/
+ expect(subject.value(model, view_context, table)).to match /something/
end
end
context "view helper" do
let(:action_hash) do
{proc: Proc.new { link_to "blank", "something" }}
end
it "returns a link" do
- expect(subject.value(model, view_context)).to match /href="something"/
- expect(subject.value(model, view_context)).to match />blank</
+ expect(subject.value(model, view_context, table)).to match /href="something"/
+ expect(subject.value(model, view_context, table)).to match />blank</
end
end
context "conditional" do
let(:action_hash) do
@@ -43,15 +44,15 @@
}
end
it "returns the link when the model condition succeeds" do
model.stub admin?: true
- expect(subject.value(model, view_context)).to include "something"
+ expect(subject.value(model, view_context, table)).to include "something"
end
it "does not return the link when the model condition fails" do
model.stub admin?: false
- expect(subject.value(model, view_context)).not_to include "something"
+ expect(subject.value(model, view_context, table)).not_to include "something"
end
end
end
-end
\ No newline at end of file
+end