Sha256: 78a192820cb2da804ee25ff0af929d2c065a594b9c8165eb7d386002855a553f

Contents?: true

Size: 915 Bytes

Versions: 13

Compression:

Stored size: 915 Bytes

Contents

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

RSpec.describe <%= klass %>, ".[]" do
  # TODO: either remove this line, or set another source for available locales
  let(:available_locales) { I18n.available_locales }
<% (parsed_params + parsed_options).each do |name| -%>
  let(:<%= name %>) { FactoryGirl.build :<%= name %> }
<% end -%>

  it "is valid with proper arguments" do
    expect { described_class[<%= policy_signature %>] }.not_to be_invalid_at
  end
<% parsed_validators.each do |v| %>
  # TODO: fix default description
  it "is invalid when <%= "not " if v[:key] == v[:name] %><%= v[:key] %>" do
    # TODO: modify some arguments
<% (parsed_params + parsed_options).each do |name| -%>
    <%= name %> = nil
<% end -%>
    # TODO: add necessary tags to focus the condition
    expect { described_class[<%= policy_signature %>] }.to be_invalid_at
  end
<% end -%>
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
tram-policy-0.4.0 lib/tram/policy/generator/policy_spec.erb
tram-policy-0.3.1 lib/tram/policy/generator/policy_spec.erb
tram-policy-0.3.0 lib/tram/policy/generator/policy_spec.erb
tram-policy-0.2.5 lib/tram/policy/generator/policy_spec.erb
tram-policy-0.2.4 lib/tram/policy/generator/policy_spec.erb
tram-policy-0.2.3 lib/tram/policy/generator/policy_spec.erb
tram-policy-0.2.2 lib/tram/policy/generator/policy_spec.erb
tram-policy-0.2.1 lib/tram/policy/generator/policy_spec.erb
tram-policy-0.2.0 lib/tram/policy/generator/policy_spec.erb
tram-policy-0.1.1 lib/tram/policy/generator/policy_spec.erb
tram-policy-0.1.0 lib/tram/policy/generator/policy_spec.erb
tram-policy-0.0.3 lib/tram/policy/generator/policy_spec.erb
tram-policy-0.0.2 lib/tram/policy/generator/policy_spec.erb