Sha256: 9f3e135d03155dabc468c8821d36c961475c4f276477edebfeef7139e3b62c58

Contents?: true

Size: 732 Bytes

Versions: 6

Compression:

Stored size: 732 Bytes

Contents

require "spec_helper"
# TODO: move it to spec_helper
require "tram/policy/rspec"

RSpec.describe <%= klass %>, ".[]" do
  subject(:policy) { described_class[<%= policy_signature %>] }

<% (parsed_params + parsed_options).each do |name| -%>
  let(:<%= name %>) { FactoryGirl.build :<%= name %> }
<% end -%>

  it { is_expected.not_to be_invalid }
<% parsed_validators.each do |v| %>
  # TODO: fix context description
  context "when <%= "not " if v[:key] == v[:name] %><%= v[:key] %>" do
    # TODO: modify some arguments
<% (parsed_params + parsed_options).each do |name| -%>
    let(:<%= name %>) { nil }
<% end -%>
    # TODO: add necessary tags to focus the condition
    it { is_expected.to be_invalid_at }
  end
<% end -%>
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tram-policy-2.2.0 lib/tram/policy/generator/policy_spec.erb
tram-policy-2.1.0 lib/tram/policy/generator/policy_spec.erb
tram-policy-2.0.1 lib/tram/policy/generator/policy_spec.erb
tram-policy-2.0.0 lib/tram/policy/generator/policy_spec.erb
tram-policy-1.0.1 lib/tram/policy/generator/policy_spec.erb
tram-policy-1.0.0 lib/tram/policy/generator/policy_spec.erb