Sha256: 7ea09127009fef4be424e235d24d7aed2a7d18683fcad5d29858099c08fc0987

Contents?: true

Size: 1.43 KB

Versions: 9

Compression:

Stored size: 1.43 KB

Contents

require File.expand_path(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

9 entries across 9 versions & 3 rubygems

Version Path
relevance-tarantula-0.1.6 examples/relevance/tarantula/form_example.rb
relevance-tarantula-0.1.7 examples/relevance/tarantula/form_example.rb
relevance-tarantula-0.1.8 examples/relevance/tarantula/form_example.rb
relevance-tarantula-0.2.0 examples/relevance/tarantula/form_example.rb
relevance-tarantula-0.2.1 examples/relevance/tarantula/form_example.rb
romanbsd-tarantula-0.1.8 examples/relevance/tarantula/form_example.rb
romanbsd-tarantula-0.2.0 examples/relevance/tarantula/form_example.rb
tarantula-0.1.8 examples/relevance/tarantula/form_example.rb
tarantula-0.2.0 examples/relevance/tarantula/form_example.rb