Sha256: 6b5b76e95b46a9280a53f1da4fe185426cf917d33c594e0e67a02ffc592d6310

Contents?: true

Size: 1.41 KB

Versions: 8

Compression:

Stored size: 1.41 KB

Contents

require File.join(File.dirname(__FILE__), "..", "..", "example_helper.rb")

describe "Relevance::Tarantula::Form large example" do
  before do
    @tag = Hpricot(<<END)
<form action="/session" method="post">
  <input name="authenticity_token" type="hidden" value="1be0d07c6e13669a87b8f52a3c7e1d1ffa77708d" />
  <input id="email" name="email" size="30" type="text" />
  <input id="password" name="password" size="30" type="password" />
  <input id="remember_me" name="remember_me" type="checkbox" value="1" />
  <input name="commit" type="submit" value="Log in" />
</form>
END
    @form = Relevance::Tarantula::Form.new(@tag.at('form'))
  end
  
  it "has an action" do
    @form.action.should == "/session"
  end
  
  it "has a method" do
    @form.method.should == "post"
  end
  
end

describe "A Relevance::Tarantula::Form" do
  it "defaults method to 'get'" do
    @tag = Hpricot("<form/>")
    @form = Relevance::Tarantula::Form.new(@tag.at('form'))
    @form.method.should == 'get'
  end
end

describe "A Relevance::Tarantula::Form with a hacked _method" do
  before do
    @tag = Hpricot(<<END)
<form action="/foo">
  <input name="authenticity_token" type="hidden" value="1be0d07c6e13669a87b8f52a3c7e1d1ffa77708d" />
  <input id="_method" name="_method" size="30" type="text" value="PUT"/>
</form>
END
    @form = Relevance::Tarantula::Form.new(@tag.at('form'))
  end

  it "has a method" do
    @form.method.should == "put"
  end
  
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
relevance-tarantula-0.1.0 examples/relevance/tarantula/form_example.rb
relevance-tarantula-0.1.1 examples/relevance/tarantula/form_example.rb
relevance-tarantula-0.1.2 examples/relevance/tarantula/form_example.rb
relevance-tarantula-0.1.3 examples/relevance/tarantula/form_example.rb
relevance-tarantula-0.1.4 examples/relevance/tarantula/form_example.rb
relevance-tarantula-0.1.5 examples/relevance/tarantula/form_example.rb
tarantula-0.1.5 examples/relevance/tarantula/form_example.rb
tarantula-0.1.4 examples/relevance/tarantula/form_example.rb