Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: andreacfm/f-matchers
base: d364e97a2a
...
head fork: andreacfm/f-matchers
compare: 8f867fee24
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
13 lib/f-matchers/rspec_matchers.rb
@@ -20,3 +20,16 @@
"#{subject.class} should not protect attribute #{attribute.inspect}"
end
end
+
+# spec for prepend_view_path
+RSpec::Matchers.define :prepend_view_path_with do |attribute|
+ match do |model|
+ model.send(:view_paths).paths.first.to_s == attribute
+ end
+ failure_message_for_should do
+ "#{subject} should prepend view path with #{attribute}"
+ end
+ failure_message_for_should_not do
+ "#{subject} should not prepend view path with #{attribute}"
+ end
+end
View
2  lib/f-matchers/version.rb
@@ -1,3 +1,3 @@
module FMatchers
- VERSION = "0.0.4"
+ VERSION = "0.0.7"
end
View
27 spec/rspec_matchers_spec.rb
@@ -1,17 +1,28 @@
require "spec_helper"
+require "ostruct"
describe "rspec_f_matchers" do
-
- subject{Document}
-
- context "accept_nested_attributes_for" do
+
+ context "accept_nested_attributes_for" do
+ subject { Document }
it { should accept_nested_attributes_for(:section) }
it { should_not accept_nested_attributes_for(:users) }
- end
+ end
- context "protect_attribute" do
+ context "protect_attribute" do
+ subject { Document }
it { should protect_attribute(:protect_me) }
it { should_not protect_attribute(:do_not_protect_me) }
- end
-
+ end
+
+ context "prepend_view_path_with" do
+ before do
+ @receiver = Object.new
+ @receiver.stub(:view_paths){ OpenStruct.new paths: ['path_1'] }
+ end
+ subject{ @receiver }
+ it { should prepend_view_path_with('path_1') }
+ it { should_not prepend_view_path_with('path_2') }
+ end
+
end

No commit comments for this range

Something went wrong with that request. Please try again.