test/mock_test.rb in neo-rails-0.0.7 vs test/mock_test.rb in neo-rails-0.0.8
- old
+ new
@@ -29,9 +29,39 @@
refute mock.mock.tagged?(:foo)
refute mock.mock.tagged?(:bar)
end
end
+ context :tag do
+ let(:mock) { Neo::Rails::Mock.new }
+
+ test "add tags" do
+ mock.mock.tag(:foo, :bar)
+ assert mock.mock.tagged?(:foo)
+ assert mock.mock.tagged?(:bar)
+ end
+
+ test "add tag uniquely" do
+ mock.mock.tag(:foo, :foo)
+ assert_equal [ :foo ], mock.mock.tags
+ end
+ end
+
+ context :untag do
+ let(:mock) { Neo::Rails::Mock.new(:foo, :bar) }
+
+ test "remove tags" do
+ mock.mock.untag(:bar, :foo)
+ refute mock.mock.tagged?(:foo)
+ refute mock.mock.tagged?(:bar)
+ end
+
+ test "remove unset tag works" do
+ refute mock.mock.tagged?(:nottagged)
+ mock.mock.untag(:nottagged)
+ end
+ end
+
context :options do
let(:mock) { Neo::Rails::Mock.new(:tag, :opt => true, "string" => :yes) }
test "passes options" do
assert_equal true, mock.mock.option(:opt)